openwallet-foundation / credo-ts

Typescript framework for building decentralized identity and verifiable credential solutions
https://credo.js.org
Apache License 2.0
263 stars 199 forks source link

Support transaction endorsement in the IndyVdrIndyDidRegistrar #1135

Closed TimoGlastra closed 8 months ago

TimoGlastra commented 1 year ago

When registering a did through the IndySdkIndyDidRegistrar it is currently not possible to let the transaction be endorsed by another party. We should support this flow.

For the IndySdkIndyDidRegistrar we can leverage the did registration interface jobs to make the did registration a multi-step process.

First we create the did, then the did registrar will return a state of action with the signed request by the transaction author. Then the user of the framework will need to send the request to the endorser (out of scope how this happens for now). The endorser can then sign the transaction (need to add an api for this), and send it back to the author.

Reason for making this a manual process is that I would like to keep the did module as much separated from didcomm as possible. We could later then add the transaction endorser protocol as one way to request endorsement.

An (oversimplified) code example:

// agentA
// agentB

const { didState, jobId } = await agentA.dids.create({
  method: 'indy'
})

const endorsedTransaction = await agentB.modules.indyVdr.endorseTransaction({
      transaction: didState.transaction
})

const { didState } = await agentA.dids.create({
  method: 'indy',
  // pass jobId to continue previous process instead of creating new one
  jobId,
  options: {
    endorsedTransaction
  }
})

// Did is registered, hooray!
const didDocument = didState.didDocument

Todo

Resources:

TimoGlastra commented 1 year ago

Updated this to only support this in the IndyVdrIndyDidRegistrar. I don't think it's still worth to add this to the IndySdk classes

TimoGlastra commented 8 months ago

Done