Skip to content

Commit

Permalink
Adding await to did export (#1839)
Browse files Browse the repository at this point in the history
* Adding await to did export

* adding to site-new

---------

Co-authored-by: blackgirlbytes <[email protected]>
  • Loading branch information
blackgirlbytes and blackgirlbytes authored Oct 15, 2024
1 parent 2e85615 commit 735d555
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ import { DidJwk } from '@web5/dids'
const didDht = await DidDht.create({ publish: true });

// DID and its associated data which can be exported and used in different contexts/apps
const portableDid = didDht.export();
const portableDid = await didDht.export();

// DID string
const did = didDht.uri;
Expand All @@ -69,6 +69,7 @@ import { DidJwk } from '@web5/dids'
// :snippet-end:

expect(did).toMatch(/^did:dht:/);
expect(portableDid.uri).toEqual(did)
});

test("createDidJwk creates a DID with did:jwk method", async () => {
Expand All @@ -77,7 +78,7 @@ import { DidJwk } from '@web5/dids'
const didJwk = await DidJwk.create();

//DID and its associated data which can be exported and used in different contexts/apps
const portableDid = didJwk.export();
const portableDid = await didJwk.export();

//DID string
const did = didJwk.uri;
Expand All @@ -88,5 +89,6 @@ import { DidJwk } from '@web5/dids'
// :snippet-end:

expect(did).toMatch(/^did:jwk:/);
expect(portableDid.uri).toEqual(did)
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,18 @@ import { DidJwk } from '@web5/dids'
const didDht = await DidDht.create({ publish: true });

// DID and its associated data which can be exported and used in different contexts/apps
const portableDid = didDht.export()
const portableDid = await didDht.export()

// DID string
const did = didDht.uri;

// DID Document
const didDocument = JSON.stringify(didDht.document);

// :snippet-end:

expect(did).toMatch(/^did:dht:/);
expect(portableDid.uri).toEqual(did)
});

test('createDidJwk creates a DID with did:jwk method', async () => {
Expand All @@ -70,7 +71,7 @@ import { DidJwk } from '@web5/dids'
const didJwk = await DidJwk.create();

//DID and its associated data which can be exported and used in different contexts/apps
const portableDid = didJwk.export()
const portableDid = await didJwk.export()

//DID string
const did = didJwk.uri;
Expand All @@ -81,5 +82,6 @@ import { DidJwk } from '@web5/dids'
// :snippet-end:

expect(did).toMatch(/^did:jwk:/);
expect(portableDid.uri).toEqual(did)
});
});

0 comments on commit 735d555

Please sign in to comment.