-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add ability to generate DID from seed. #75
Conversation
531d9aa
to
9b6edc8
Compare
9b6edc8
to
f4aed86
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.
👍
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.
Seems ok. Would be good to get another reviewer here to make sure I'm not missing something.
Co-authored-by: Dave Longley <[email protected]>
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.
Approving this, but have not actually tested this yet! I have no issues with this being merged into v14.
@@ -173,6 +176,23 @@ describe('methods/veres-one', () => { | |||
expect(didDocument.id).to.match(/^did:v1:nym:z.*/); | |||
}); | |||
|
|||
it('should generate a DID document from seed', async () => { | |||
const seedBytes = (new TextEncoder()).encode(TEST_SEED).slice(0, 32); |
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.
This is a really interesting way of generating a 32-byte seed. @davidlehn Do we have a recommended way of generating a 32-byte seed from a string? @JSAssassin I don't think this is wrong, but it just got me wondering how we should be turning strings into 32-byte seeds. Also of note: this code comes from the did-method-key-js
test suite here: https://github.com/digitalbazaar/did-method-key/blob/602b82f8f3c71d687035e5642f3e32fa2651e2d0/test/driver.spec.js#L201-L213
@dmitrizagidulin uses this method to generate test data so I think it's ok. I would like consensus on how we want to turn strings into 32-byte unit8 arrays, but for a test this is good.
addresses #74