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

Improve error message returned when attempting to resolve did:dht DID that hasn't yet been published. Currently a bit misleading. #312

Closed
mistermoe opened this issue Nov 23, 2023 · 2 comments · Fixed by #334
Assignees
Labels
did:dht did:dht

Comments

@mistermoe
Copy link
Member

mistermoe commented Nov 23, 2023

Hitting the following error when attempting to resolve did:dht DIDs:

code:

const did = await DidDhtMethod.create();
const didResolutionResult = await DidDhtMethod.resolve({ didUrl: did.did });

error:

Error: Invalid SignedPacket bytes length, expected at least 72 bytes but got: 25
  at SignedPacket.fromBytes (file:///Users/moe/code/tbd/ose/web5/node_modules/pkarr/lib/signed_packet.js:75:13)
  at Pkarr.relayGet (file:///Users/moe/code/tbd/ose/web5/node_modules/pkarr/index.js:46:25)

Update

After talking to @decentralgabe , realized that this was happening because the DID hadn't yet been published. publishing requires passing publish: true to DidDhtMetod.create and waiting for ~10s. Better error message and some documentation could be helpful (though not clear where we should put those docs cc: @angiejones @ALRubinger @leordev)

@mistermoe mistermoe added bug Something isn't working did:dht did:dht labels Nov 23, 2023
@decentralgabe
Copy link
Member

This is a result of attempting to fetch the DID before it has published, which takes about 10 seconds. The error can be better but I wouldn't classify it as a bug.

@mistermoe mistermoe removed the bug Something isn't working label Nov 23, 2023
@mistermoe mistermoe changed the title did:dht resolution fails Improve error message returned when attempting to resolve did:dht DID that hasn't yet been published. Currently a bit misleading. Nov 23, 2023
@mistermoe
Copy link
Member Author

kk thanks! this works:

const sleep = (time) => new Promise(resolve => setTimeout(resolve, time));

const did = await DidDhtMethod.create({ publish: true });

await sleep(10_000);
const didResolutionResult = await DidDhtMethod.resolve({ didUrl: did.did });

agree that it's not a bug and agree that the error message could be better. removed the bug label and updated the github issue description to reflect

@frankhinek frankhinek linked a pull request Dec 5, 2023 that will close this issue
frankhinek added a commit that referenced this issue Dec 6, 2023
This PR primarily addresses Issue #312 by improving the error handling when attempting to resolve a did:dht DID that hasn't yet been published. Additionally, it modifies the key set handling to better align with the original intent and other existing DID method implementations. This was necessary to support the forthcoming switch to did:dht as the default DID for @web5/api package. Lastly it approves test coverage for the DID DHT related code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
did:dht did:dht
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants