Skip to content

Rework the DID registration API #2521

@TimoGlastra

Description

@TimoGlastra

It's based on did-registration, but i've found it to be always very complex and error prone. You need to know exactly which parameters to provide to make it work.

I was thinking that instead, especially for update, we make an improved API that supports a set of well-known operations on a did document. A did registrar can choose to implement these operations if they are supported for the did method.

I think in the end there are four operations for a did document:

  • removeKey
  • addKey
  • addService
  • removeService

So providing an array of operations to perform on a did document sounds more logical, and will prevent a lot of complexity i think.

Thoughts? I'd also like to update the API to be more like other modules, where it detects the registered di methods, and the API is automatically adjusted.

A registrar could define a minimal set of operations (e.g. MUST have at least one addKey operation for key type Ed25519 as the first operation), or custom operations (if they have extensions, like endorsement on Indy).

An example is:

await agent.dids.create({
  method: 'cheqd',
  operations: [{
     operation: 'addKey',
     createKey: {
         kty: 'OKP',
         crv: 'Ed25519'
     },
     // or provide existing keyId
  }]
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions