Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sphereon/oid4vc-common

Package Overview
Dependencies
Maintainers
0
Versions
135
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sphereon/oid4vc-common - npm Package Compare versions

Comparing version 0.16.1-next.26 to 0.16.1-next.29

24

dist/jwt/JwtVerifier.js

@@ -25,2 +25,15 @@ "use strict";

exports.getDidJwtVerifier = getDidJwtVerifier;
const getIssuer = (type, payload) => {
// For 'request-object' the `iss` value is not required so we map the issuer to client_id
if (type === 'request-object') {
if (!payload.client_id) {
throw new Error('Missing required field client_id in request object JWT');
}
return payload.client_id;
}
if (typeof payload.iss !== 'string') {
throw new Error(`Received an invalid JWT. '${type}' contains an invalid iss claim or it is missing.`);
}
return payload.iss;
};
const getX5cVerifier = (jwt, options) => {

@@ -35,6 +48,9 @@ const { type } = options;

}
if (typeof jwt.payload.iss !== 'string') {
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 };
return {
method: 'x5c',
x5c: jwt.header.x5c,
issuer: getIssuer(type, jwt.payload),
type: type,
alg: jwt.header.alg,
};
};

@@ -41,0 +57,0 @@ exports.getX5cVerifier = getX5cVerifier;

@@ -69,2 +69,17 @@ import { JWK, JwtHeader, JwtPayload, SigningAlgo } from '..';

const getIssuer = (type: JwtType, payload: JwtPayload): string => {
// For 'request-object' the `iss` value is not required so we map the issuer to client_id
if (type === 'request-object') {
if (!payload.client_id) {
throw new Error('Missing required field client_id in request object JWT');
}
return payload.client_id as string;
}
if (typeof payload.iss !== 'string') {
throw new Error(`Received an invalid JWT. '${type}' contains an invalid iss claim or it is missing.`);
}
return payload.iss;
};
export const getX5cVerifier = (jwt: { header: JwtHeader; payload: JwtPayload }, options: { type: JwtType }): X5cJwtVerifier => {

@@ -79,7 +94,9 @@ const { type } = options;

if (typeof jwt.payload.iss !== 'string') {
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 };
return {
method: 'x5c',
x5c: jwt.header.x5c,
issuer: getIssuer(type, jwt.payload),
type: type,
alg: jwt.header.alg,
};
};

@@ -86,0 +103,0 @@

4

package.json
{
"name": "@sphereon/oid4vc-common",
"version": "0.16.1-next.26+0a6c8e3",
"version": "0.16.1-next.29+b9236ad",
"description": "OpenID 4 Verifiable Credentials Common",

@@ -55,3 +55,3 @@ "source": "lib/index.ts",

},
"gitHead": "0a6c8e3b94ddf6a3942ec03eaf2fabbf4100ff41"
"gitHead": "b9236ad206b2d438c9a8a5dcbe3c6a1df91f7ed8"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc