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 413b6af
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 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
4 changes: 2 additions & 2 deletions packages/sd-jwt/tests/sdJwtVc.e2e.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { Key } from '@aries-framework/core'

import { AskarModule } from '@aries-framework/askar'
import {
Agent,
DidKey,
DidsModule,
Key,
KeyDidCreateOptions,
KeyDidRegistrar,
KeyDidResolver,
KeyType,
Expand Down

0 comments on commit 413b6af

Please sign in to comment.