Skip to content

Commit

Permalink
fix(sd-jwt): additional check for 'kty' claim
Browse files Browse the repository at this point in the history
Signed-off-by: Berend Sliedrecht <blu3beri@proton.me>
  • Loading branch information
berendsliedrecht committed Oct 30, 2023
1 parent 7385737 commit 056df0a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/sd-jwt/src/SdJwtService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ export class SdJwtService {
let key = signerKey

if (publicKeyJwk) {
if (!('kty' in publicKeyJwk)) {
throw new SdJwtError(
'Key type (kty) claim could not be found in the JWK of the confirmation (cnf) claim. Only JWK is supported right now'
)
}

const jwk = getJwkFromJson(publicKeyJwk as JwkJson)
key = Key.fromPublicKey(jwk.publicKey, jwk.keyType)
}
Expand Down

0 comments on commit 056df0a

Please sign in to comment.