veramo icon indicating copy to clipboard operation
veramo copied to clipboard

[bug] Unable to Create SDR With DID that Lacks Secp256k1 Key

Open nickreynolds opened this issue 2 years ago • 0 comments

async createSelectiveDisclosureRequest(
    args: ICreateSelectiveDisclosureRequestArgs,
    context: IAgentContext<IDIDManager & IKeyManager>,
  ): Promise<string> {
    try {
      const identifier = await context.agent.didManagerGet({ did: args.data.issuer })
      const data: Partial<ISelectiveDisclosureRequest> = args.data
      delete data.issuer
      Debug('veramo:selective-disclosure:create-sdr')('Signing SDR with', identifier.did)

      const key = identifier.keys.find((k) => k.type === 'Secp256k1')
      if (!key) throw Error('Signing key not found')

Observed Behavior:

  • createSelectiveDisclosureRequest throws an error if specified DID does not have an Secp256k1 Key

Expected Behavior:

  • Should be able to create SDRs using any acceptable key type

Version: @veramo/selective-disclosure @3.1.4@next

nickreynolds avatar Jun 22 '22 17:06 nickreynolds