-
Notifications
You must be signed in to change notification settings - Fork 28
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
feat!: native DIDDocuments and proper DID resolution interface #799
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.
submitting a first batch of comment to not leave them hanging any longer. more to follow!
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 really damn nice, great job and thanks for the contribution! I'm thinking that at some point we may want to introduce two resolution options: one that controls which key type is returned (to aid backwards-compatibility; if anybody is already working with actual did documents at this point) and one that controls whether you get fully qualified DID URIs vs fragments as your ids. But I'd probably just add that after this merge so you can move on.
Just get rid of the Buffer though, we shouldn't need to use that.
77c0db4
to
caf9e92
Compare
@rflechtner the reason for the failing unit tests is a bit more complicated to solve. The reason is not only the missing context, but also the fact that the verification suite expects the verification method in the legacy format, while now it's returned in a |
Isn't that fixed best by amending the suite so it accepts both multikeys and the legacy key representations? I think this would be fair in general, given that we have been using the legacy format for so long. It is also something that i would want to see more generally in the sdk, but thought we may re-add support for this later, after you merged. For now I'd implement minimal support for legacy keys just for the broken suites, just enough to get the currently failing tests to pass |
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.
Amazing! Just two little things and then we're done here :)
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.
🚀
Second attempt to fix https://github.com/KILTprotocol/ticket/issues/2804. It also fixes https://github.com/KILTprotocol/ticket/issues/2340.
Relevant changes
DidDetails.ts
@kiltprotocol/types
packageFullDidDetails.ts
verificationKey
toverificationMethod
LightDidDetails.ts
verificationKey
toverificationMethod
where neededDidResolver.ts
@kiltprotocol/types
, in theDidResolverV2.ts
module. I tried to carry over as much as possible from the current implementation of the resolver.Did.chain.ts
,Did.rpc.ts
,Did.signature.ts
DidDocument
type, dealing as much as possible with verification methods and DID Documents instead of our current intermediate representation.Where the "raw" keypair type still appears
To aid usability, I left the
DidVerificationKey
andDidEncryptionKey
types in a few places. For instance, when creating a light DID, so that the key does not have to first be converted into a fully-fledged verification method, for which the controller URI is still not known. Also theDid2.chain.ts
includes mentions ofDidKey
s in thegetStoreTxFromInput
, whereas the other function,getStoreTxFromDocument
takes a DID Document and composes a DID creation tx out of it. The oldgetStoreTx
is hence split into these two functions.What else
This is WIP, and I have mostly added new files in the DID and types packages so that old stuff is not broken yet. Comments, optimizations, etc will be improved once we agree this is the right level of abstraction. Additional utility functions can always be added if needed, as long as we don't break this newly-created semantic where everything is a DID Document, a verification method, or a service.