Skip to content

Commit

Permalink
fix: nits
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Auer <[email protected]>
  • Loading branch information
auer-martin committed Jul 29, 2024
1 parent 3c71599 commit 1a54e69
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/common/lib/jwt/Jwt.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type JwtHeader = jwtDecodeJwtHeader & {
alg?: string;
x5c?: string[];
kid?: string;
jwk?: JWK;
jwk?: JWK & { kty: string };
jwt?: string;
} & Record<string, unknown>;

Expand Down
6 changes: 3 additions & 3 deletions packages/common/lib/jwt/JwtVerifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const getDidJwtVerifier = (jwt: { header: JwtHeader; payload: JwtPayload
if (!jwt.header.kid.includes('#')) {
throw new Error(`Received an invalid JWT.. '${type}' contains an invalid kid header.`);
}
return { method: 'did', didUrl: jwt.header.kid, type: type, alg: jwt.header.alg as SigningAlgo };
return { method: 'did', didUrl: jwt.header.kid, type: type, alg: jwt.header.alg };
};

export const getX5cVerifier = (jwt: { header: JwtHeader; payload: JwtPayload }, options: { type: JwtType }): X5cJwtVerifier => {
Expand All @@ -79,7 +79,7 @@ export const getX5cVerifier = (jwt: { header: JwtHeader; payload: JwtPayload },
throw new Error(`Received an invalid JWT. '${type}' contains an invalid iss claim.`);
}

return { method: 'x5c', x5c: jwt.header.x5c, issuer: jwt.payload.iss, type: type, alg: jwt.header.alg as SigningAlgo };
return { method: 'x5c', x5c: jwt.header.x5c, issuer: jwt.payload.iss, type: type, alg: jwt.header.alg };
};

export const getJwkVerifier = async (jwt: { header: JwtHeader; payload: JwtPayload }, options: { type: JwtType }): Promise<JwkJwtVerifier> => {
Expand All @@ -91,7 +91,7 @@ export const getJwkVerifier = async (jwt: { header: JwtHeader; payload: JwtPaylo
throw new Error(`Received an invalid JWT. '${type}' contains an invalid jwk header.`);
}

return { method: 'jwk', type, jwk: jwt.header.jwk, alg: jwt.header.alg as SigningAlgo };
return { method: 'jwk', type, jwk: jwt.header.jwk, alg: jwt.header.alg };
};

export const getJwtVerifierWithContext = async (
Expand Down
2 changes: 1 addition & 1 deletion packages/siop-oid4vp/lib/types/VpJwtVerifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export const getRequestObjectJwtVerifier = async (
}
// The iss claim value of the Verifier Attestation JWT MUST identify a party the Wallet trusts for issuing Verifier Attestation JWTs.
// If the Wallet cannot establish trust, it MUST refuse the request.
return { method: 'jwk', type, jwk: attestationPayload.cnf['jwk'] as JWK, alg: (jwk.alg ?? attestationHeader.alg) as SigningAlgo }
return { method: 'jwk', type, jwk: attestationPayload.cnf['jwk'] as JWK, alg: jwk.alg ?? attestationHeader.alg }
} else if (clientIdScheme === 'entity_id') {
if (!clientId.startsWith('http')) {
throw new Error(SIOPErrors.INVALID_REQUEST_OBJECT_ENTITY_ID_SCHEME_CLIENT_ID)
Expand Down

0 comments on commit 1a54e69

Please sign in to comment.