Skip to content
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

Merged
merged 9 commits into from
Jan 4, 2022
Merged

Conversation

JSAssassin
Copy link
Contributor

addresses #74

CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Contributor

@dmitrizagidulin dmitrizagidulin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@dlongley dlongley left a 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.

lib/VeresOneDriver.js Outdated Show resolved Hide resolved
Copy link
Contributor

@aljones15 aljones15 left a 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);
Copy link
Contributor

@aljones15 aljones15 Jan 3, 2022

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.

@JSAssassin JSAssassin merged commit 4c91155 into v14.x Jan 4, 2022
@JSAssassin JSAssassin deleted the generate-did-from-seed branch January 4, 2022 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants