-
Notifications
You must be signed in to change notification settings - Fork 2
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
did:dht resolution #15
Conversation
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.
awesome work. after the test vectors pass this should be good to go
|
||
func test_resolve_publishedDID_withSingleVerificationMethod() async throws { | ||
Mock( | ||
url: URL(string: "https://diddht.tbddev.org/pjiiw7ibn6t9k1mkknkowjketa8chksgwzkt5uk8798epux1386o")!, |
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.
if these tests rely on DIDs being present on this node it will work for some time...then break when we move to our prod node.
separately I believe it's crucial to implement tests for the two vectors the spec currently has https://did-dht.com/#test-vectors
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.
I copied these tests from the web5-js
repo here.
In terms of the test-vectors defined in the spec, I'm a little confused as to what exactly they are representing. It looks like they are not resolution vectors, but instead are importing keys, and verifying a particular DIDDocument is constructed from them. Creation/Importing will be coming in a later PR, and should be able to handle those. Do let me know if I'm misunderstanding those though!
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.
they are not exactly resolution vectors, you are correct. they make sure you can construct a consistent document and packet given a set of inputs.
I mention it now because you have implemented fromDNSPacket which could exercise the listed vectors DNS packets and compare them to the resulting DID document.
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.
Added these vectors in the following commit: 93351ac
These vectors are kind of a deviation from the existing resolve
vectors in the web5-spec here, so I decided to just implement them directly in Swift for the time being. Eventually, I think these should work their way into the web5-spec
repo though, so that we ensure they pass across all SDKs. Just a matter of aligning on input/output formats!
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.
thank you @amika-sq I noted a comment here and will make sure to get these updated.
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.
awesome work
(Adding reviewers that I know are semi familiar with
did:dht
resolution. Feel free to add anyone else if I might have missed anyone!)This PR adds
did:dht
resolution.How-To
did:dht
resolution can be done either by interacting directly with theDIDDHT.Resolver
struct, or by resolving using the genericDIDResolver
, which can resolve any supported DID MethodResolving directly with
DIDDHT.Resolver
Resolution can be accomplished via the
DIDDHT.Resolver
struct:Resolving with
DIDResolver
Resolution can also be accomplished with the
DIDResolver
simply by calling it with a DID URI:By default,
DIDResolver
uses the default options to resolve the DID. If you want to customize the resolution process, create a newDIDDHT.Resolver
, define your desired custom options, and register it.Note
This will cause all
did:dht
resolutions to use the custom resolution options