Skip to content

Commit 0be9d66

Browse files
committed
fix: improve holder binding verification using thumbprint comparison
1 parent bf6d189 commit 0be9d66

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/credential/issuance/07-verify-and-parse-credential.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { EvaluateIssuerTrust } from "./02-evaluate-issuer-trust";
44
import { IoWalletError } from "../../utils/errors";
55
import { SdJwt4VC, verify as verifySdJwt } from "../../sd-jwt";
66
import { getValueFromDisclosures } from "../../sd-jwt/converters";
7-
import type { JWK } from "../../utils/jwk";
7+
import { isSameThumbprint, type JWK } from "../../utils/jwk";
88
import type { ObtainCredential } from "./06-obtain-credential";
99
import { Logger, LogLevel } from "../../utils/logging";
1010

@@ -168,8 +168,7 @@ async function verifyCredentialSdJwt(
168168
]);
169169

170170
const { cnf } = decodedCredential.sdJwt.payload;
171-
172-
if (!cnf.jwk.kid || cnf.jwk.kid !== holderBindingKey.kid) {
171+
if (!(await isSameThumbprint(cnf.jwk, holderBindingKey as JWK))) {
173172
const message = `Failed to verify holder binding, expected kid: ${holderBindingKey.kid}, got: ${decodedCredential.sdJwt.payload.cnf.jwk.kid}`;
174173
Logger.log(LogLevel.ERROR, message);
175174
throw new IoWalletError(message);

0 commit comments

Comments
 (0)