Skip to content

Commit

Permalink
fix: Make sure we do not use the jwk thumbprint as kid default value …
Browse files Browse the repository at this point in the history
…when not in EBSI
  • Loading branch information
nklomp committed Jul 7, 2024
1 parent 9a3bf56 commit c4a22aa
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/oid4vci-holder/src/agent/OID4VCIHolderService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,13 @@ export const getIdentifierOpts = async (args: GetIdentifierArgs): Promise<Identi
}
}
const key: _ExtendedIKey = await getAuthenticationKey(identifier, context, identifier.did.startsWith('did:ebsi'), true)
const kid: string = (identifier.did.startsWith('did:ebsi:') ? key.meta?.jwkThumbprint : key.meta.verificationMethod?.id) ?? key.kid
let kid: string = key.meta.verificationMethod?.id ?? key.kid
if (identifier.did.startsWith('did:ebsi:')) {
kid = key.meta?.jwkThumbprint
} else if (!kid.startsWith('did:')) {
const optionalHashTag = kid.startsWith('#') ? '' : '#'
kid = `${identifier.did}${optionalHashTag}${kid}`
}

return { identifier, key, kid }
}
Expand Down

0 comments on commit c4a22aa

Please sign in to comment.