@sphereon/ssi-types
Advanced tools
Comparing version 0.9.1-next.16 to 0.9.1-next.17
@@ -124,3 +124,3 @@ "use strict"; | ||
static jwtDecodedPresentationToUniformPresentation(decoded, makeCredentialsUniform = true, opts) { | ||
const presentation = Object.assign({}, (decoded.vp)); | ||
const presentation = Object.assign({}, decoded.vp); | ||
if (makeCredentialsUniform) { | ||
@@ -178,3 +178,3 @@ if (!decoded.vp.verifiableCredential) { | ||
static jwtDecodedCredentialToUniformCredential(decoded, opts) { | ||
const credential = Object.assign({}, (decoded.vc)); | ||
const credential = Object.assign({}, decoded.vc); | ||
const maxSkewInMS = (opts === null || opts === void 0 ? void 0 : opts.maxTimeSkewInMS) !== undefined ? opts.maxTimeSkewInMS : 999; | ||
@@ -181,0 +181,0 @@ if (decoded.exp) { |
{ | ||
"name": "@sphereon/ssi-types", | ||
"description": "SSI Common Types", | ||
"version": "0.9.1-next.16+1907345", | ||
"version": "0.9.1-next.17+63e059b", | ||
"main": "dist/index.js", | ||
@@ -40,3 +40,3 @@ "types": "dist/index.d.ts", | ||
], | ||
"gitHead": "1907345725090a90ae9b96104114f33bc4ed8250" | ||
"gitHead": "63e059b0460ae40e6d31a5ed0f0707fbd99f75af" | ||
} |
@@ -70,3 +70,3 @@ import { | ||
originalPresentation: OriginalVerifiablePresentation, | ||
opts?: { maxTimeSkewInMS?: number }, | ||
opts?: { maxTimeSkewInMS?: number } | ||
): WrappedVerifiablePresentation { | ||
@@ -89,3 +89,6 @@ const original = originalPresentation | ||
} | ||
const vcs: WrappedVerifiableCredential[] = CredentialMapper.toWrappedVerifiableCredentials(vp.verifiableCredential/*.map(value => value.original)*/, opts) | ||
const vcs: WrappedVerifiableCredential[] = CredentialMapper.toWrappedVerifiableCredentials( | ||
vp.verifiableCredential /*.map(value => value.original)*/, | ||
opts | ||
) | ||
@@ -108,3 +111,3 @@ const presentation = { | ||
verifiableCredentials: OriginalVerifiableCredential[], | ||
opts?: { maxTimeSkewInMS?: number }, | ||
opts?: { maxTimeSkewInMS?: number } | ||
): WrappedVerifiableCredential[] { | ||
@@ -116,3 +119,3 @@ return verifiableCredentials.map((vc) => CredentialMapper.toWrappedVerifiableCredential(vc, opts)) | ||
verifiableCredential: OriginalVerifiableCredential, | ||
opts?: { maxTimeSkewInMS?: number }, | ||
opts?: { maxTimeSkewInMS?: number } | ||
): WrappedVerifiableCredential { | ||
@@ -160,3 +163,3 @@ const original = verifiableCredential | ||
makeCredentialsUniform: boolean = true, | ||
opts?: { maxTimeSkewInMS?: number }, | ||
opts?: { maxTimeSkewInMS?: number } | ||
): IPresentation { | ||
@@ -169,6 +172,6 @@ return CredentialMapper.jwtDecodedPresentationToUniformPresentation(jwt_decode(jwt), makeCredentialsUniform, opts) | ||
makeCredentialsUniform: boolean = true, | ||
opts?: { maxTimeSkewInMS?: number }, | ||
opts?: { maxTimeSkewInMS?: number } | ||
): IVerifiablePresentation { | ||
const presentation: IVerifiablePresentation = { | ||
...(decoded.vp), | ||
...decoded.vp, | ||
} | ||
@@ -179,5 +182,3 @@ if (makeCredentialsUniform) { | ||
} | ||
presentation.verifiableCredential = decoded.vp.verifiableCredential.map((vc) => | ||
CredentialMapper.toUniformCredential(vc, opts), | ||
) | ||
presentation.verifiableCredential = decoded.vp.verifiableCredential.map((vc) => CredentialMapper.toUniformCredential(vc, opts)) | ||
} | ||
@@ -227,3 +228,3 @@ if (decoded.iss) { | ||
uniformPresentation.verifiableCredential = uniformPresentation.verifiableCredential?.map((vc) => | ||
CredentialMapper.toUniformCredential(vc, opts), | ||
CredentialMapper.toUniformCredential(vc, opts) | ||
) as IVerifiableCredential[] // We cast it because we IPresentation needs a VC. The internal Credential doesn't have the required Proof anymore (that is intended) | ||
@@ -237,5 +238,8 @@ return uniformPresentation | ||
static jwtDecodedCredentialToUniformCredential(decoded: JwtDecodedVerifiableCredential, opts?: { maxTimeSkewInMS?: number }): IVerifiableCredential { | ||
static jwtDecodedCredentialToUniformCredential( | ||
decoded: JwtDecodedVerifiableCredential, | ||
opts?: { maxTimeSkewInMS?: number } | ||
): IVerifiableCredential { | ||
const credential: IVerifiableCredential = { | ||
...(decoded.vc), | ||
...decoded.vc, | ||
} | ||
@@ -375,3 +379,5 @@ | ||
static toCompactJWT(jwtDocument: W3CVerifiableCredential | JwtDecodedVerifiableCredential | W3CVerifiablePresentation | JwtDecodedVerifiablePresentation): string { | ||
static toCompactJWT( | ||
jwtDocument: W3CVerifiableCredential | JwtDecodedVerifiableCredential | W3CVerifiablePresentation | JwtDecodedVerifiablePresentation | ||
): string { | ||
if (CredentialMapper.detectDocumentType(jwtDocument) !== DocumentFormat.JWT) { | ||
@@ -397,3 +403,5 @@ throw Error('Cannot convert non JWT credential to JWT') | ||
static detectDocumentType(document: W3CVerifiableCredential | W3CVerifiablePresentation | JwtDecodedVerifiableCredential | JwtDecodedVerifiablePresentation): DocumentFormat { | ||
static detectDocumentType( | ||
document: W3CVerifiableCredential | W3CVerifiablePresentation | JwtDecodedVerifiableCredential | JwtDecodedVerifiablePresentation | ||
): DocumentFormat { | ||
if (typeof document === 'string') { | ||
@@ -400,0 +408,0 @@ return this.isJsonLdAsString(document) ? DocumentFormat.JSONLD : DocumentFormat.JWT |
@@ -22,3 +22,3 @@ export enum IProofPurpose { | ||
BbsBlsBoundSignatureProof2020 = 'BbsBlsBoundSignatureProof2020', | ||
JwtProof2020 = 'JwtProof2020' | ||
JwtProof2020 = 'JwtProof2020', | ||
} | ||
@@ -25,0 +25,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
102142
1495