@sphereon/ssi-types
Advanced tools
Comparing version 0.32.1-feature.SPRIND.137.18 to 0.32.1-fix.15
@@ -13,11 +13,8 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CredentialMapper = void 0; | ||
const jwt_decode_1 = __importDefault(require("jwt-decode")); | ||
const types_1 = require("../types"); | ||
const mso_mdoc_1 = require("../types/mso_mdoc"); | ||
const utils_1 = require("../utils"); | ||
const jwt_decode_1 = require("jwt-decode"); | ||
class CredentialMapper { | ||
@@ -43,4 +40,4 @@ /** | ||
if (CredentialMapper.isJwtEncoded(presentation)) { | ||
const payload = (0, jwt_decode_1.default)(presentation); | ||
const header = (0, jwt_decode_1.default)(presentation, { header: true }); | ||
const payload = (0, jwt_decode_1.jwtDecode)(presentation); | ||
const header = (0, jwt_decode_1.jwtDecode)(presentation, { header: true }); | ||
payload.vp.proof = { | ||
@@ -92,4 +89,4 @@ type: types_1.IProofType.JwtProof2020, | ||
if (CredentialMapper.isJwtEncoded(credential)) { | ||
const payload = (0, jwt_decode_1.default)(credential); | ||
const header = (0, jwt_decode_1.default)(credential, { header: true }); | ||
const payload = (0, jwt_decode_1.jwtDecode)(credential); | ||
const header = (0, jwt_decode_1.jwtDecode)(credential, { header: true }); | ||
payload.vc.proof = { | ||
@@ -451,3 +448,3 @@ type: types_1.IProofType.JwtProof2020, | ||
static jwtEncodedPresentationToUniformPresentation(jwt, makeCredentialsUniform = true, opts) { | ||
return CredentialMapper.jwtDecodedPresentationToUniformPresentation((0, jwt_decode_1.default)(jwt), makeCredentialsUniform, opts); | ||
return CredentialMapper.jwtDecodedPresentationToUniformPresentation((0, jwt_decode_1.jwtDecode)(jwt), makeCredentialsUniform, opts); | ||
} | ||
@@ -549,3 +546,3 @@ static jwtDecodedPresentationToUniformPresentation(decoded, makeCredentialsUniform = true, opts) { | ||
static jwtEncodedCredentialToUniformCredential(jwt, opts) { | ||
return CredentialMapper.jwtDecodedCredentialToUniformCredential((0, jwt_decode_1.default)(jwt), opts); | ||
return CredentialMapper.jwtDecodedCredentialToUniformCredential((0, jwt_decode_1.jwtDecode)(jwt), opts); | ||
} | ||
@@ -552,0 +549,0 @@ static jwtDecodedCredentialToUniformCredential(decoded, opts) { |
{ | ||
"name": "@sphereon/ssi-types", | ||
"description": "SSI Common Types", | ||
"version": "0.32.1-feature.SPRIND.137.18+a50eb337", | ||
"version": "0.32.1-fix.15+1619ae43", | ||
"main": "dist/index.js", | ||
@@ -16,3 +16,3 @@ "types": "dist/index.d.ts", | ||
"events": "^3.3.0", | ||
"jwt-decode": "^3.1.2", | ||
"jwt-decode": "^4.0.0", | ||
"uint8arrays": "3.1.1" | ||
@@ -51,3 +51,3 @@ }, | ||
"nx": {}, | ||
"gitHead": "a50eb3370348285cfab74db09584821fe2b1be42" | ||
"gitHead": "1619ae43e4fdee49a2bf6bfb6196cce25d33e5a3" | ||
} |
import { IssuerType } from '@veramo/core' | ||
import jwt_decode from 'jwt-decode' | ||
import { | ||
@@ -48,2 +47,3 @@ AsyncHasher, | ||
import DeviceResponseCbor = com.sphereon.mdoc.data.device.DeviceResponseCbor | ||
import { jwtDecode } from 'jwt-decode' | ||
@@ -73,4 +73,4 @@ export class CredentialMapper { | ||
if (CredentialMapper.isJwtEncoded(presentation)) { | ||
const payload = jwt_decode(presentation as string) as JwtDecodedVerifiablePresentation | ||
const header = jwt_decode(presentation as string, { header: true }) as Record<string, any> | ||
const payload = jwtDecode(presentation as string) as JwtDecodedVerifiablePresentation | ||
const header = jwtDecode(presentation as string, { header: true }) as Record<string, any> | ||
@@ -119,4 +119,4 @@ payload.vp.proof = { | ||
if (CredentialMapper.isJwtEncoded(credential)) { | ||
const payload = jwt_decode(credential as string) as JwtDecodedVerifiableCredential | ||
const header = jwt_decode(credential as string, { header: true }) as Record<string, any> | ||
const payload = jwtDecode(credential as string) as JwtDecodedVerifiableCredential | ||
const header = jwtDecode(credential as string, { header: true }) as Record<string, any> | ||
payload.vc.proof = { | ||
@@ -536,3 +536,3 @@ type: IProofType.JwtProof2020, | ||
): IPresentation { | ||
return CredentialMapper.jwtDecodedPresentationToUniformPresentation(jwt_decode(jwt), makeCredentialsUniform, opts) | ||
return CredentialMapper.jwtDecodedPresentationToUniformPresentation(jwtDecode(jwt), makeCredentialsUniform, opts) | ||
} | ||
@@ -667,3 +667,3 @@ | ||
): IVerifiableCredential { | ||
return CredentialMapper.jwtDecodedCredentialToUniformCredential(jwt_decode(jwt), opts) | ||
return CredentialMapper.jwtDecodedCredentialToUniformCredential(jwtDecode(jwt), opts) | ||
} | ||
@@ -670,0 +670,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
363758
6298
+ Addedjwt-decode@4.0.0(transitive)
- Removedjwt-decode@3.1.2(transitive)
Updatedjwt-decode@^4.0.0