Skip to content
This repository was archived by the owner on Dec 12, 2024. It is now read-only.
This repository was archived by the owner on Dec 12, 2024. It is now read-only.

didDht Import issues #259

@chris-tbd

Description

@chris-tbd

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions