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

feat: DID package refactor #447

Merged
merged 126 commits into from
Jan 28, 2022
Merged

feat: DID package refactor #447

merged 126 commits into from
Jan 28, 2022

Conversation

ntn-x2
Copy link
Member

@ntn-x2 ntn-x2 commented Dec 17, 2021

DID package refactor

This PR fixes https://github.com/KILTprotocol/ticket/issues/1756 and fixes https://github.com/KILTprotocol/ticket/issues/1712 by making DIDs and everything that uses DIDs (e.g., extrinsic DID signing) easier to use. The spec doc can be found in this HackMD document. Most of the things match the implementation, others have deviated a bit during the development.

What's changed

Most of the design was specified in the design document above, with the main different compared to the current codebase being that there are two components involved for DIDs:

  • a DidDetails abstract class which is then derive by LightDidDetails and FullDidDetails. These classes are meant to be used on the owner side (e.g., for decrypting/signing stuff, or to sign extrinsics).
  • a IDidDetails interface which is implemented by both LightDidDetails and FullDidDetails. This interface is meant to be used on the receiver side, hence it is exposed by the resolver and by methods that take arguments referring to the "other communicating party" (e.g., during credential exchange). This interface exposes basic methods that one would expect from a DID, i.e., retrieving key(s), and service endpoints by ID or by type.

Other changes

Some other important changes are the following:

  • rename DefaultResolver to DidResolver
  • refactor utility functions used in the integration tests to hide most of the logic from common operations and initialisation code (quite some more improvements could be done here, e.g. in #1759.
  • changes to how messages/request for attestations/presentations are authenticated with DIDs

What's missing

Batched DID operations (for creations and updates)

This PR has not implemented a DID builder, which would make the generation of full DID way easier. The initial design can be found in the document linked above, while a almost complete (untested) implementation can be found in this PR history, specifically commit 1cdc6e is the one where the whole code for builders was removed since it was decided to put it in a different PR.

Updated getting-started and examples guides

Another thing that is left out of this PR is the documentations. The reason is that most of the docs will have to change again fairly shortly when batched operations are added, hence I though that it would not be the best use of time to change all docs now and then change them again in few weeks. We won't have an official release that external people will be using anyway before we add the batching, so I don't think it's a big problem if integration tests for the docs are failing for a while. There's anyway a ticket tracking that.

Copy link
Member

@Dudleyneedham Dudleyneedham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@tjwelde tjwelde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like it. Just some questions and comments because of consistent coding style

packages/core/src/quote/Quote.ts Outdated Show resolved Hide resolved
packages/core/src/credential/Credential.ts Show resolved Hide resolved
packages/messaging/src/Message.ts Outdated Show resolved Hide resolved
packages/messaging/src/Message.ts Outdated Show resolved Hide resolved
packages/did/src/DidDocumentExporter/README.md Outdated Show resolved Hide resolved
packages/did/src/DidDetails/LightDidDetails.utils.ts Outdated Show resolved Hide resolved
packages/did/src/DidDetails/FullDidDetails.ts Show resolved Hide resolved
@ntn-x2 ntn-x2 merged commit 10439bc into develop Jan 28, 2022
@ntn-x2 ntn-x2 deleted the aa-did-refactor branch January 28, 2022 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💛 medium priority: medium ♻️ refactoring chore: refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants