-
Notifications
You must be signed in to change notification settings - Fork 56
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 ns record gateway handling #576
base: main
Are you sure you want to change the base?
Conversation
|
TBDocs Report 🛑 Errors: 0 @web5/api
@web5/crypto
@web5/crypto-aws-kms
@web5/dids
@web5/credentials
TBDocs Report Updated at 2024-05-21T19:10:02Z |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #576 +/- ##
==========================================
- Coverage 91.10% 90.78% -0.32%
==========================================
Files 116 118 +2
Lines 29664 29809 +145
Branches 2199 2219 +20
==========================================
+ Hits 27024 27062 +38
- Misses 2605 2711 +106
- Partials 35 36 +1
|
Co-authored-by: Gabe <[email protected]>
packages/dids/src/methods/did-dht.ts
Outdated
let resolutionGatewayUris = await DidDhtDocument.getAuthoritativeGatewayUris({ didUri, dnsPacket }); | ||
|
||
// Only do a second retrieval if the authoritative resolution gateway URIs are different from the given gateway URI. | ||
if(!resolutionGatewayUris.includes(gatewayUri)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this work with the .
/ FQDN syntax?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it takes out the trailing .
and the documentation is updated .
The resolutionGatewayUris will be the value in the ns minus the last .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approving if the condition I mentioned as test coverage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks legit, only missing test for the code added.
Also added a small refactoring PR to merge that addresses a few small issues: #608
* minor refactoring * Fixed an ambiguous if condition
I will wait to merge until vector 3 is in, and then I will resolve conflict and finish testing missing lines |
When resolving a did dht this change allows it to look at the ns records and find the authoritative gateways.
It will try to use these gateways, and accumulate errors if it fails. It will keep trying until all gateway uris are exhausted and then will return the accumulated errors.
Reference
https://did-dht.com/#resolution-gateways