-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: align object names with KERIpy and add function docs #307
base: main
Are you sure you want to change the base?
Conversation
a6965fe
to
482c023
Compare
Another goal of this PR is to get ready to add CESR 2.0 and KERI 2.0 support. |
83ea85c
to
0ddf614
Compare
0ddf614
to
5996d11
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #307 +/- ##
==========================================
+ Coverage 83.64% 83.69% +0.04%
==========================================
Files 48 48
Lines 4238 4269 +31
Branches 1055 1067 +12
==========================================
+ Hits 3545 3573 +28
- Misses 663 692 +29
+ Partials 30 4 -26 ☔ View full report in Codecov by Sentry. |
Looks like great goals and work! |
Good points Ed. I'll take a look at the signify-browser-extension code to see what exports it depends on. |
@edeykholt item 3 of your notes above is addressed here: WebOfTrust/signify-browser-extension#229 |
And @edeykholt , to your first point
the results of a full text search on the signify-browser-extension repository for the names I changed here show that nothing in the browser extension depends on the names I changed here. I will keep this in mind as I make further changes this week. If there are any refactorings that affect the browser extension then I will create a corresponding PR to that repo. |
a4f60d2
to
da4f5c3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work with all the cleanup and comments!
I added some minor nitpicking. But mostly, I am not sure about the IdentifierManager
vs KeyManager
naming. See the comment in the keeping.ts
file. I read your rationale, but maybe I misunderstood.
@@ -1,7 +1,7 @@ | |||
import { Algos } from './manager'; | |||
import { Tier } from './salter'; | |||
|
|||
export interface State { | |||
export interface KeyState { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel this is a bit backwards. Isn't this more the IdentifierState?
Then the SaltyState
below is more of a SaltyKeyState
, i.e., the state for the specific salty key.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I called this KeyState
is because that aligns with what KERIpy seems to use with things like KeyStateRecord
objects.
I refrained from changing SaltyState, RandyState, and GroupState since they seemed specific enough, yet on second thought it sounds good. I'll make that change.
transferable = true, | ||
temp = false, | ||
}: ManagerInceptArgs): [Array<Verfer>, Array<Diger>] { | ||
incept(mgrIcpArgs: ManagerInceptArgs): [Array<Verfer>, Array<Diger>] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imo, just args
is sufficient here. It is obvious from the context that it is the arguments of the incept method of the manager. mgrIcpArgs
is more confusing in my opinion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for the other methods here
* Interface for KERI identifier (prefix) creation, rotation, and signing. | ||
* @param T Type of the key keeper | ||
*/ | ||
export interface IdentifierManager< |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this more of a KeyManager
than an IdentifierManager
? You use it to create keys, which you in turn use to create identifiers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I called it IdentifierManager
is because that name communicates the broader scope of the class. An identifier can do incept, rotate, and sign. A key can sign, yet, not the other things. So that's why I picked IdentifierManager instead of KeyManager.
500fa11
to
5cc1e3c
Compare
@lenkan thanks for the comments! I made corresponding changes or added rationale for context. |
This is a work in progress PR. Status will be updated to "Ready for Review" at the end of this week.
Goals of PR
Overview
This PR does three main things:
Example - Keeper to IdentifierManager
As an example, key management in KERIpy occurs in
keeping.Manager
, notkeeping.Keeper
, so the SignifyTSKeeper
interface, which mimicked thekeeping.Manager
class in KERIpy, was renamed to beIdentifierManager
. Thekeeping.Keeper
class in KERIpy was used to store keys in the LMDB database whereas the Manager was used for creating keypairs, performing inception, rotation, and signing, among other responsibilities not ported to SignifyTS from KERIpy.The name
Manager
is already taken in SignifyTS by themanager.Manager
class, yet the responsibilities of thekeeping.Manager
class were being split across both themanager.Manager
class and thekeeping.Keeper
class. So the existingkeeping.Keeper
class in SignifyTS was renamed tokeeping.IdentifierManager
since that seemed to be a descriptive, clear name describing the fact that implementations of this object perform key pair creation, inception, rotation, and signing.Motivation
While reading the Signify source code recently to gain a deeper understanding of key management in Signify I have noticed again a number of naming differences between SignifyTS and KERIpy that are unnecessary and introduce questions of meaning and compatibility. This PR makes the code clear by aligning the codebase with the naming used in the KERIpy codebase.
The significant work of Phil and Kevin, and those who came after them, to port the style, names, and ideas from KERIpy is a strong influence on the motivation to continue that alignment and further it.
Future work to complete this PR
My current task is to understand the ways stems for Salty key generation and lookup work. I plan to document everything I read as I gain a complete understanding of that code.
Looking for comments
Please feel free to opine and share your thoughts on what naming policies or related ideas should make it into this PR.