Skip to content

Commit

Permalink
feat: allow existing did document for mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
nklomp committed Jan 16, 2023
1 parent 4d82518 commit 5f183ce
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/did-utils/src/didFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ export async function mapIdentifierKeysToDocWithJwkSupport(
context: IAgentContext<IResolver>,
didDocument?: DIDDocument
): Promise<_ExtendedIKey[]> {
const keys = await mapIdentifierKeysToDoc(identifier, section, context)
const rsaDidWeb = identifier.keys && identifier.keys.length > 0 && identifier.keys[0].type === 'RSA' && didDocument
// We skip mapping in case the identifier is RSA and a did document is supplied.
const keys = rsaDidWeb ? [] : await mapIdentifierKeysToDoc(identifier, section, context)
const didDoc = didDocument ? didDocument : await resolveDidOrThrow(identifier.did, context)
// dereference all key agreement keys from DID document and normalize
const documentKeys: VerificationMethod[] = await dereferenceDidKeysWithJwkSupport(didDoc, section, context)
Expand Down

0 comments on commit 5f183ce

Please sign in to comment.