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

didDht Import issues #259

Open
chris-tbd opened this issue Jul 17, 2024 · 0 comments
Open

didDht Import issues #259

chris-tbd opened this issue Jul 17, 2024 · 0 comments

Comments

@chris-tbd
Copy link

I've been working with portable DIDs a lot and seemingly randomly run into this issue:

TypeError: Cannot read properties of undefined (reading 'uri')
 ❯ Function.<anonymous> node_modules/.pnpm/@[email protected]/node_modules/@web5/dids/src/methods/did-dht.ts:655:45
 ❯ node_modules/.pnpm/@[email protected]/node_modules/@web5/dids/dist/esm/methods/did-dht.js:7:71
 ❯ __awaiter node_modules/.pnpm/@[email protected]/node_modules/@web5/dids/dist/esm/methods/did-dht.js:3:12
 ❯ Function.import node_modules/.pnpm/@[email protected]/node_modules/@web5/dids/dist/esm/methods/did-dht.js:410:16
 ❯ site/testsuites/testsuite-javascript/__tests__/tbdex/wallet/quickstart.test.js:34:42

In my latest case, I ran into this issue simply by changing the name of the input JSON. Example snippet:

let customerDidString = '{"uri":"did:dht:h8e3yqnhgjwhtkjhxwhfy5mmkn4nebqxr8idguwrsxgef6ow8efo","document":{"id":"did:dht:h8e3yqnhgjwhtkjhxwhfy5mmkn4nebqxr8idguwrsxgef6ow8efo","verificationMethod":[{"id":"did:dht:h8e3yqnhgjwhtkjhxwhfy5mmkn4nebqxr8idguwrsxgef6ow8efo#0","type":"JsonWebKey","controller":"did:dht:h8e3yqnhgjwhtkjhxwhfy5mmkn4nebqxr8idguwrsxgef6ow8efo","publicKeyJwk":{"crv":"Ed25519","kty":"OKP","x":"4dGQOFwyacipPH04UG1rULQkBc8h6jNOhLPMgvoUOgs","kid":"XPokllC3LZAVGizIL0naDdByQHeyY12uLJaXO4j46Nw","alg":"EdDSA"}}],"authentication":["did:dht:h8e3yqnhgjwhtkjhxwhfy5mmkn4nebqxr8idguwrsxgef6ow8efo#0"],"assertionMethod":["did:dht:h8e3yqnhgjwhtkjhxwhfy5mmkn4nebqxr8idguwrsxgef6ow8efo#0"],"capabilityDelegation":["did:dht:h8e3yqnhgjwhtkjhxwhfy5mmkn4nebqxr8idguwrsxgef6ow8efo#0"],"capabilityInvocation":["did:dht:h8e3yqnhgjwhtkjhxwhfy5mmkn4nebqxr8idguwrsxgef6ow8efo#0"]},"metadata":{"published":true,"versionId":"1718740086"},"privateKeys":[{"crv":"Ed25519","d":"iTfn3Z8uPp3gTg-9LxQVZVODGqnP3M0UDjZiIwBEctc","kty":"OKP","x":"4dGQOFwyacipPH04UG1rULQkBc8h6jNOhLPMgvoUOgs","kid":"XPokllC3LZAVGizIL0naDdByQHeyY12uLJaXO4j46Nw","alg":"EdDSA"}]}'

       // Customer DID    
       const customerPortableDid = JSON.parse(customerDidString);
       customerDid = await DidDht.import({ customerPortableDid });

Seems very finicky and hoping to figure out what could be going wrong here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant