-
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: light (offchain) DIDs #408
Conversation
…endpoints as part of light DID identifier
@tjwelde I think this PR could be reviewed now. The getting started and examples are clearly still failing (probably the scope of another PR). Tests on Node 14 are failing because of the lack of extensive coverage. For Node 16 it seems to be the very same problem that has been going on for a while. Integration tests with master are obviously failing, while the ones with develop have mostly gone through, with some timeout errors for some balance-specific stuff which I do not think is to be taken into consideration. |
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 pretty good I must say ;)
S: I would leave the v1
part out for the first version, just because it looks nicer ;)
did = did.concat(':', encodedDetails) | ||
} | ||
|
||
super( |
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.
really like the abstraction with the DIDDetails
parent class
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.
fixes KILTProtocol/ticket#1531
This PR adds support for light (or off-chain) DIDs. The new class of DIDs are still compliant with the same
IDidDetails
interface, so they are completely transparent to the users. A light DID is created by specifying an authentication key (which can beed25519
,sr25519
, orecdsa
), and optionally an encryption key and some service endpoints. The latter two, if present, are CBOR serialised and Base64 encoded and are added as part of the DID string itself.This PR also changes the structure of DIDs in general, as support for versioning has been added. An example of a full DID is the following:
did:kilt:v1:4r1WkS3t8rbCb11H8t3tJvGVCynwDXSUBiuGB6sLRHzCLCjs
, while a light DID that only specifies an authentication key would have the following structure:did:kilt:light:v1:004r1WkS3t8rbCb11H8t3tJvGVCynwDXSUBiuGB6sLRHzCLCjs
. The first two00
in the identifier represent the type of the authentication key that has been encoded to be the DID identifier.EDIT AFTER PR REVIEW
DID version 1 skip the
v1
bit in the URI, so a full DID v1 isdid:kilt:4r1WkS3t8rbCb11H8t3tJvGVCynwDXSUBiuGB6sLRHzCLCjs
while a light DID v1 isdid:kilt:light:004r1WkS3t8rbCb11H8t3tJvGVCynwDXSUBiuGB6sLRHzCLCjs
.How to test:
Run
yarn test
. All unit tests and integration tests are passing (for Node 14). I did not add much coverage to the existing test cases as I think that is out of the scope for this PR. Next PR could include updating the getting-started guides and examples with the latest version (that uses DIDs everywhere).Checklist: