@sphereon/ssi-sdk.presentation-exchange 0.34.1-next.7 → 0.34.1-next.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
- package/src/functions.ts +7 -7
package/dist/index.cjs
CHANGED
|
@@ -490,7 +490,7 @@ async function createPEXPresentationSignCallback(args, context) {
|
|
|
490
490
|
}
|
|
491
491
|
if (!formatOptions) {
|
|
492
492
|
if (import_ssi_types2.CredentialMapper.isSdJwtDecodedCredentialPayload(presentation.decodedPayload)) {
|
|
493
|
-
return "
|
|
493
|
+
return "dc+sd-jwt";
|
|
494
494
|
} else if (import_ssi_types2.CredentialMapper.isMsoMdocDecodedPresentation(presentation.decodedPayload)) {
|
|
495
495
|
return "mso_mdoc";
|
|
496
496
|
} else if (import_ssi_types2.CredentialMapper.isW3cPresentation(presentation.decodedPayload)) {
|
|
@@ -503,13 +503,13 @@ async function createPEXPresentationSignCallback(args, context) {
|
|
|
503
503
|
} else if (typeof formatOptions === "string") {
|
|
504
504
|
return formatOptions;
|
|
505
505
|
}
|
|
506
|
-
const formats = new Set(Object.keys(formatOptions).map((form) => form.includes("ldp") ? "lds" : form.includes("
|
|
506
|
+
const formats = new Set(Object.keys(formatOptions).map((form) => form.includes("ldp") ? "lds" : form.includes("dc+sd-jwt") ? "dc+sd-jwt" : "jwt"));
|
|
507
507
|
if (formats.size === 1) {
|
|
508
508
|
return formats.values().next().value;
|
|
509
509
|
}
|
|
510
510
|
formats.keys().next();
|
|
511
|
-
if (formats.has("
|
|
512
|
-
return "
|
|
511
|
+
if (formats.has("dc+sd-jwt")) {
|
|
512
|
+
return "dc+sd-jwt";
|
|
513
513
|
} else if (formats.has("jwt")) {
|
|
514
514
|
return "jwt";
|
|
515
515
|
}
|
|
@@ -528,7 +528,7 @@ async function createPEXPresentationSignCallback(args, context) {
|
|
|
528
528
|
idOpts.offlineWhenNoDIDRegistered = true;
|
|
529
529
|
}
|
|
530
530
|
if ("compactSdJwtVc" in presentation) {
|
|
531
|
-
if (proofFormat !== "
|
|
531
|
+
if (proofFormat !== "dc+sd-jwt") {
|
|
532
532
|
return Promise.reject(Error(`presentation payload does not match proof format ${proofFormat}`));
|
|
533
533
|
}
|
|
534
534
|
const presentationResult = await context.agent.createSdJwtPresentation({
|
|
@@ -548,7 +548,7 @@ async function createPEXPresentationSignCallback(args, context) {
|
|
|
548
548
|
return import_ssi_types2.CredentialMapper.storedPresentationToOriginalFormat(presentationResult.presentation);
|
|
549
549
|
} else {
|
|
550
550
|
const resolution = await context.agent.identifierManagedGet(idOpts);
|
|
551
|
-
if (proofFormat === "
|
|
551
|
+
if (proofFormat === "dc+sd-jwt") {
|
|
552
552
|
return Promise.reject(Error(`presentation payload does not match proof format ${proofFormat}`));
|
|
553
553
|
}
|
|
554
554
|
let header;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../plugin.schema.json","../src/index.ts","../src/agent/PresentationExchange.ts","../src/functions.ts"],"sourcesContent":["{\n \"IDidAuthSiopOpAuthenticator\": {\n \"components\": {\n \"schemas\": {\n \"IGetSiopSessionArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"sessionId\": {\n \"type\": \"string\"\n },\n \"additionalProperties\": false\n },\n \"required\": [\"sessionId\"],\n \"description\": \"Arguments needed for {@link DidAuthSiopOpAuthenticator.getSessionForSiop } \"\n },\n \"IRegisterSiopSessionArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"identifier\": {\n \"type\": \"object\",\n \"properties\": {\n \"did\": {\n \"type\": \"string\"\n },\n \"alias\": {\n \"type\": \"string\"\n },\n \"provider\": {\n \"type\": \"string\"\n },\n \"controllerKeyId\": {\n \"type\": \"string\"\n },\n \"keys\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n }\n },\n \"services\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n }\n }\n },\n \"additionalProperties\": false,\n \"required\": [\"did\", \"provider\", \"keys\", \"services\"]\n },\n \"sessionId\": {\n \"type\": \"string\"\n },\n \"expiresIn\": {\n \"type\": \"number\"\n },\n \"additionalProperties\": false\n },\n \"required\": [\"identifier\"],\n \"description\": \"Arguments needed for {@link DidAuthSiopOpAuthenticator.registerSessionForSiop } \"\n },\n \"IRemoveSiopSessionArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"sessionId\": {\n \"type\": \"string\"\n },\n \"additionalProperties\": false\n },\n \"required\": [\"sessionId\"],\n \"description\": \"Arguments needed for {@link DidAuthSiopOpAuthenticator.removeSessionForSiop } \"\n },\n \"IAuthenticateWithSiopArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"sessionId\": {\n \"type\": \"string\"\n },\n \"stateId\": {\n \"type\": \"string\"\n },\n \"redirectUrl\": {\n \"type\": \"string\"\n },\n \"additionalProperties\": false\n },\n \"required\": [\"sessionId\", \"stateId\", \"redirectUrl\"],\n \"description\": \"Arguments needed for {@link DidAuthSiopOpAuthenticator.authenticateWithSiop } \"\n },\n \"IResponse\": {\n \"type\": \"object\",\n \"properties\": {\n \"status\": {\n \"type\": \"number\"\n },\n \"additionalProperties\": true\n },\n \"required\": [\"status\"],\n \"description\": \"Result of {@link DidAuthSiopOpAuthenticator.authenticateWithSiop & DidAuthSiopOpAuthenticator.sendSiopAuthenticationResponse } \"\n },\n \"IGetSiopAuthenticationRequestFromRpArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"sessionId\": {\n \"type\": \"string\"\n },\n \"stateId\": {\n \"type\": \"string\"\n },\n \"redirectUrl\": {\n \"type\": \"string\"\n },\n \"additionalProperties\": false\n },\n \"required\": [\"sessionId\", \"stateId\", \"redirectUrl\"],\n \"description\": \"Arguments needed for {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestFromRP } \"\n },\n \"ParsedAuthenticationRequestURI\": {\n \"type\": \"object\",\n \"properties\": {\n \"jwt\": {\n \"type\": \"string\"\n },\n \"requestPayload\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"registration\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"additionalProperties\": false\n },\n \"required\": [\"jwt\", \"requestPayload\", \"registration\"],\n \"description\": \"Result of {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestFromRP } \"\n },\n \"IGetSiopAuthenticationRequestDetailsArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"sessionId\": {\n \"type\": \"string\"\n },\n \"verifiedAuthenticationRequest\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"credentialFilter\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"additionalProperties\": false\n },\n \"required\": [\"sessionId\", \"verifiedAuthenticationRequest\"],\n \"description\": \"Arguments needed for {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestDetails } \"\n },\n \"IAuthRequestDetails\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"alsoKnownAs\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"vpResponseOpts\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"additionalProperties\": false\n },\n \"required\": [\"id\", \"vpResponseOpts\"],\n \"description\": \"Result of {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestDetails } \"\n },\n \"IVerifySiopAuthenticationRequestUriArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"sessionId\": {\n \"type\": \"string\"\n },\n \"ParsedAuthenticationRequestURI\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"additionalProperties\": false\n },\n \"required\": [\"sessionId\", \"ParsedAuthenticationRequestURI\"],\n \"description\": \"Arguments needed for {@link DidAuthSiopOpAuthenticator.verifySiopAuthenticationRequestURI } \"\n },\n \"VerifiedAuthorizationRequest\": {\n \"type\": \"object\",\n \"properties\": {\n \"payload\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"presentationDefinitions\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"verifyOpts\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"additionalProperties\": false\n },\n \"required\": [\"payload\", \"verifyOpts\"],\n \"description\": \"Result of {@link DidAuthSiopOpAuthenticator.verifySiopAuthenticationRequestURI } \"\n },\n \"ISendSiopAuthenticationResponseArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"sessionId\": {\n \"type\": \"string\"\n },\n \"verifiedAuthenticationRequest\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"verifiablePresentationResponse\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"additionalProperties\": false\n },\n \"required\": [\"sessionId\", \"verifiedAuthenticationRequest\"],\n \"description\": \"Arguments needed for {@link DidAuthSiopOpAuthenticator.sendSiopAuthenticationResponse } \"\n }\n },\n \"methods\": {\n \"getSessionForSiop\": {\n \"description\": \"Get SIOP session\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IGetSiopSessionArgs\"\n },\n \"returnType\": \"object\"\n },\n \"registerSessionForSiop\": {\n \"description\": \"Register SIOP session\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IRegisterSiopSessionArgs\"\n },\n \"returnType\": \"object\"\n },\n \"removeSessionForSiop\": {\n \"description\": \"Remove SIOP session\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IRemoveSiopSessionArgs\"\n },\n \"returnType\": \"boolean\"\n },\n \"authenticateWithSiop\": {\n \"description\": \"Authenticate using DID Auth SIOP\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IAuthenticateWithSiopArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/Response\"\n }\n },\n \"getSiopAuthenticationRequestFromRP\": {\n \"description\": \"Get authentication request from RP\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IGetSiopAuthenticationRequestFromRpArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/ParsedAuthenticationRequestURI\"\n }\n },\n \"getSiopAuthenticationRequestDetails\": {\n \"description\": \"Get authentication request details\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IGetSiopAuthenticationRequestDetailsArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/IAuthRequestDetails\"\n }\n },\n \"verifySiopAuthenticationRequestURI\": {\n \"description\": \"Verify authentication request URI\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IVerifySiopAuthenticationRequestUriArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/VerifiedAuthorizationRequest\"\n }\n },\n \"sendSiopAuthenticationResponse\": {\n \"description\": \"Send authentication response\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/ISendSiopAuthenticationResponseArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/IRequiredContext\"\n }\n }\n }\n }\n }\n}\n","/**\n * @public\n */\nconst schema = require('../plugin.schema.json')\nexport { schema }\nexport { PresentationExchange } from './agent/PresentationExchange'\nexport * from './types/IPresentationExchange'\nexport * from './functions'\n","import {\n IDefinitionCredentialFilterArgs,\n IDefinitionValidateArgs,\n IPEXFilterResult,\n IPEXFilterResultWithInputDescriptor,\n IRequiredContext,\n PEXOpts,\n schema,\n VersionDiscoveryResult,\n} from '../index'\nimport { IAgentPlugin } from '@veramo/core'\n\nimport { IPresentationExchange } from '../types/IPresentationExchange'\nimport { Checked, IPresentationDefinition, PEX } from '@sphereon/pex'\nimport { CompactJWT, CredentialMapper, IProof, JWT_PROOF_TYPE_2020, W3CVerifiableCredential } from '@sphereon/ssi-types'\nimport { InputDescriptorV1, InputDescriptorV2 } from '@sphereon/pex-models'\nimport { toDIDs } from '@sphereon/ssi-sdk-ext.did-utils'\nimport { CredentialRole, UniqueDigitalCredential, verifiableCredentialForRoleFilter } from '@sphereon/ssi-sdk.credential-store'\nimport { FindDigitalCredentialArgs } from '@sphereon/ssi-sdk.data-store'\n\nexport class PresentationExchange implements IAgentPlugin {\n readonly schema = schema.IDidAuthSiopOpAuthenticator\n private readonly pex = new PEX()\n\n readonly methods: IPresentationExchange = {\n pexValidateDefinition: this.pexValidateDefinition.bind(this),\n pexDefinitionVersion: this.pexDefinitionVersion.bind(this),\n pexDefinitionFilterCredentials: this.pexDefinitionFilterCredentials.bind(this),\n pexDefinitionFilterCredentialsPerInputDescriptor: this.pexDefinitionFilterCredentialsPerInputDescriptor.bind(this),\n }\n\n constructor(opts?: PEXOpts) {}\n\n private async pexValidateDefinition(args: IDefinitionValidateArgs): Promise<boolean> {\n const { definition } = args\n const invalids: Checked[] = []\n\n try {\n const result = PEX.validateDefinition(definition)\n const validations = Array.isArray(result) ? result : [result]\n invalids.push(...validations.filter((v) => v.status === 'error'))\n } catch (error) {\n invalids.push({\n status: 'error',\n message:\n typeof error === 'string'\n ? error\n : typeof error === 'object' && 'message' in (error as object)\n ? (error as Error).message\n : 'unknown error',\n tag: 'validation',\n })\n }\n\n if (invalids.length > 0) {\n throw Error(`Invalid definition. ${invalids.map((v) => v.message).toString()}`)\n }\n return true // Never returns false, but REST API does not allow Promise<void>\n }\n\n async pexDefinitionVersion(presentationDefinition: IPresentationDefinition): Promise<VersionDiscoveryResult> {\n return PEX.definitionVersionDiscovery(presentationDefinition)\n }\n\n async pexDefinitionFilterCredentials(args: IDefinitionCredentialFilterArgs, context: IRequiredContext): Promise<IPEXFilterResult> {\n const credentials = await this.pexFilterCredentials(args.credentialFilterOpts, context)\n const holderDIDs = args.holderDIDs ? toDIDs(args.holderDIDs) : toDIDs(await context.agent.dataStoreORMGetIdentifiers())\n const selectResults = this.pex.selectFrom(args.presentationDefinition, credentials ?? [], {\n ...args,\n holderDIDs,\n limitDisclosureSignatureSuites: args.limitDisclosureSignatureSuites ?? ['BbsBlsSignature2020'],\n })\n return {\n id: args.presentationDefinition.id,\n selectResults,\n filteredCredentials: selectResults.verifiableCredential?.map((vc) => CredentialMapper.storedCredentialToOriginalFormat(vc)) ?? [],\n }\n }\n\n async pexDefinitionFilterCredentialsPerInputDescriptor(\n args: IDefinitionCredentialFilterArgs,\n context: IRequiredContext,\n ): Promise<IPEXFilterResultWithInputDescriptor[]> {\n const origDefinition = args.presentationDefinition\n const credentials = await this.pexFilterCredentials(args.credentialFilterOpts ?? {}, context)\n const holderDIDs = args.holderDIDs ? toDIDs(args.holderDIDs) : toDIDs(await context.agent.dataStoreORMGetIdentifiers())\n const limitDisclosureSignatureSuites = args.limitDisclosureSignatureSuites\n\n const promises = new Map<InputDescriptorV1 | InputDescriptorV2, Promise<IPEXFilterResult>>()\n origDefinition.input_descriptors.forEach((inputDescriptor) => {\n const presentationDefinition = {\n id: inputDescriptor.id,\n input_descriptors: [inputDescriptor],\n }\n\n const credentialRole = args.credentialFilterOpts.credentialRole\n\n promises.set(\n inputDescriptor,\n this.pexDefinitionFilterCredentials(\n {\n credentialFilterOpts: { credentialRole, verifiableCredentials: credentials },\n // @ts-ignore\n presentationDefinition,\n holderDIDs,\n limitDisclosureSignatureSuites,\n },\n context,\n ),\n )\n })\n await Promise.all(promises.values())\n const result: IPEXFilterResultWithInputDescriptor[] = []\n for (const entry of promises.entries()) {\n result.push({ ...(await entry[1]), inputDescriptor: entry[0] })\n }\n return result\n }\n\n private async pexFilterCredentials(\n filterOpts: {\n credentialRole: CredentialRole\n verifiableCredentials?: W3CVerifiableCredential[]\n filter?: FindDigitalCredentialArgs\n },\n context: IRequiredContext,\n ): Promise<W3CVerifiableCredential[]> {\n if (filterOpts.verifiableCredentials && filterOpts.verifiableCredentials.length > 0) {\n return filterOpts.verifiableCredentials as W3CVerifiableCredential[]\n }\n\n const filter = verifiableCredentialForRoleFilter(filterOpts.credentialRole, filterOpts.filter)\n const uniqueCredentials = await context.agent.crsGetUniqueCredentials({ filter })\n\n return uniqueCredentials.map((uniqueVC: UniqueDigitalCredential) => {\n const vc = uniqueVC.uniformVerifiableCredential!\n const proof = Array.isArray(vc.proof) ? vc.proof : [vc.proof]\n const jwtProof = proof.find((p: IProof) => p?.type === JWT_PROOF_TYPE_2020)\n return jwtProof ? (jwtProof.jwt as CompactJWT) : vc\n })\n }\n}\n","import { IPresentationDefinition } from '@sphereon/pex'\nimport { Format } from '@sphereon/pex-models'\nimport {\n isManagedIdentifierDidOpts,\n isManagedIdentifierDidResult,\n isManagedIdentifierX5cResult,\n ManagedIdentifierOptsOrResult,\n} from '@sphereon/ssi-sdk-ext.identifier-resolution'\nimport {\n CredentialMapper,\n Optional,\n OriginalVerifiablePresentation,\n SdJwtDecodedVerifiableCredential,\n W3CVerifiablePresentation,\n} from '@sphereon/ssi-types'\nimport { PresentationPayload, ProofFormat } from '@veramo/core'\nimport { IPEXPresentationSignCallback, IRequiredContext } from './types/IPresentationExchange'\n\nexport async function createPEXPresentationSignCallback(\n args: {\n idOpts: ManagedIdentifierOptsOrResult\n fetchRemoteContexts?: boolean\n skipDidResolution?: boolean\n format?: Format | ProofFormat\n domain?: string\n challenge?: string\n },\n context: IRequiredContext,\n): Promise<IPEXPresentationSignCallback> {\n function determineProofFormat(determineArgs: {\n format?: Format | 'jwt' | 'lds' | 'EthereumEip712Signature2021'\n presentationDefinition: IPresentationDefinition\n presentation: Optional<PresentationPayload, 'holder'> | SdJwtDecodedVerifiableCredential\n }): string {\n const { format, presentationDefinition, presentation } = determineArgs\n\n var formatOptions = format ?? presentationDefinition.format ?? args.format\n // TODO Refactor so it takes into account the Input Descriptors and we can lookup from there. Now we only do that if there is 1 descriptor\n if (!formatOptions && presentationDefinition.input_descriptors.length == 1 && 'format' in presentationDefinition.input_descriptors[0]) {\n formatOptions = presentationDefinition.input_descriptors[0].format\n }\n // All format arguments are optional. So if no format has been given we go for the most supported 'jwt'\n if (!formatOptions) {\n if (CredentialMapper.isSdJwtDecodedCredentialPayload(presentation.decodedPayload)) {\n return 'vc+sd-jwt'\n } else if (CredentialMapper.isMsoMdocDecodedPresentation(presentation.decodedPayload as OriginalVerifiablePresentation)) {\n return 'mso_mdoc'\n } else if (CredentialMapper.isW3cPresentation(presentation.decodedPayload)) {\n if (typeof presentation.signedPayload === 'string') {\n return 'jwt'\n }\n return 'lds'\n }\n return 'jwt'\n } else if (typeof formatOptions === 'string') {\n // if formatOptions is a singular string we can return that as the format\n return formatOptions\n }\n\n // here we transform all format options to either lds or jwt. but we also want to support sd-jwt, so we need to specifically check for this one. which is ['vc+sd-jwt']\n const formats = new Set(\n Object.keys(formatOptions).map((form) => (form.includes('ldp') ? 'lds' : form.includes('vc+sd-jwt') ? 'vc+sd-jwt' : 'jwt')),\n )\n\n // if we only have 1 format type we can return that\n if (formats.size === 1) {\n return formats.values().next().value!!\n }\n formats.keys().next()\n // if we can go for sd-jwt, we go for sd-jwt\n if (formats.has('vc+sd-jwt')) {\n return 'vc+sd-jwt'\n }\n // if it is not sd-jwt we would like to go for jwt\n else if (formats.has('jwt')) {\n return 'jwt'\n }\n\n // else we go for lds\n return 'lds'\n }\n\n return async ({\n presentation,\n domain,\n presentationDefinition,\n format,\n challenge,\n }: {\n presentation: Optional<PresentationPayload, 'holder'> | SdJwtDecodedVerifiableCredential\n presentationDefinition: IPresentationDefinition\n format?: Format | ProofFormat\n domain?: string\n challenge?: string\n }): Promise<W3CVerifiablePresentation> => {\n const proofFormat = determineProofFormat({ format, presentationDefinition, presentation })\n const { idOpts } = args\n const CLOCK_SKEW = 120\n if (args.skipDidResolution && isManagedIdentifierDidOpts(idOpts)) {\n idOpts.offlineWhenNoDIDRegistered = true\n }\n\n if ('compactSdJwtVc' in presentation) {\n if (proofFormat !== 'vc+sd-jwt') {\n return Promise.reject(Error(`presentation payload does not match proof format ${proofFormat}`))\n }\n\n const presentationResult = await context.agent.createSdJwtPresentation({\n ...(idOpts?.method === 'oid4vci-issuer' && { holder: idOpts?.issuer as string }),\n presentation: presentation.compactSdJwtVc,\n kb: {\n payload: {\n ...presentation.kbJwt?.payload,\n iat: presentation.kbJwt?.payload?.iat ?? Math.floor(Date.now() / 1000 - CLOCK_SKEW),\n nonce: challenge ?? presentation.kbJwt?.payload?.nonce,\n aud: presentation.kbJwt?.payload?.aud ?? domain ?? args.domain,\n },\n },\n })\n\n return CredentialMapper.storedPresentationToOriginalFormat(presentationResult.presentation as OriginalVerifiablePresentation)\n } else {\n const resolution = await context.agent.identifierManagedGet(idOpts)\n\n if (proofFormat === 'vc+sd-jwt') {\n return Promise.reject(Error(`presentation payload does not match proof format ${proofFormat}`))\n }\n let header\n if (!presentation.holder) {\n presentation.holder = resolution.issuer\n }\n if (proofFormat === 'jwt') {\n header = {\n ...((isManagedIdentifierDidResult(resolution) || isManagedIdentifierX5cResult(resolution)) && resolution.kid && { kid: resolution.kid }),\n ...(isManagedIdentifierX5cResult(resolution) && { jwk: resolution.jwk }),\n }\n if (presentation.verifier || !presentation.aud) {\n presentation.aud = Array.isArray(presentation.verifier) ? presentation.verifier : (presentation.verifier ?? domain ?? args.domain)\n delete presentation.verifier\n }\n\n if (!presentation.nbf) {\n if (presentation.issuanceDate) {\n const converted = Date.parse(presentation.issuanceDate)\n if (!isNaN(converted)) {\n presentation.nbf = Math.floor(converted / 1000) // no skew here, as an explicit value was given\n }\n } else {\n presentation.nbf = Math.floor(Date.now() / 1000 - CLOCK_SKEW)\n }\n }\n\n if (!presentation.iat) {\n presentation.iat = presentation.nbf\n }\n\n if (!presentation.exp) {\n if (presentation.expirationDate) {\n const converted = Date.parse(presentation.expirationDate)\n if (!isNaN(converted)) {\n presentation.exp = Math.floor(converted / 1000) // no skew here as an explicit value w as given\n }\n } else {\n presentation.exp = presentation.nbf + 600 + CLOCK_SKEW\n }\n }\n\n if (!presentation.vp) {\n presentation.vp = {}\n }\n /*if (!presentation.sub) {\n presentation.sub = id.did\n }*/\n if (!presentation.vp.holder) {\n presentation.vp.holder = presentation.holder\n }\n }\n\n // we ignore the alg / proof_format for now, as we already have the kid anyway at this point\n\n // todo: look for jwt_vc_json and remove types and @context\n\n const vp = await context.agent.createVerifiablePresentation({\n presentation: presentation as PresentationPayload,\n removeOriginalFields: false,\n keyRef: resolution.kmsKeyRef,\n // domain: domain ?? args.domain, // handled above, and did-jwt-vc creates an array even for 1 entry\n challenge: challenge ?? args.challenge,\n fetchRemoteContexts: args.fetchRemoteContexts !== false,\n proofFormat: proofFormat as ProofFormat,\n header,\n })\n\n // makes sure we extract an actual JWT from the internal representation in case it is a JWT\n return CredentialMapper.storedPresentationToOriginalFormat(vp as OriginalVerifiablePresentation)\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,gCAAAA,SAAA;AAAA,IAAAA,QAAA;AAAA,MACE,6BAA+B;AAAA,QAC7B,YAAc;AAAA,UACZ,SAAW;AAAA,YACT,qBAAuB;AAAA,cACrB,MAAQ;AAAA,cACR,YAAc;AAAA,gBACZ,WAAa;AAAA,kBACX,MAAQ;AAAA,gBACV;AAAA,gBACA,sBAAwB;AAAA,cAC1B;AAAA,cACA,UAAY,CAAC,WAAW;AAAA,cACxB,aAAe;AAAA,YACjB;AAAA,YACA,0BAA4B;AAAA,cAC1B,MAAQ;AAAA,cACR,YAAc;AAAA,gBACZ,YAAc;AAAA,kBACZ,MAAQ;AAAA,kBACR,YAAc;AAAA,oBACZ,KAAO;AAAA,sBACL,MAAQ;AAAA,oBACV;AAAA,oBACA,OAAS;AAAA,sBACP,MAAQ;AAAA,oBACV;AAAA,oBACA,UAAY;AAAA,sBACV,MAAQ;AAAA,oBACV;AAAA,oBACA,iBAAmB;AAAA,sBACjB,MAAQ;AAAA,oBACV;AAAA,oBACA,MAAQ;AAAA,sBACN,MAAQ;AAAA,sBACR,OAAS;AAAA,wBACP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AY,GAAA;YAC5C;UACF,OAAO;AACL/D,yBAAa6D,MAAMjB,KAAKC,MAAMC,KAAKC,IAAG,IAAK,MAAOrB,UAAAA;UACpD;QACF;AAEA,YAAI,CAAC1B,aAAa2C,KAAK;AACrB3C,uBAAa2C,MAAM3C,aAAa6D;QAClC;AAEA,YAAI,CAAC7D,aAAakE,KAAK;AACrB,cAAIlE,aAAamE,gBAAgB;AAC/B,kBAAMJ,YAAYjB,KAAKkB,MAAMhE,aAAamE,cAAc;AACxD,gBAAI,CAACF,MAAMF,SAAAA,GAAY;AACrB/D,2BAAakE,MAAMtB,KAAKC,MAAMkB,YAAY,GAAA;YAC5C;UACF,OAAO;AACL/D,yBAAakE,MAAMlE,aAAa6D,MAAM,MAAMnC;UAC9C;QACF;AAEA,YAAI,CAAC1B,aAAaoE,IAAI;AACpBpE,uBAAaoE,KAAK,CAAC;QACrB;AAIA,YAAI,CAACpE,aAAaoE,GAAG/B,QAAQ;AAC3BrC,uBAAaoE,GAAG/B,SAASrC,aAAaqC;QACxC;MACF;AAMA,YAAM+B,KAAK,MAAMzE,QAAQuC,MAAMmC,6BAA6B;QAC1DrE;QACAsE,sBAAsB;QACtBC,QAAQpB,WAAWqB;;QAEnBjD,WAAWA,aAAa7B,KAAK6B;QAC7BkD,qBAAqB/E,KAAK+E,wBAAwB;QAClDjD;QACA6B;MACF,CAAA;AAGA,aAAOjD,mCAAiB8C,mCAAmCkB,EAAAA;IAC7D;EACF;AACF;AAnLsB3E;;;AFftB,IAAMiF,SAASC;","names":["module","PresentationExchange","schema","IDidAuthSiopOpAuthenticator","pex","PEX","methods","pexValidateDefinition","bind","pexDefinitionVersion","pexDefinitionFilterCredentials","pexDefinitionFilterCredentialsPerInputDescriptor","opts","args","definition","invalids","result","validateDefinition","validations","Array","isArray","push","filter","v","status","error","message","tag","length","Error","map","toString","presentationDefinition","definitionVersionDiscovery","context","credentials","pexFilterCredentials","credentialFilterOpts","holderDIDs","toDIDs","agent","dataStoreORMGetIdentifiers","selectResults","selectFrom","limitDisclosureSignatureSuites","id","filteredCredentials","verifiableCredential","vc","CredentialMapper","storedCredentialToOriginalFormat","origDefinition","promises","Map","input_descriptors","forEach","inputDescriptor","credentialRole","set","verifiableCredentials","Promise","all","values","entry","entries","filterOpts","verifiableCredentialForRoleFilter","uniqueCredentials","crsGetUniqueCredentials","uniqueVC","uniformVerifiableCredential","proof","jwtProof","find","p","type","JWT_PROOF_TYPE_2020","jwt","import_ssi_sdk_ext","import_ssi_types","createPEXPresentationSignCallback","args","context","determineProofFormat","determineArgs","format","presentationDefinition","presentation","formatOptions","input_descriptors","length","CredentialMapper","isSdJwtDecodedCredentialPayload","decodedPayload","isMsoMdocDecodedPresentation","isW3cPresentation","signedPayload","formats","Set","Object","keys","map","form","includes","size","values","next","value","has","domain","challenge","proofFormat","idOpts","CLOCK_SKEW","skipDidResolution","isManagedIdentifierDidOpts","offlineWhenNoDIDRegistered","Promise","reject","Error","presentationResult","agent","createSdJwtPresentation","method","holder","issuer","compactSdJwtVc","kb","payload","kbJwt","iat","Math","floor","Date","now","nonce","aud","storedPresentationToOriginalFormat","resolution","identifierManagedGet","header","isManagedIdentifierDidResult","isManagedIdentifierX5cResult","kid","jwk","verifier","Array","isArray","nbf","issuanceDate","converted","parse","isNaN","exp","expirationDate","vp","createVerifiablePresentation","removeOriginalFields","keyRef","kmsKeyRef","fetchRemoteContexts","schema","require"]}
|
|
1
|
+
{"version":3,"sources":["../plugin.schema.json","../src/index.ts","../src/agent/PresentationExchange.ts","../src/functions.ts"],"sourcesContent":["{\n \"IDidAuthSiopOpAuthenticator\": {\n \"components\": {\n \"schemas\": {\n \"IGetSiopSessionArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"sessionId\": {\n \"type\": \"string\"\n },\n \"additionalProperties\": false\n },\n \"required\": [\"sessionId\"],\n \"description\": \"Arguments needed for {@link DidAuthSiopOpAuthenticator.getSessionForSiop } \"\n },\n \"IRegisterSiopSessionArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"identifier\": {\n \"type\": \"object\",\n \"properties\": {\n \"did\": {\n \"type\": \"string\"\n },\n \"alias\": {\n \"type\": \"string\"\n },\n \"provider\": {\n \"type\": \"string\"\n },\n \"controllerKeyId\": {\n \"type\": \"string\"\n },\n \"keys\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n }\n },\n \"services\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n }\n }\n },\n \"additionalProperties\": false,\n \"required\": [\"did\", \"provider\", \"keys\", \"services\"]\n },\n \"sessionId\": {\n \"type\": \"string\"\n },\n \"expiresIn\": {\n \"type\": \"number\"\n },\n \"additionalProperties\": false\n },\n \"required\": [\"identifier\"],\n \"description\": \"Arguments needed for {@link DidAuthSiopOpAuthenticator.registerSessionForSiop } \"\n },\n \"IRemoveSiopSessionArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"sessionId\": {\n \"type\": \"string\"\n },\n \"additionalProperties\": false\n },\n \"required\": [\"sessionId\"],\n \"description\": \"Arguments needed for {@link DidAuthSiopOpAuthenticator.removeSessionForSiop } \"\n },\n \"IAuthenticateWithSiopArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"sessionId\": {\n \"type\": \"string\"\n },\n \"stateId\": {\n \"type\": \"string\"\n },\n \"redirectUrl\": {\n \"type\": \"string\"\n },\n \"additionalProperties\": false\n },\n \"required\": [\"sessionId\", \"stateId\", \"redirectUrl\"],\n \"description\": \"Arguments needed for {@link DidAuthSiopOpAuthenticator.authenticateWithSiop } \"\n },\n \"IResponse\": {\n \"type\": \"object\",\n \"properties\": {\n \"status\": {\n \"type\": \"number\"\n },\n \"additionalProperties\": true\n },\n \"required\": [\"status\"],\n \"description\": \"Result of {@link DidAuthSiopOpAuthenticator.authenticateWithSiop & DidAuthSiopOpAuthenticator.sendSiopAuthenticationResponse } \"\n },\n \"IGetSiopAuthenticationRequestFromRpArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"sessionId\": {\n \"type\": \"string\"\n },\n \"stateId\": {\n \"type\": \"string\"\n },\n \"redirectUrl\": {\n \"type\": \"string\"\n },\n \"additionalProperties\": false\n },\n \"required\": [\"sessionId\", \"stateId\", \"redirectUrl\"],\n \"description\": \"Arguments needed for {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestFromRP } \"\n },\n \"ParsedAuthenticationRequestURI\": {\n \"type\": \"object\",\n \"properties\": {\n \"jwt\": {\n \"type\": \"string\"\n },\n \"requestPayload\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"registration\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"additionalProperties\": false\n },\n \"required\": [\"jwt\", \"requestPayload\", \"registration\"],\n \"description\": \"Result of {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestFromRP } \"\n },\n \"IGetSiopAuthenticationRequestDetailsArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"sessionId\": {\n \"type\": \"string\"\n },\n \"verifiedAuthenticationRequest\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"credentialFilter\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"additionalProperties\": false\n },\n \"required\": [\"sessionId\", \"verifiedAuthenticationRequest\"],\n \"description\": \"Arguments needed for {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestDetails } \"\n },\n \"IAuthRequestDetails\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"alsoKnownAs\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"vpResponseOpts\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"additionalProperties\": false\n },\n \"required\": [\"id\", \"vpResponseOpts\"],\n \"description\": \"Result of {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestDetails } \"\n },\n \"IVerifySiopAuthenticationRequestUriArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"sessionId\": {\n \"type\": \"string\"\n },\n \"ParsedAuthenticationRequestURI\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"additionalProperties\": false\n },\n \"required\": [\"sessionId\", \"ParsedAuthenticationRequestURI\"],\n \"description\": \"Arguments needed for {@link DidAuthSiopOpAuthenticator.verifySiopAuthenticationRequestURI } \"\n },\n \"VerifiedAuthorizationRequest\": {\n \"type\": \"object\",\n \"properties\": {\n \"payload\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"presentationDefinitions\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"verifyOpts\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"additionalProperties\": false\n },\n \"required\": [\"payload\", \"verifyOpts\"],\n \"description\": \"Result of {@link DidAuthSiopOpAuthenticator.verifySiopAuthenticationRequestURI } \"\n },\n \"ISendSiopAuthenticationResponseArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"sessionId\": {\n \"type\": \"string\"\n },\n \"verifiedAuthenticationRequest\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"verifiablePresentationResponse\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"additionalProperties\": false\n },\n \"required\": [\"sessionId\", \"verifiedAuthenticationRequest\"],\n \"description\": \"Arguments needed for {@link DidAuthSiopOpAuthenticator.sendSiopAuthenticationResponse } \"\n }\n },\n \"methods\": {\n \"getSessionForSiop\": {\n \"description\": \"Get SIOP session\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IGetSiopSessionArgs\"\n },\n \"returnType\": \"object\"\n },\n \"registerSessionForSiop\": {\n \"description\": \"Register SIOP session\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IRegisterSiopSessionArgs\"\n },\n \"returnType\": \"object\"\n },\n \"removeSessionForSiop\": {\n \"description\": \"Remove SIOP session\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IRemoveSiopSessionArgs\"\n },\n \"returnType\": \"boolean\"\n },\n \"authenticateWithSiop\": {\n \"description\": \"Authenticate using DID Auth SIOP\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IAuthenticateWithSiopArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/Response\"\n }\n },\n \"getSiopAuthenticationRequestFromRP\": {\n \"description\": \"Get authentication request from RP\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IGetSiopAuthenticationRequestFromRpArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/ParsedAuthenticationRequestURI\"\n }\n },\n \"getSiopAuthenticationRequestDetails\": {\n \"description\": \"Get authentication request details\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IGetSiopAuthenticationRequestDetailsArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/IAuthRequestDetails\"\n }\n },\n \"verifySiopAuthenticationRequestURI\": {\n \"description\": \"Verify authentication request URI\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IVerifySiopAuthenticationRequestUriArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/VerifiedAuthorizationRequest\"\n }\n },\n \"sendSiopAuthenticationResponse\": {\n \"description\": \"Send authentication response\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/ISendSiopAuthenticationResponseArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/IRequiredContext\"\n }\n }\n }\n }\n }\n}\n","/**\n * @public\n */\nconst schema = require('../plugin.schema.json')\nexport { schema }\nexport { PresentationExchange } from './agent/PresentationExchange'\nexport * from './types/IPresentationExchange'\nexport * from './functions'\n","import {\n IDefinitionCredentialFilterArgs,\n IDefinitionValidateArgs,\n IPEXFilterResult,\n IPEXFilterResultWithInputDescriptor,\n IRequiredContext,\n PEXOpts,\n schema,\n VersionDiscoveryResult,\n} from '../index'\nimport { IAgentPlugin } from '@veramo/core'\n\nimport { IPresentationExchange } from '../types/IPresentationExchange'\nimport { Checked, IPresentationDefinition, PEX } from '@sphereon/pex'\nimport { CompactJWT, CredentialMapper, IProof, JWT_PROOF_TYPE_2020, W3CVerifiableCredential } from '@sphereon/ssi-types'\nimport { InputDescriptorV1, InputDescriptorV2 } from '@sphereon/pex-models'\nimport { toDIDs } from '@sphereon/ssi-sdk-ext.did-utils'\nimport { CredentialRole, UniqueDigitalCredential, verifiableCredentialForRoleFilter } from '@sphereon/ssi-sdk.credential-store'\nimport { FindDigitalCredentialArgs } from '@sphereon/ssi-sdk.data-store'\n\nexport class PresentationExchange implements IAgentPlugin {\n readonly schema = schema.IDidAuthSiopOpAuthenticator\n private readonly pex = new PEX()\n\n readonly methods: IPresentationExchange = {\n pexValidateDefinition: this.pexValidateDefinition.bind(this),\n pexDefinitionVersion: this.pexDefinitionVersion.bind(this),\n pexDefinitionFilterCredentials: this.pexDefinitionFilterCredentials.bind(this),\n pexDefinitionFilterCredentialsPerInputDescriptor: this.pexDefinitionFilterCredentialsPerInputDescriptor.bind(this),\n }\n\n constructor(opts?: PEXOpts) {}\n\n private async pexValidateDefinition(args: IDefinitionValidateArgs): Promise<boolean> {\n const { definition } = args\n const invalids: Checked[] = []\n\n try {\n const result = PEX.validateDefinition(definition)\n const validations = Array.isArray(result) ? result : [result]\n invalids.push(...validations.filter((v) => v.status === 'error'))\n } catch (error) {\n invalids.push({\n status: 'error',\n message:\n typeof error === 'string'\n ? error\n : typeof error === 'object' && 'message' in (error as object)\n ? (error as Error).message\n : 'unknown error',\n tag: 'validation',\n })\n }\n\n if (invalids.length > 0) {\n throw Error(`Invalid definition. ${invalids.map((v) => v.message).toString()}`)\n }\n return true // Never returns false, but REST API does not allow Promise<void>\n }\n\n async pexDefinitionVersion(presentationDefinition: IPresentationDefinition): Promise<VersionDiscoveryResult> {\n return PEX.definitionVersionDiscovery(presentationDefinition)\n }\n\n async pexDefinitionFilterCredentials(args: IDefinitionCredentialFilterArgs, context: IRequiredContext): Promise<IPEXFilterResult> {\n const credentials = await this.pexFilterCredentials(args.credentialFilterOpts, context)\n const holderDIDs = args.holderDIDs ? toDIDs(args.holderDIDs) : toDIDs(await context.agent.dataStoreORMGetIdentifiers())\n const selectResults = this.pex.selectFrom(args.presentationDefinition, credentials ?? [], {\n ...args,\n holderDIDs,\n limitDisclosureSignatureSuites: args.limitDisclosureSignatureSuites ?? ['BbsBlsSignature2020'],\n })\n return {\n id: args.presentationDefinition.id,\n selectResults,\n filteredCredentials: selectResults.verifiableCredential?.map((vc) => CredentialMapper.storedCredentialToOriginalFormat(vc)) ?? [],\n }\n }\n\n async pexDefinitionFilterCredentialsPerInputDescriptor(\n args: IDefinitionCredentialFilterArgs,\n context: IRequiredContext,\n ): Promise<IPEXFilterResultWithInputDescriptor[]> {\n const origDefinition = args.presentationDefinition\n const credentials = await this.pexFilterCredentials(args.credentialFilterOpts ?? {}, context)\n const holderDIDs = args.holderDIDs ? toDIDs(args.holderDIDs) : toDIDs(await context.agent.dataStoreORMGetIdentifiers())\n const limitDisclosureSignatureSuites = args.limitDisclosureSignatureSuites\n\n const promises = new Map<InputDescriptorV1 | InputDescriptorV2, Promise<IPEXFilterResult>>()\n origDefinition.input_descriptors.forEach((inputDescriptor) => {\n const presentationDefinition = {\n id: inputDescriptor.id,\n input_descriptors: [inputDescriptor],\n }\n\n const credentialRole = args.credentialFilterOpts.credentialRole\n\n promises.set(\n inputDescriptor,\n this.pexDefinitionFilterCredentials(\n {\n credentialFilterOpts: { credentialRole, verifiableCredentials: credentials },\n // @ts-ignore\n presentationDefinition,\n holderDIDs,\n limitDisclosureSignatureSuites,\n },\n context,\n ),\n )\n })\n await Promise.all(promises.values())\n const result: IPEXFilterResultWithInputDescriptor[] = []\n for (const entry of promises.entries()) {\n result.push({ ...(await entry[1]), inputDescriptor: entry[0] })\n }\n return result\n }\n\n private async pexFilterCredentials(\n filterOpts: {\n credentialRole: CredentialRole\n verifiableCredentials?: W3CVerifiableCredential[]\n filter?: FindDigitalCredentialArgs\n },\n context: IRequiredContext,\n ): Promise<W3CVerifiableCredential[]> {\n if (filterOpts.verifiableCredentials && filterOpts.verifiableCredentials.length > 0) {\n return filterOpts.verifiableCredentials as W3CVerifiableCredential[]\n }\n\n const filter = verifiableCredentialForRoleFilter(filterOpts.credentialRole, filterOpts.filter)\n const uniqueCredentials = await context.agent.crsGetUniqueCredentials({ filter })\n\n return uniqueCredentials.map((uniqueVC: UniqueDigitalCredential) => {\n const vc = uniqueVC.uniformVerifiableCredential!\n const proof = Array.isArray(vc.proof) ? vc.proof : [vc.proof]\n const jwtProof = proof.find((p: IProof) => p?.type === JWT_PROOF_TYPE_2020)\n return jwtProof ? (jwtProof.jwt as CompactJWT) : vc\n })\n }\n}\n","import { IPresentationDefinition } from '@sphereon/pex'\nimport { Format } from '@sphereon/pex-models'\nimport {\n isManagedIdentifierDidOpts,\n isManagedIdentifierDidResult,\n isManagedIdentifierX5cResult,\n ManagedIdentifierOptsOrResult,\n} from '@sphereon/ssi-sdk-ext.identifier-resolution'\nimport {\n CredentialMapper,\n Optional,\n OriginalVerifiablePresentation,\n SdJwtDecodedVerifiableCredential,\n W3CVerifiablePresentation,\n} from '@sphereon/ssi-types'\nimport { PresentationPayload, ProofFormat } from '@veramo/core'\nimport { IPEXPresentationSignCallback, IRequiredContext } from './types/IPresentationExchange'\n\nexport async function createPEXPresentationSignCallback(\n args: {\n idOpts: ManagedIdentifierOptsOrResult\n fetchRemoteContexts?: boolean\n skipDidResolution?: boolean\n format?: Format | ProofFormat\n domain?: string\n challenge?: string\n },\n context: IRequiredContext,\n): Promise<IPEXPresentationSignCallback> {\n function determineProofFormat(determineArgs: {\n format?: Format | 'jwt' | 'lds' | 'EthereumEip712Signature2021'\n presentationDefinition: IPresentationDefinition\n presentation: Optional<PresentationPayload, 'holder'> | SdJwtDecodedVerifiableCredential\n }): string {\n const { format, presentationDefinition, presentation } = determineArgs\n\n var formatOptions = format ?? presentationDefinition.format ?? args.format\n // TODO Refactor so it takes into account the Input Descriptors and we can lookup from there. Now we only do that if there is 1 descriptor\n if (!formatOptions && presentationDefinition.input_descriptors.length == 1 && 'format' in presentationDefinition.input_descriptors[0]) {\n formatOptions = presentationDefinition.input_descriptors[0].format\n }\n // All format arguments are optional. So if no format has been given we go for the most supported 'jwt'\n if (!formatOptions) {\n if (CredentialMapper.isSdJwtDecodedCredentialPayload(presentation.decodedPayload)) {\n return 'dc+sd-jwt'\n } else if (CredentialMapper.isMsoMdocDecodedPresentation(presentation.decodedPayload as OriginalVerifiablePresentation)) {\n return 'mso_mdoc'\n } else if (CredentialMapper.isW3cPresentation(presentation.decodedPayload)) {\n if (typeof presentation.signedPayload === 'string') {\n return 'jwt'\n }\n return 'lds'\n }\n return 'jwt'\n } else if (typeof formatOptions === 'string') {\n // if formatOptions is a singular string we can return that as the format\n return formatOptions\n }\n\n // here we transform all format options to either lds or jwt. but we also want to support sd-jwt, so we need to specifically check for this one. which is ['dc+sd-jwt']\n const formats = new Set(\n Object.keys(formatOptions).map((form) => (form.includes('ldp') ? 'lds' : form.includes('dc+sd-jwt') ? 'dc+sd-jwt' : 'jwt')),\n )\n\n // if we only have 1 format type we can return that\n if (formats.size === 1) {\n return formats.values().next().value!!\n }\n formats.keys().next()\n // if we can go for sd-jwt, we go for sd-jwt\n if (formats.has('dc+sd-jwt')) {\n return 'dc+sd-jwt'\n }\n // if it is not sd-jwt we would like to go for jwt\n else if (formats.has('jwt')) {\n return 'jwt'\n }\n\n // else we go for lds\n return 'lds'\n }\n\n return async ({\n presentation,\n domain,\n presentationDefinition,\n format,\n challenge,\n }: {\n presentation: Optional<PresentationPayload, 'holder'> | SdJwtDecodedVerifiableCredential\n presentationDefinition: IPresentationDefinition\n format?: Format | ProofFormat\n domain?: string\n challenge?: string\n }): Promise<W3CVerifiablePresentation> => {\n const proofFormat = determineProofFormat({ format, presentationDefinition, presentation })\n const { idOpts } = args\n const CLOCK_SKEW = 120\n if (args.skipDidResolution && isManagedIdentifierDidOpts(idOpts)) {\n idOpts.offlineWhenNoDIDRegistered = true\n }\n\n if ('compactSdJwtVc' in presentation) {\n if (proofFormat !== 'dc+sd-jwt') {\n return Promise.reject(Error(`presentation payload does not match proof format ${proofFormat}`))\n }\n\n const presentationResult = await context.agent.createSdJwtPresentation({\n ...(idOpts?.method === 'oid4vci-issuer' && { holder: idOpts?.issuer as string }),\n presentation: presentation.compactSdJwtVc,\n kb: {\n payload: {\n ...presentation.kbJwt?.payload,\n iat: presentation.kbJwt?.payload?.iat ?? Math.floor(Date.now() / 1000 - CLOCK_SKEW),\n nonce: challenge ?? presentation.kbJwt?.payload?.nonce,\n aud: presentation.kbJwt?.payload?.aud ?? domain ?? args.domain,\n },\n },\n })\n\n return CredentialMapper.storedPresentationToOriginalFormat(presentationResult.presentation as OriginalVerifiablePresentation)\n } else {\n const resolution = await context.agent.identifierManagedGet(idOpts)\n\n if (proofFormat === 'dc+sd-jwt') {\n return Promise.reject(Error(`presentation payload does not match proof format ${proofFormat}`))\n }\n let header\n if (!presentation.holder) {\n presentation.holder = resolution.issuer\n }\n if (proofFormat === 'jwt') {\n header = {\n ...((isManagedIdentifierDidResult(resolution) || isManagedIdentifierX5cResult(resolution)) && resolution.kid && { kid: resolution.kid }),\n ...(isManagedIdentifierX5cResult(resolution) && { jwk: resolution.jwk }),\n }\n if (presentation.verifier || !presentation.aud) {\n presentation.aud = Array.isArray(presentation.verifier) ? presentation.verifier : (presentation.verifier ?? domain ?? args.domain)\n delete presentation.verifier\n }\n\n if (!presentation.nbf) {\n if (presentation.issuanceDate) {\n const converted = Date.parse(presentation.issuanceDate)\n if (!isNaN(converted)) {\n presentation.nbf = Math.floor(converted / 1000) // no skew here, as an explicit value was given\n }\n } else {\n presentation.nbf = Math.floor(Date.now() / 1000 - CLOCK_SKEW)\n }\n }\n\n if (!presentation.iat) {\n presentation.iat = presentation.nbf\n }\n\n if (!presentation.exp) {\n if (presentation.expirationDate) {\n const converted = Date.parse(presentation.expirationDate)\n if (!isNaN(converted)) {\n presentation.exp = Math.floor(converted / 1000) // no skew here as an explicit value w as given\n }\n } else {\n presentation.exp = presentation.nbf + 600 + CLOCK_SKEW\n }\n }\n\n if (!presentation.vp) {\n presentation.vp = {}\n }\n /*if (!presentation.sub) {\n presentation.sub = id.did\n }*/\n if (!presentation.vp.holder) {\n presentation.vp.holder = presentation.holder\n }\n }\n\n // we ignore the alg / proof_format for now, as we already have the kid anyway at this point\n\n // todo: look for jwt_vc_json and remove types and @context\n\n const vp = await context.agent.createVerifiablePresentation({\n presentation: presentation as PresentationPayload,\n removeOriginalFields: false,\n keyRef: resolution.kmsKeyRef,\n // domain: domain ?? args.domain, // handled above, and did-jwt-vc creates an array even for 1 entry\n challenge: challenge ?? args.challenge,\n fetchRemoteContexts: args.fetchRemoteContexts !== false,\n proofFormat: proofFormat as ProofFormat,\n header,\n })\n\n // makes sure we extract an actual JWT from the internal representation in case it is a JWT\n return CredentialMapper.storedPresentationToOriginalFormat(vp as OriginalVerifiablePresentation)\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,gCAAAA,SAAA;AAAA,IAAAA,QAAA;AAAA,MACE,6BAA+B;AAAA,QAC7B,YAAc;AAAA,UACZ,SAAW;AAAA,YACT,qBAAuB;AAAA,cACrB,MAAQ;AAAA,cACR,YAAc;AAAA,gBACZ,WAAa;AAAA,kBACX,MAAQ;AAAA,gBACV;AAAA,gBACA,sBAAwB;AAAA,cAC1B;AAAA,cACA,UAAY,CAAC,WAAW;AAAA,cACxB,aAAe;AAAA,YACjB;AAAA,YACA,0BAA4B;AAAA,cAC1B,MAAQ;AAAA,cACR,YAAc;AAAA,gBACZ,YAAc;AAAA,kBACZ,MAAQ;AAAA,kBACR,YAAc;AAAA,oBACZ,KAAO;AAAA,sBACL,MAAQ;AAAA,oBAC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tB,aAAa0D;QACtB;AAEA,YAAI,CAAC1D,aAAa6D,KAAK;AACrB,cAAI7D,aAAa8D,cAAc;AAC7B,kBAAMC,YAAYjB,KAAKkB,MAAMhE,aAAa8D,YAAY;AACtD,gBAAI,CAACG,MAAMF,SAAAA,GAAY;AACrB/D,2BAAa6D,MAAMjB,KAAKC,MAAMkB,YAAY,GAAA;YAC5C;UACF,OAAO;AACL/D,yBAAa6D,MAAMjB,KAAKC,MAAMC,KAAKC,IAAG,IAAK,MAAOrB,UAAAA;UACpD;QACF;AAEA,YAAI,CAAC1B,aAAa2C,KAAK;AACrB3C,uBAAa2C,MAAM3C,aAAa6D;QAClC;AAEA,YAAI,CAAC7D,aAAakE,KAAK;AACrB,cAAIlE,aAAamE,gBAAgB;AAC/B,kBAAMJ,YAAYjB,KAAKkB,MAAMhE,aAAamE,cAAc;AACxD,gBAAI,CAACF,MAAMF,SAAAA,GAAY;AACrB/D,2BAAakE,MAAMtB,KAAKC,MAAMkB,YAAY,GAAA;YAC5C;UACF,OAAO;AACL/D,yBAAakE,MAAMlE,aAAa6D,MAAM,MAAMnC;UAC9C;QACF;AAEA,YAAI,CAAC1B,aAAaoE,IAAI;AACpBpE,uBAAaoE,KAAK,CAAC;QACrB;AAIA,YAAI,CAACpE,aAAaoE,GAAG/B,QAAQ;AAC3BrC,uBAAaoE,GAAG/B,SAASrC,aAAaqC;QACxC;MACF;AAMA,YAAM+B,KAAK,MAAMzE,QAAQuC,MAAMmC,6BAA6B;QAC1DrE;QACAsE,sBAAsB;QACtBC,QAAQpB,WAAWqB;;QAEnBjD,WAAWA,aAAa7B,KAAK6B;QAC7BkD,qBAAqB/E,KAAK+E,wBAAwB;QAClDjD;QACA6B;MACF,CAAA;AAGA,aAAOjD,mCAAiB8C,mCAAmCkB,EAAAA;IAC7D;EACF;AACF;AAnLsB3E;;;AFftB,IAAMiF,SAASC;","names":["module","PresentationExchange","schema","IDidAuthSiopOpAuthenticator","pex","PEX","methods","pexValidateDefinition","bind","pexDefinitionVersion","pexDefinitionFilterCredentials","pexDefinitionFilterCredentialsPerInputDescriptor","opts","args","definition","invalids","result","validateDefinition","validations","Array","isArray","push","filter","v","status","error","message","tag","length","Error","map","toString","presentationDefinition","definitionVersionDiscovery","context","credentials","pexFilterCredentials","credentialFilterOpts","holderDIDs","toDIDs","agent","dataStoreORMGetIdentifiers","selectResults","selectFrom","limitDisclosureSignatureSuites","id","filteredCredentials","verifiableCredential","vc","CredentialMapper","storedCredentialToOriginalFormat","origDefinition","promises","Map","input_descriptors","forEach","inputDescriptor","credentialRole","set","verifiableCredentials","Promise","all","values","entry","entries","filterOpts","verifiableCredentialForRoleFilter","uniqueCredentials","crsGetUniqueCredentials","uniqueVC","uniformVerifiableCredential","proof","jwtProof","find","p","type","JWT_PROOF_TYPE_2020","jwt","import_ssi_sdk_ext","import_ssi_types","createPEXPresentationSignCallback","args","context","determineProofFormat","determineArgs","format","presentationDefinition","presentation","formatOptions","input_descriptors","length","CredentialMapper","isSdJwtDecodedCredentialPayload","decodedPayload","isMsoMdocDecodedPresentation","isW3cPresentation","signedPayload","formats","Set","Object","keys","map","form","includes","size","values","next","value","has","domain","challenge","proofFormat","idOpts","CLOCK_SKEW","skipDidResolution","isManagedIdentifierDidOpts","offlineWhenNoDIDRegistered","Promise","reject","Error","presentationResult","agent","createSdJwtPresentation","method","holder","issuer","compactSdJwtVc","kb","payload","kbJwt","iat","Math","floor","Date","now","nonce","aud","storedPresentationToOriginalFormat","resolution","identifierManagedGet","header","isManagedIdentifierDidResult","isManagedIdentifierX5cResult","kid","jwk","verifier","Array","isArray","nbf","issuanceDate","converted","parse","isNaN","exp","expirationDate","vp","createVerifiablePresentation","removeOriginalFields","keyRef","kmsKeyRef","fetchRemoteContexts","schema","require"]}
|
package/dist/index.js
CHANGED
|
@@ -465,7 +465,7 @@ async function createPEXPresentationSignCallback(args, context) {
|
|
|
465
465
|
}
|
|
466
466
|
if (!formatOptions) {
|
|
467
467
|
if (CredentialMapper2.isSdJwtDecodedCredentialPayload(presentation.decodedPayload)) {
|
|
468
|
-
return "
|
|
468
|
+
return "dc+sd-jwt";
|
|
469
469
|
} else if (CredentialMapper2.isMsoMdocDecodedPresentation(presentation.decodedPayload)) {
|
|
470
470
|
return "mso_mdoc";
|
|
471
471
|
} else if (CredentialMapper2.isW3cPresentation(presentation.decodedPayload)) {
|
|
@@ -478,13 +478,13 @@ async function createPEXPresentationSignCallback(args, context) {
|
|
|
478
478
|
} else if (typeof formatOptions === "string") {
|
|
479
479
|
return formatOptions;
|
|
480
480
|
}
|
|
481
|
-
const formats = new Set(Object.keys(formatOptions).map((form) => form.includes("ldp") ? "lds" : form.includes("
|
|
481
|
+
const formats = new Set(Object.keys(formatOptions).map((form) => form.includes("ldp") ? "lds" : form.includes("dc+sd-jwt") ? "dc+sd-jwt" : "jwt"));
|
|
482
482
|
if (formats.size === 1) {
|
|
483
483
|
return formats.values().next().value;
|
|
484
484
|
}
|
|
485
485
|
formats.keys().next();
|
|
486
|
-
if (formats.has("
|
|
487
|
-
return "
|
|
486
|
+
if (formats.has("dc+sd-jwt")) {
|
|
487
|
+
return "dc+sd-jwt";
|
|
488
488
|
} else if (formats.has("jwt")) {
|
|
489
489
|
return "jwt";
|
|
490
490
|
}
|
|
@@ -503,7 +503,7 @@ async function createPEXPresentationSignCallback(args, context) {
|
|
|
503
503
|
idOpts.offlineWhenNoDIDRegistered = true;
|
|
504
504
|
}
|
|
505
505
|
if ("compactSdJwtVc" in presentation) {
|
|
506
|
-
if (proofFormat !== "
|
|
506
|
+
if (proofFormat !== "dc+sd-jwt") {
|
|
507
507
|
return Promise.reject(Error(`presentation payload does not match proof format ${proofFormat}`));
|
|
508
508
|
}
|
|
509
509
|
const presentationResult = await context.agent.createSdJwtPresentation({
|
|
@@ -523,7 +523,7 @@ async function createPEXPresentationSignCallback(args, context) {
|
|
|
523
523
|
return CredentialMapper2.storedPresentationToOriginalFormat(presentationResult.presentation);
|
|
524
524
|
} else {
|
|
525
525
|
const resolution = await context.agent.identifierManagedGet(idOpts);
|
|
526
|
-
if (proofFormat === "
|
|
526
|
+
if (proofFormat === "dc+sd-jwt") {
|
|
527
527
|
return Promise.reject(Error(`presentation payload does not match proof format ${proofFormat}`));
|
|
528
528
|
}
|
|
529
529
|
let header;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../plugin.schema.json","../src/agent/PresentationExchange.ts","../src/functions.ts","../src/index.ts"],"sourcesContent":["{\n \"IDidAuthSiopOpAuthenticator\": {\n \"components\": {\n \"schemas\": {\n \"IGetSiopSessionArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"sessionId\": {\n \"type\": \"string\"\n },\n \"additionalProperties\": false\n },\n \"required\": [\"sessionId\"],\n \"description\": \"Arguments needed for {@link DidAuthSiopOpAuthenticator.getSessionForSiop } \"\n },\n \"IRegisterSiopSessionArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"identifier\": {\n \"type\": \"object\",\n \"properties\": {\n \"did\": {\n \"type\": \"string\"\n },\n \"alias\": {\n \"type\": \"string\"\n },\n \"provider\": {\n \"type\": \"string\"\n },\n \"controllerKeyId\": {\n \"type\": \"string\"\n },\n \"keys\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n }\n },\n \"services\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n }\n }\n },\n \"additionalProperties\": false,\n \"required\": [\"did\", \"provider\", \"keys\", \"services\"]\n },\n \"sessionId\": {\n \"type\": \"string\"\n },\n \"expiresIn\": {\n \"type\": \"number\"\n },\n \"additionalProperties\": false\n },\n \"required\": [\"identifier\"],\n \"description\": \"Arguments needed for {@link DidAuthSiopOpAuthenticator.registerSessionForSiop } \"\n },\n \"IRemoveSiopSessionArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"sessionId\": {\n \"type\": \"string\"\n },\n \"additionalProperties\": false\n },\n \"required\": [\"sessionId\"],\n \"description\": \"Arguments needed for {@link DidAuthSiopOpAuthenticator.removeSessionForSiop } \"\n },\n \"IAuthenticateWithSiopArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"sessionId\": {\n \"type\": \"string\"\n },\n \"stateId\": {\n \"type\": \"string\"\n },\n \"redirectUrl\": {\n \"type\": \"string\"\n },\n \"additionalProperties\": false\n },\n \"required\": [\"sessionId\", \"stateId\", \"redirectUrl\"],\n \"description\": \"Arguments needed for {@link DidAuthSiopOpAuthenticator.authenticateWithSiop } \"\n },\n \"IResponse\": {\n \"type\": \"object\",\n \"properties\": {\n \"status\": {\n \"type\": \"number\"\n },\n \"additionalProperties\": true\n },\n \"required\": [\"status\"],\n \"description\": \"Result of {@link DidAuthSiopOpAuthenticator.authenticateWithSiop & DidAuthSiopOpAuthenticator.sendSiopAuthenticationResponse } \"\n },\n \"IGetSiopAuthenticationRequestFromRpArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"sessionId\": {\n \"type\": \"string\"\n },\n \"stateId\": {\n \"type\": \"string\"\n },\n \"redirectUrl\": {\n \"type\": \"string\"\n },\n \"additionalProperties\": false\n },\n \"required\": [\"sessionId\", \"stateId\", \"redirectUrl\"],\n \"description\": \"Arguments needed for {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestFromRP } \"\n },\n \"ParsedAuthenticationRequestURI\": {\n \"type\": \"object\",\n \"properties\": {\n \"jwt\": {\n \"type\": \"string\"\n },\n \"requestPayload\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"registration\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"additionalProperties\": false\n },\n \"required\": [\"jwt\", \"requestPayload\", \"registration\"],\n \"description\": \"Result of {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestFromRP } \"\n },\n \"IGetSiopAuthenticationRequestDetailsArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"sessionId\": {\n \"type\": \"string\"\n },\n \"verifiedAuthenticationRequest\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"credentialFilter\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"additionalProperties\": false\n },\n \"required\": [\"sessionId\", \"verifiedAuthenticationRequest\"],\n \"description\": \"Arguments needed for {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestDetails } \"\n },\n \"IAuthRequestDetails\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"alsoKnownAs\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"vpResponseOpts\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"additionalProperties\": false\n },\n \"required\": [\"id\", \"vpResponseOpts\"],\n \"description\": \"Result of {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestDetails } \"\n },\n \"IVerifySiopAuthenticationRequestUriArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"sessionId\": {\n \"type\": \"string\"\n },\n \"ParsedAuthenticationRequestURI\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"additionalProperties\": false\n },\n \"required\": [\"sessionId\", \"ParsedAuthenticationRequestURI\"],\n \"description\": \"Arguments needed for {@link DidAuthSiopOpAuthenticator.verifySiopAuthenticationRequestURI } \"\n },\n \"VerifiedAuthorizationRequest\": {\n \"type\": \"object\",\n \"properties\": {\n \"payload\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"presentationDefinitions\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"verifyOpts\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"additionalProperties\": false\n },\n \"required\": [\"payload\", \"verifyOpts\"],\n \"description\": \"Result of {@link DidAuthSiopOpAuthenticator.verifySiopAuthenticationRequestURI } \"\n },\n \"ISendSiopAuthenticationResponseArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"sessionId\": {\n \"type\": \"string\"\n },\n \"verifiedAuthenticationRequest\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"verifiablePresentationResponse\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"additionalProperties\": false\n },\n \"required\": [\"sessionId\", \"verifiedAuthenticationRequest\"],\n \"description\": \"Arguments needed for {@link DidAuthSiopOpAuthenticator.sendSiopAuthenticationResponse } \"\n }\n },\n \"methods\": {\n \"getSessionForSiop\": {\n \"description\": \"Get SIOP session\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IGetSiopSessionArgs\"\n },\n \"returnType\": \"object\"\n },\n \"registerSessionForSiop\": {\n \"description\": \"Register SIOP session\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IRegisterSiopSessionArgs\"\n },\n \"returnType\": \"object\"\n },\n \"removeSessionForSiop\": {\n \"description\": \"Remove SIOP session\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IRemoveSiopSessionArgs\"\n },\n \"returnType\": \"boolean\"\n },\n \"authenticateWithSiop\": {\n \"description\": \"Authenticate using DID Auth SIOP\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IAuthenticateWithSiopArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/Response\"\n }\n },\n \"getSiopAuthenticationRequestFromRP\": {\n \"description\": \"Get authentication request from RP\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IGetSiopAuthenticationRequestFromRpArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/ParsedAuthenticationRequestURI\"\n }\n },\n \"getSiopAuthenticationRequestDetails\": {\n \"description\": \"Get authentication request details\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IGetSiopAuthenticationRequestDetailsArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/IAuthRequestDetails\"\n }\n },\n \"verifySiopAuthenticationRequestURI\": {\n \"description\": \"Verify authentication request URI\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IVerifySiopAuthenticationRequestUriArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/VerifiedAuthorizationRequest\"\n }\n },\n \"sendSiopAuthenticationResponse\": {\n \"description\": \"Send authentication response\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/ISendSiopAuthenticationResponseArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/IRequiredContext\"\n }\n }\n }\n }\n }\n}\n","import {\n IDefinitionCredentialFilterArgs,\n IDefinitionValidateArgs,\n IPEXFilterResult,\n IPEXFilterResultWithInputDescriptor,\n IRequiredContext,\n PEXOpts,\n schema,\n VersionDiscoveryResult,\n} from '../index'\nimport { IAgentPlugin } from '@veramo/core'\n\nimport { IPresentationExchange } from '../types/IPresentationExchange'\nimport { Checked, IPresentationDefinition, PEX } from '@sphereon/pex'\nimport { CompactJWT, CredentialMapper, IProof, JWT_PROOF_TYPE_2020, W3CVerifiableCredential } from '@sphereon/ssi-types'\nimport { InputDescriptorV1, InputDescriptorV2 } from '@sphereon/pex-models'\nimport { toDIDs } from '@sphereon/ssi-sdk-ext.did-utils'\nimport { CredentialRole, UniqueDigitalCredential, verifiableCredentialForRoleFilter } from '@sphereon/ssi-sdk.credential-store'\nimport { FindDigitalCredentialArgs } from '@sphereon/ssi-sdk.data-store'\n\nexport class PresentationExchange implements IAgentPlugin {\n readonly schema = schema.IDidAuthSiopOpAuthenticator\n private readonly pex = new PEX()\n\n readonly methods: IPresentationExchange = {\n pexValidateDefinition: this.pexValidateDefinition.bind(this),\n pexDefinitionVersion: this.pexDefinitionVersion.bind(this),\n pexDefinitionFilterCredentials: this.pexDefinitionFilterCredentials.bind(this),\n pexDefinitionFilterCredentialsPerInputDescriptor: this.pexDefinitionFilterCredentialsPerInputDescriptor.bind(this),\n }\n\n constructor(opts?: PEXOpts) {}\n\n private async pexValidateDefinition(args: IDefinitionValidateArgs): Promise<boolean> {\n const { definition } = args\n const invalids: Checked[] = []\n\n try {\n const result = PEX.validateDefinition(definition)\n const validations = Array.isArray(result) ? result : [result]\n invalids.push(...validations.filter((v) => v.status === 'error'))\n } catch (error) {\n invalids.push({\n status: 'error',\n message:\n typeof error === 'string'\n ? error\n : typeof error === 'object' && 'message' in (error as object)\n ? (error as Error).message\n : 'unknown error',\n tag: 'validation',\n })\n }\n\n if (invalids.length > 0) {\n throw Error(`Invalid definition. ${invalids.map((v) => v.message).toString()}`)\n }\n return true // Never returns false, but REST API does not allow Promise<void>\n }\n\n async pexDefinitionVersion(presentationDefinition: IPresentationDefinition): Promise<VersionDiscoveryResult> {\n return PEX.definitionVersionDiscovery(presentationDefinition)\n }\n\n async pexDefinitionFilterCredentials(args: IDefinitionCredentialFilterArgs, context: IRequiredContext): Promise<IPEXFilterResult> {\n const credentials = await this.pexFilterCredentials(args.credentialFilterOpts, context)\n const holderDIDs = args.holderDIDs ? toDIDs(args.holderDIDs) : toDIDs(await context.agent.dataStoreORMGetIdentifiers())\n const selectResults = this.pex.selectFrom(args.presentationDefinition, credentials ?? [], {\n ...args,\n holderDIDs,\n limitDisclosureSignatureSuites: args.limitDisclosureSignatureSuites ?? ['BbsBlsSignature2020'],\n })\n return {\n id: args.presentationDefinition.id,\n selectResults,\n filteredCredentials: selectResults.verifiableCredential?.map((vc) => CredentialMapper.storedCredentialToOriginalFormat(vc)) ?? [],\n }\n }\n\n async pexDefinitionFilterCredentialsPerInputDescriptor(\n args: IDefinitionCredentialFilterArgs,\n context: IRequiredContext,\n ): Promise<IPEXFilterResultWithInputDescriptor[]> {\n const origDefinition = args.presentationDefinition\n const credentials = await this.pexFilterCredentials(args.credentialFilterOpts ?? {}, context)\n const holderDIDs = args.holderDIDs ? toDIDs(args.holderDIDs) : toDIDs(await context.agent.dataStoreORMGetIdentifiers())\n const limitDisclosureSignatureSuites = args.limitDisclosureSignatureSuites\n\n const promises = new Map<InputDescriptorV1 | InputDescriptorV2, Promise<IPEXFilterResult>>()\n origDefinition.input_descriptors.forEach((inputDescriptor) => {\n const presentationDefinition = {\n id: inputDescriptor.id,\n input_descriptors: [inputDescriptor],\n }\n\n const credentialRole = args.credentialFilterOpts.credentialRole\n\n promises.set(\n inputDescriptor,\n this.pexDefinitionFilterCredentials(\n {\n credentialFilterOpts: { credentialRole, verifiableCredentials: credentials },\n // @ts-ignore\n presentationDefinition,\n holderDIDs,\n limitDisclosureSignatureSuites,\n },\n context,\n ),\n )\n })\n await Promise.all(promises.values())\n const result: IPEXFilterResultWithInputDescriptor[] = []\n for (const entry of promises.entries()) {\n result.push({ ...(await entry[1]), inputDescriptor: entry[0] })\n }\n return result\n }\n\n private async pexFilterCredentials(\n filterOpts: {\n credentialRole: CredentialRole\n verifiableCredentials?: W3CVerifiableCredential[]\n filter?: FindDigitalCredentialArgs\n },\n context: IRequiredContext,\n ): Promise<W3CVerifiableCredential[]> {\n if (filterOpts.verifiableCredentials && filterOpts.verifiableCredentials.length > 0) {\n return filterOpts.verifiableCredentials as W3CVerifiableCredential[]\n }\n\n const filter = verifiableCredentialForRoleFilter(filterOpts.credentialRole, filterOpts.filter)\n const uniqueCredentials = await context.agent.crsGetUniqueCredentials({ filter })\n\n return uniqueCredentials.map((uniqueVC: UniqueDigitalCredential) => {\n const vc = uniqueVC.uniformVerifiableCredential!\n const proof = Array.isArray(vc.proof) ? vc.proof : [vc.proof]\n const jwtProof = proof.find((p: IProof) => p?.type === JWT_PROOF_TYPE_2020)\n return jwtProof ? (jwtProof.jwt as CompactJWT) : vc\n })\n }\n}\n","import { IPresentationDefinition } from '@sphereon/pex'\nimport { Format } from '@sphereon/pex-models'\nimport {\n isManagedIdentifierDidOpts,\n isManagedIdentifierDidResult,\n isManagedIdentifierX5cResult,\n ManagedIdentifierOptsOrResult,\n} from '@sphereon/ssi-sdk-ext.identifier-resolution'\nimport {\n CredentialMapper,\n Optional,\n OriginalVerifiablePresentation,\n SdJwtDecodedVerifiableCredential,\n W3CVerifiablePresentation,\n} from '@sphereon/ssi-types'\nimport { PresentationPayload, ProofFormat } from '@veramo/core'\nimport { IPEXPresentationSignCallback, IRequiredContext } from './types/IPresentationExchange'\n\nexport async function createPEXPresentationSignCallback(\n args: {\n idOpts: ManagedIdentifierOptsOrResult\n fetchRemoteContexts?: boolean\n skipDidResolution?: boolean\n format?: Format | ProofFormat\n domain?: string\n challenge?: string\n },\n context: IRequiredContext,\n): Promise<IPEXPresentationSignCallback> {\n function determineProofFormat(determineArgs: {\n format?: Format | 'jwt' | 'lds' | 'EthereumEip712Signature2021'\n presentationDefinition: IPresentationDefinition\n presentation: Optional<PresentationPayload, 'holder'> | SdJwtDecodedVerifiableCredential\n }): string {\n const { format, presentationDefinition, presentation } = determineArgs\n\n var formatOptions = format ?? presentationDefinition.format ?? args.format\n // TODO Refactor so it takes into account the Input Descriptors and we can lookup from there. Now we only do that if there is 1 descriptor\n if (!formatOptions && presentationDefinition.input_descriptors.length == 1 && 'format' in presentationDefinition.input_descriptors[0]) {\n formatOptions = presentationDefinition.input_descriptors[0].format\n }\n // All format arguments are optional. So if no format has been given we go for the most supported 'jwt'\n if (!formatOptions) {\n if (CredentialMapper.isSdJwtDecodedCredentialPayload(presentation.decodedPayload)) {\n return 'vc+sd-jwt'\n } else if (CredentialMapper.isMsoMdocDecodedPresentation(presentation.decodedPayload as OriginalVerifiablePresentation)) {\n return 'mso_mdoc'\n } else if (CredentialMapper.isW3cPresentation(presentation.decodedPayload)) {\n if (typeof presentation.signedPayload === 'string') {\n return 'jwt'\n }\n return 'lds'\n }\n return 'jwt'\n } else if (typeof formatOptions === 'string') {\n // if formatOptions is a singular string we can return that as the format\n return formatOptions\n }\n\n // here we transform all format options to either lds or jwt. but we also want to support sd-jwt, so we need to specifically check for this one. which is ['vc+sd-jwt']\n const formats = new Set(\n Object.keys(formatOptions).map((form) => (form.includes('ldp') ? 'lds' : form.includes('vc+sd-jwt') ? 'vc+sd-jwt' : 'jwt')),\n )\n\n // if we only have 1 format type we can return that\n if (formats.size === 1) {\n return formats.values().next().value!!\n }\n formats.keys().next()\n // if we can go for sd-jwt, we go for sd-jwt\n if (formats.has('vc+sd-jwt')) {\n return 'vc+sd-jwt'\n }\n // if it is not sd-jwt we would like to go for jwt\n else if (formats.has('jwt')) {\n return 'jwt'\n }\n\n // else we go for lds\n return 'lds'\n }\n\n return async ({\n presentation,\n domain,\n presentationDefinition,\n format,\n challenge,\n }: {\n presentation: Optional<PresentationPayload, 'holder'> | SdJwtDecodedVerifiableCredential\n presentationDefinition: IPresentationDefinition\n format?: Format | ProofFormat\n domain?: string\n challenge?: string\n }): Promise<W3CVerifiablePresentation> => {\n const proofFormat = determineProofFormat({ format, presentationDefinition, presentation })\n const { idOpts } = args\n const CLOCK_SKEW = 120\n if (args.skipDidResolution && isManagedIdentifierDidOpts(idOpts)) {\n idOpts.offlineWhenNoDIDRegistered = true\n }\n\n if ('compactSdJwtVc' in presentation) {\n if (proofFormat !== 'vc+sd-jwt') {\n return Promise.reject(Error(`presentation payload does not match proof format ${proofFormat}`))\n }\n\n const presentationResult = await context.agent.createSdJwtPresentation({\n ...(idOpts?.method === 'oid4vci-issuer' && { holder: idOpts?.issuer as string }),\n presentation: presentation.compactSdJwtVc,\n kb: {\n payload: {\n ...presentation.kbJwt?.payload,\n iat: presentation.kbJwt?.payload?.iat ?? Math.floor(Date.now() / 1000 - CLOCK_SKEW),\n nonce: challenge ?? presentation.kbJwt?.payload?.nonce,\n aud: presentation.kbJwt?.payload?.aud ?? domain ?? args.domain,\n },\n },\n })\n\n return CredentialMapper.storedPresentationToOriginalFormat(presentationResult.presentation as OriginalVerifiablePresentation)\n } else {\n const resolution = await context.agent.identifierManagedGet(idOpts)\n\n if (proofFormat === 'vc+sd-jwt') {\n return Promise.reject(Error(`presentation payload does not match proof format ${proofFormat}`))\n }\n let header\n if (!presentation.holder) {\n presentation.holder = resolution.issuer\n }\n if (proofFormat === 'jwt') {\n header = {\n ...((isManagedIdentifierDidResult(resolution) || isManagedIdentifierX5cResult(resolution)) && resolution.kid && { kid: resolution.kid }),\n ...(isManagedIdentifierX5cResult(resolution) && { jwk: resolution.jwk }),\n }\n if (presentation.verifier || !presentation.aud) {\n presentation.aud = Array.isArray(presentation.verifier) ? presentation.verifier : (presentation.verifier ?? domain ?? args.domain)\n delete presentation.verifier\n }\n\n if (!presentation.nbf) {\n if (presentation.issuanceDate) {\n const converted = Date.parse(presentation.issuanceDate)\n if (!isNaN(converted)) {\n presentation.nbf = Math.floor(converted / 1000) // no skew here, as an explicit value was given\n }\n } else {\n presentation.nbf = Math.floor(Date.now() / 1000 - CLOCK_SKEW)\n }\n }\n\n if (!presentation.iat) {\n presentation.iat = presentation.nbf\n }\n\n if (!presentation.exp) {\n if (presentation.expirationDate) {\n const converted = Date.parse(presentation.expirationDate)\n if (!isNaN(converted)) {\n presentation.exp = Math.floor(converted / 1000) // no skew here as an explicit value w as given\n }\n } else {\n presentation.exp = presentation.nbf + 600 + CLOCK_SKEW\n }\n }\n\n if (!presentation.vp) {\n presentation.vp = {}\n }\n /*if (!presentation.sub) {\n presentation.sub = id.did\n }*/\n if (!presentation.vp.holder) {\n presentation.vp.holder = presentation.holder\n }\n }\n\n // we ignore the alg / proof_format for now, as we already have the kid anyway at this point\n\n // todo: look for jwt_vc_json and remove types and @context\n\n const vp = await context.agent.createVerifiablePresentation({\n presentation: presentation as PresentationPayload,\n removeOriginalFields: false,\n keyRef: resolution.kmsKeyRef,\n // domain: domain ?? args.domain, // handled above, and did-jwt-vc creates an array even for 1 entry\n challenge: challenge ?? args.challenge,\n fetchRemoteContexts: args.fetchRemoteContexts !== false,\n proofFormat: proofFormat as ProofFormat,\n header,\n })\n\n // makes sure we extract an actual JWT from the internal representation in case it is a JWT\n return CredentialMapper.storedPresentationToOriginalFormat(vp as OriginalVerifiablePresentation)\n }\n }\n}\n","/**\n * @public\n */\nconst schema = require('../plugin.schema.json')\nexport { schema }\nexport { PresentationExchange } from './agent/PresentationExchange'\nexport * from './types/IPresentationExchange'\nexport * from './functions'\n"],"mappings":";;;;;;;;AAAA;AAAA;AAAA;AAAA,MACE,6BAA+B;AAAA,QAC7B,YAAc;AAAA,UACZ,SAAW;AAAA,YACT,qBAAuB;AAAA,cACrB,MAAQ;AAAA,cACR,YAAc;AAAA,gBACZ,WAAa;AAAA,kBACX,MAAQ;AAAA,gBACV;AAAA,gBACA,sBAAwB;AAAA,cAC1B;AAAA,cACA,UAAY,CAAC,WAAW;AAAA,cACxB,aAAe;AAAA,YACjB;AAAA,YACA,0BAA4B;AAAA,cAC1B,MAAQ;AAAA,cACR,YAAc;AAAA,gBACZ,YAAc;AAAA,kBACZ,MAAQ;AAAA,kBACR,YAAc;AAAA,oBACZ,KAAO;AAAA,sBACL,MAAQ;AAAA,oBACV;AAAA,oBACA,OAAS;AAAA,sBACP,MAAQ;AAAA,oBACV;AAAA,oBACA,UAAY;AAAA,sBACV,MAAQ;AAAA,oBACV;AAAA,oBACA,iBAAmB;AAAA,sBACjB,MAAQ;AAAA,oBACV;AAAA,oBACA,MAAQ;AAAA,sBACN,MAAQ;AAAA,sBACR,OAAS;AAAA,wBACP,MAAQ;AAAA,wBACR,YAAc;AAAA,0BACZ,sBAAwB;AAAA,wBAC1B;AAAA,sBACF;AAAA,oBACF;AAAA,oBACA,UAAY;AAAA,sBACV,MAAQ;AAAA,sBACR,OAAS;AAAA,wBACP,MAAQ;AAAA,wBACR,YAAc;AAAA,0BACZ,sBAAwB;AAAA,wBAC1B;AAAA,sBACF;AAAA,oBACF;AAAA,kBACF;AAAA,kBACA,sBAAwB;AAAA,kBACxB,UAAY,CAAC,OAAO,YAAY,QAAQ,UAAU;AAAA,gBACpD;AAAA,gBACA,WAAa;AAAA,kBACX,MAAQ;AAAA,gBACV;AAAA,gBACA,WAAa;AAAA,kBACX,MAAQ;AAAA,gBACV;AAAA,gBACA,sBAAwB;AAAA,cAC1B;AAAA,cACA,U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a6D,MAAM,MAAMnC;UAC9C;QACF;AAEA,YAAI,CAAC1B,aAAaoE,IAAI;AACpBpE,uBAAaoE,KAAK,CAAC;QACrB;AAIA,YAAI,CAACpE,aAAaoE,GAAG/B,QAAQ;AAC3BrC,uBAAaoE,GAAG/B,SAASrC,aAAaqC;QACxC;MACF;AAMA,YAAM+B,KAAK,MAAMzE,QAAQuC,MAAMmC,6BAA6B;QAC1DrE;QACAsE,sBAAsB;QACtBC,QAAQpB,WAAWqB;;QAEnBjD,WAAWA,aAAa7B,KAAK6B;QAC7BkD,qBAAqB/E,KAAK+E,wBAAwB;QAClDjD;QACA6B;MACF,CAAA;AAGA,aAAOjD,kBAAiB8C,mCAAmCkB,EAAAA;IAC7D;EACF;AACF;AAnLsB3E;;;ACftB,IAAMiF,SAASC;","names":["PEX","CredentialMapper","JWT_PROOF_TYPE_2020","toDIDs","verifiableCredentialForRoleFilter","PresentationExchange","schema","IDidAuthSiopOpAuthenticator","pex","PEX","methods","pexValidateDefinition","bind","pexDefinitionVersion","pexDefinitionFilterCredentials","pexDefinitionFilterCredentialsPerInputDescriptor","opts","args","definition","invalids","result","validateDefinition","validations","Array","isArray","push","filter","v","status","error","message","tag","length","Error","map","toString","presentationDefinition","definitionVersionDiscovery","context","credentials","pexFilterCredentials","credentialFilterOpts","holderDIDs","toDIDs","agent","dataStoreORMGetIdentifiers","selectResults","selectFrom","limitDisclosureSignatureSuites","id","filteredCredentials","verifiableCredential","vc","CredentialMapper","storedCredentialToOriginalFormat","origDefinition","promises","Map","input_descriptors","forEach","inputDescriptor","credentialRole","set","verifiableCredentials","Promise","all","values","entry","entries","filterOpts","verifiableCredentialForRoleFilter","uniqueCredentials","crsGetUniqueCredentials","uniqueVC","uniformVerifiableCredential","proof","jwtProof","find","p","type","JWT_PROOF_TYPE_2020","jwt","isManagedIdentifierDidOpts","isManagedIdentifierDidResult","isManagedIdentifierX5cResult","CredentialMapper","createPEXPresentationSignCallback","args","context","determineProofFormat","determineArgs","format","presentationDefinition","presentation","formatOptions","input_descriptors","length","CredentialMapper","isSdJwtDecodedCredentialPayload","decodedPayload","isMsoMdocDecodedPresentation","isW3cPresentation","signedPayload","formats","Set","Object","keys","map","form","includes","size","values","next","value","has","domain","challenge","proofFormat","idOpts","CLOCK_SKEW","skipDidResolution","isManagedIdentifierDidOpts","offlineWhenNoDIDRegistered","Promise","reject","Error","presentationResult","agent","createSdJwtPresentation","method","holder","issuer","compactSdJwtVc","kb","payload","kbJwt","iat","Math","floor","Date","now","nonce","aud","storedPresentationToOriginalFormat","resolution","identifierManagedGet","header","isManagedIdentifierDidResult","isManagedIdentifierX5cResult","kid","jwk","verifier","Array","isArray","nbf","issuanceDate","converted","parse","isNaN","exp","expirationDate","vp","createVerifiablePresentation","removeOriginalFields","keyRef","kmsKeyRef","fetchRemoteContexts","schema","require"]}
|
|
1
|
+
{"version":3,"sources":["../plugin.schema.json","../src/agent/PresentationExchange.ts","../src/functions.ts","../src/index.ts"],"sourcesContent":["{\n \"IDidAuthSiopOpAuthenticator\": {\n \"components\": {\n \"schemas\": {\n \"IGetSiopSessionArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"sessionId\": {\n \"type\": \"string\"\n },\n \"additionalProperties\": false\n },\n \"required\": [\"sessionId\"],\n \"description\": \"Arguments needed for {@link DidAuthSiopOpAuthenticator.getSessionForSiop } \"\n },\n \"IRegisterSiopSessionArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"identifier\": {\n \"type\": \"object\",\n \"properties\": {\n \"did\": {\n \"type\": \"string\"\n },\n \"alias\": {\n \"type\": \"string\"\n },\n \"provider\": {\n \"type\": \"string\"\n },\n \"controllerKeyId\": {\n \"type\": \"string\"\n },\n \"keys\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n }\n },\n \"services\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n }\n }\n },\n \"additionalProperties\": false,\n \"required\": [\"did\", \"provider\", \"keys\", \"services\"]\n },\n \"sessionId\": {\n \"type\": \"string\"\n },\n \"expiresIn\": {\n \"type\": \"number\"\n },\n \"additionalProperties\": false\n },\n \"required\": [\"identifier\"],\n \"description\": \"Arguments needed for {@link DidAuthSiopOpAuthenticator.registerSessionForSiop } \"\n },\n \"IRemoveSiopSessionArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"sessionId\": {\n \"type\": \"string\"\n },\n \"additionalProperties\": false\n },\n \"required\": [\"sessionId\"],\n \"description\": \"Arguments needed for {@link DidAuthSiopOpAuthenticator.removeSessionForSiop } \"\n },\n \"IAuthenticateWithSiopArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"sessionId\": {\n \"type\": \"string\"\n },\n \"stateId\": {\n \"type\": \"string\"\n },\n \"redirectUrl\": {\n \"type\": \"string\"\n },\n \"additionalProperties\": false\n },\n \"required\": [\"sessionId\", \"stateId\", \"redirectUrl\"],\n \"description\": \"Arguments needed for {@link DidAuthSiopOpAuthenticator.authenticateWithSiop } \"\n },\n \"IResponse\": {\n \"type\": \"object\",\n \"properties\": {\n \"status\": {\n \"type\": \"number\"\n },\n \"additionalProperties\": true\n },\n \"required\": [\"status\"],\n \"description\": \"Result of {@link DidAuthSiopOpAuthenticator.authenticateWithSiop & DidAuthSiopOpAuthenticator.sendSiopAuthenticationResponse } \"\n },\n \"IGetSiopAuthenticationRequestFromRpArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"sessionId\": {\n \"type\": \"string\"\n },\n \"stateId\": {\n \"type\": \"string\"\n },\n \"redirectUrl\": {\n \"type\": \"string\"\n },\n \"additionalProperties\": false\n },\n \"required\": [\"sessionId\", \"stateId\", \"redirectUrl\"],\n \"description\": \"Arguments needed for {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestFromRP } \"\n },\n \"ParsedAuthenticationRequestURI\": {\n \"type\": \"object\",\n \"properties\": {\n \"jwt\": {\n \"type\": \"string\"\n },\n \"requestPayload\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"registration\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"additionalProperties\": false\n },\n \"required\": [\"jwt\", \"requestPayload\", \"registration\"],\n \"description\": \"Result of {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestFromRP } \"\n },\n \"IGetSiopAuthenticationRequestDetailsArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"sessionId\": {\n \"type\": \"string\"\n },\n \"verifiedAuthenticationRequest\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"credentialFilter\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"additionalProperties\": false\n },\n \"required\": [\"sessionId\", \"verifiedAuthenticationRequest\"],\n \"description\": \"Arguments needed for {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestDetails } \"\n },\n \"IAuthRequestDetails\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"alsoKnownAs\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"vpResponseOpts\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"additionalProperties\": false\n },\n \"required\": [\"id\", \"vpResponseOpts\"],\n \"description\": \"Result of {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestDetails } \"\n },\n \"IVerifySiopAuthenticationRequestUriArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"sessionId\": {\n \"type\": \"string\"\n },\n \"ParsedAuthenticationRequestURI\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"additionalProperties\": false\n },\n \"required\": [\"sessionId\", \"ParsedAuthenticationRequestURI\"],\n \"description\": \"Arguments needed for {@link DidAuthSiopOpAuthenticator.verifySiopAuthenticationRequestURI } \"\n },\n \"VerifiedAuthorizationRequest\": {\n \"type\": \"object\",\n \"properties\": {\n \"payload\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"presentationDefinitions\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"verifyOpts\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"additionalProperties\": false\n },\n \"required\": [\"payload\", \"verifyOpts\"],\n \"description\": \"Result of {@link DidAuthSiopOpAuthenticator.verifySiopAuthenticationRequestURI } \"\n },\n \"ISendSiopAuthenticationResponseArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"sessionId\": {\n \"type\": \"string\"\n },\n \"verifiedAuthenticationRequest\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"verifiablePresentationResponse\": {\n \"type\": \"object\",\n \"properties\": {\n \"additionalProperties\": true\n }\n },\n \"additionalProperties\": false\n },\n \"required\": [\"sessionId\", \"verifiedAuthenticationRequest\"],\n \"description\": \"Arguments needed for {@link DidAuthSiopOpAuthenticator.sendSiopAuthenticationResponse } \"\n }\n },\n \"methods\": {\n \"getSessionForSiop\": {\n \"description\": \"Get SIOP session\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IGetSiopSessionArgs\"\n },\n \"returnType\": \"object\"\n },\n \"registerSessionForSiop\": {\n \"description\": \"Register SIOP session\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IRegisterSiopSessionArgs\"\n },\n \"returnType\": \"object\"\n },\n \"removeSessionForSiop\": {\n \"description\": \"Remove SIOP session\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IRemoveSiopSessionArgs\"\n },\n \"returnType\": \"boolean\"\n },\n \"authenticateWithSiop\": {\n \"description\": \"Authenticate using DID Auth SIOP\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IAuthenticateWithSiopArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/Response\"\n }\n },\n \"getSiopAuthenticationRequestFromRP\": {\n \"description\": \"Get authentication request from RP\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IGetSiopAuthenticationRequestFromRpArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/ParsedAuthenticationRequestURI\"\n }\n },\n \"getSiopAuthenticationRequestDetails\": {\n \"description\": \"Get authentication request details\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IGetSiopAuthenticationRequestDetailsArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/IAuthRequestDetails\"\n }\n },\n \"verifySiopAuthenticationRequestURI\": {\n \"description\": \"Verify authentication request URI\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IVerifySiopAuthenticationRequestUriArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/VerifiedAuthorizationRequest\"\n }\n },\n \"sendSiopAuthenticationResponse\": {\n \"description\": \"Send authentication response\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/ISendSiopAuthenticationResponseArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/IRequiredContext\"\n }\n }\n }\n }\n }\n}\n","import {\n IDefinitionCredentialFilterArgs,\n IDefinitionValidateArgs,\n IPEXFilterResult,\n IPEXFilterResultWithInputDescriptor,\n IRequiredContext,\n PEXOpts,\n schema,\n VersionDiscoveryResult,\n} from '../index'\nimport { IAgentPlugin } from '@veramo/core'\n\nimport { IPresentationExchange } from '../types/IPresentationExchange'\nimport { Checked, IPresentationDefinition, PEX } from '@sphereon/pex'\nimport { CompactJWT, CredentialMapper, IProof, JWT_PROOF_TYPE_2020, W3CVerifiableCredential } from '@sphereon/ssi-types'\nimport { InputDescriptorV1, InputDescriptorV2 } from '@sphereon/pex-models'\nimport { toDIDs } from '@sphereon/ssi-sdk-ext.did-utils'\nimport { CredentialRole, UniqueDigitalCredential, verifiableCredentialForRoleFilter } from '@sphereon/ssi-sdk.credential-store'\nimport { FindDigitalCredentialArgs } from '@sphereon/ssi-sdk.data-store'\n\nexport class PresentationExchange implements IAgentPlugin {\n readonly schema = schema.IDidAuthSiopOpAuthenticator\n private readonly pex = new PEX()\n\n readonly methods: IPresentationExchange = {\n pexValidateDefinition: this.pexValidateDefinition.bind(this),\n pexDefinitionVersion: this.pexDefinitionVersion.bind(this),\n pexDefinitionFilterCredentials: this.pexDefinitionFilterCredentials.bind(this),\n pexDefinitionFilterCredentialsPerInputDescriptor: this.pexDefinitionFilterCredentialsPerInputDescriptor.bind(this),\n }\n\n constructor(opts?: PEXOpts) {}\n\n private async pexValidateDefinition(args: IDefinitionValidateArgs): Promise<boolean> {\n const { definition } = args\n const invalids: Checked[] = []\n\n try {\n const result = PEX.validateDefinition(definition)\n const validations = Array.isArray(result) ? result : [result]\n invalids.push(...validations.filter((v) => v.status === 'error'))\n } catch (error) {\n invalids.push({\n status: 'error',\n message:\n typeof error === 'string'\n ? error\n : typeof error === 'object' && 'message' in (error as object)\n ? (error as Error).message\n : 'unknown error',\n tag: 'validation',\n })\n }\n\n if (invalids.length > 0) {\n throw Error(`Invalid definition. ${invalids.map((v) => v.message).toString()}`)\n }\n return true // Never returns false, but REST API does not allow Promise<void>\n }\n\n async pexDefinitionVersion(presentationDefinition: IPresentationDefinition): Promise<VersionDiscoveryResult> {\n return PEX.definitionVersionDiscovery(presentationDefinition)\n }\n\n async pexDefinitionFilterCredentials(args: IDefinitionCredentialFilterArgs, context: IRequiredContext): Promise<IPEXFilterResult> {\n const credentials = await this.pexFilterCredentials(args.credentialFilterOpts, context)\n const holderDIDs = args.holderDIDs ? toDIDs(args.holderDIDs) : toDIDs(await context.agent.dataStoreORMGetIdentifiers())\n const selectResults = this.pex.selectFrom(args.presentationDefinition, credentials ?? [], {\n ...args,\n holderDIDs,\n limitDisclosureSignatureSuites: args.limitDisclosureSignatureSuites ?? ['BbsBlsSignature2020'],\n })\n return {\n id: args.presentationDefinition.id,\n selectResults,\n filteredCredentials: selectResults.verifiableCredential?.map((vc) => CredentialMapper.storedCredentialToOriginalFormat(vc)) ?? [],\n }\n }\n\n async pexDefinitionFilterCredentialsPerInputDescriptor(\n args: IDefinitionCredentialFilterArgs,\n context: IRequiredContext,\n ): Promise<IPEXFilterResultWithInputDescriptor[]> {\n const origDefinition = args.presentationDefinition\n const credentials = await this.pexFilterCredentials(args.credentialFilterOpts ?? {}, context)\n const holderDIDs = args.holderDIDs ? toDIDs(args.holderDIDs) : toDIDs(await context.agent.dataStoreORMGetIdentifiers())\n const limitDisclosureSignatureSuites = args.limitDisclosureSignatureSuites\n\n const promises = new Map<InputDescriptorV1 | InputDescriptorV2, Promise<IPEXFilterResult>>()\n origDefinition.input_descriptors.forEach((inputDescriptor) => {\n const presentationDefinition = {\n id: inputDescriptor.id,\n input_descriptors: [inputDescriptor],\n }\n\n const credentialRole = args.credentialFilterOpts.credentialRole\n\n promises.set(\n inputDescriptor,\n this.pexDefinitionFilterCredentials(\n {\n credentialFilterOpts: { credentialRole, verifiableCredentials: credentials },\n // @ts-ignore\n presentationDefinition,\n holderDIDs,\n limitDisclosureSignatureSuites,\n },\n context,\n ),\n )\n })\n await Promise.all(promises.values())\n const result: IPEXFilterResultWithInputDescriptor[] = []\n for (const entry of promises.entries()) {\n result.push({ ...(await entry[1]), inputDescriptor: entry[0] })\n }\n return result\n }\n\n private async pexFilterCredentials(\n filterOpts: {\n credentialRole: CredentialRole\n verifiableCredentials?: W3CVerifiableCredential[]\n filter?: FindDigitalCredentialArgs\n },\n context: IRequiredContext,\n ): Promise<W3CVerifiableCredential[]> {\n if (filterOpts.verifiableCredentials && filterOpts.verifiableCredentials.length > 0) {\n return filterOpts.verifiableCredentials as W3CVerifiableCredential[]\n }\n\n const filter = verifiableCredentialForRoleFilter(filterOpts.credentialRole, filterOpts.filter)\n const uniqueCredentials = await context.agent.crsGetUniqueCredentials({ filter })\n\n return uniqueCredentials.map((uniqueVC: UniqueDigitalCredential) => {\n const vc = uniqueVC.uniformVerifiableCredential!\n const proof = Array.isArray(vc.proof) ? vc.proof : [vc.proof]\n const jwtProof = proof.find((p: IProof) => p?.type === JWT_PROOF_TYPE_2020)\n return jwtProof ? (jwtProof.jwt as CompactJWT) : vc\n })\n }\n}\n","import { IPresentationDefinition } from '@sphereon/pex'\nimport { Format } from '@sphereon/pex-models'\nimport {\n isManagedIdentifierDidOpts,\n isManagedIdentifierDidResult,\n isManagedIdentifierX5cResult,\n ManagedIdentifierOptsOrResult,\n} from '@sphereon/ssi-sdk-ext.identifier-resolution'\nimport {\n CredentialMapper,\n Optional,\n OriginalVerifiablePresentation,\n SdJwtDecodedVerifiableCredential,\n W3CVerifiablePresentation,\n} from '@sphereon/ssi-types'\nimport { PresentationPayload, ProofFormat } from '@veramo/core'\nimport { IPEXPresentationSignCallback, IRequiredContext } from './types/IPresentationExchange'\n\nexport async function createPEXPresentationSignCallback(\n args: {\n idOpts: ManagedIdentifierOptsOrResult\n fetchRemoteContexts?: boolean\n skipDidResolution?: boolean\n format?: Format | ProofFormat\n domain?: string\n challenge?: string\n },\n context: IRequiredContext,\n): Promise<IPEXPresentationSignCallback> {\n function determineProofFormat(determineArgs: {\n format?: Format | 'jwt' | 'lds' | 'EthereumEip712Signature2021'\n presentationDefinition: IPresentationDefinition\n presentation: Optional<PresentationPayload, 'holder'> | SdJwtDecodedVerifiableCredential\n }): string {\n const { format, presentationDefinition, presentation } = determineArgs\n\n var formatOptions = format ?? presentationDefinition.format ?? args.format\n // TODO Refactor so it takes into account the Input Descriptors and we can lookup from there. Now we only do that if there is 1 descriptor\n if (!formatOptions && presentationDefinition.input_descriptors.length == 1 && 'format' in presentationDefinition.input_descriptors[0]) {\n formatOptions = presentationDefinition.input_descriptors[0].format\n }\n // All format arguments are optional. So if no format has been given we go for the most supported 'jwt'\n if (!formatOptions) {\n if (CredentialMapper.isSdJwtDecodedCredentialPayload(presentation.decodedPayload)) {\n return 'dc+sd-jwt'\n } else if (CredentialMapper.isMsoMdocDecodedPresentation(presentation.decodedPayload as OriginalVerifiablePresentation)) {\n return 'mso_mdoc'\n } else if (CredentialMapper.isW3cPresentation(presentation.decodedPayload)) {\n if (typeof presentation.signedPayload === 'string') {\n return 'jwt'\n }\n return 'lds'\n }\n return 'jwt'\n } else if (typeof formatOptions === 'string') {\n // if formatOptions is a singular string we can return that as the format\n return formatOptions\n }\n\n // here we transform all format options to either lds or jwt. but we also want to support sd-jwt, so we need to specifically check for this one. which is ['dc+sd-jwt']\n const formats = new Set(\n Object.keys(formatOptions).map((form) => (form.includes('ldp') ? 'lds' : form.includes('dc+sd-jwt') ? 'dc+sd-jwt' : 'jwt')),\n )\n\n // if we only have 1 format type we can return that\n if (formats.size === 1) {\n return formats.values().next().value!!\n }\n formats.keys().next()\n // if we can go for sd-jwt, we go for sd-jwt\n if (formats.has('dc+sd-jwt')) {\n return 'dc+sd-jwt'\n }\n // if it is not sd-jwt we would like to go for jwt\n else if (formats.has('jwt')) {\n return 'jwt'\n }\n\n // else we go for lds\n return 'lds'\n }\n\n return async ({\n presentation,\n domain,\n presentationDefinition,\n format,\n challenge,\n }: {\n presentation: Optional<PresentationPayload, 'holder'> | SdJwtDecodedVerifiableCredential\n presentationDefinition: IPresentationDefinition\n format?: Format | ProofFormat\n domain?: string\n challenge?: string\n }): Promise<W3CVerifiablePresentation> => {\n const proofFormat = determineProofFormat({ format, presentationDefinition, presentation })\n const { idOpts } = args\n const CLOCK_SKEW = 120\n if (args.skipDidResolution && isManagedIdentifierDidOpts(idOpts)) {\n idOpts.offlineWhenNoDIDRegistered = true\n }\n\n if ('compactSdJwtVc' in presentation) {\n if (proofFormat !== 'dc+sd-jwt') {\n return Promise.reject(Error(`presentation payload does not match proof format ${proofFormat}`))\n }\n\n const presentationResult = await context.agent.createSdJwtPresentation({\n ...(idOpts?.method === 'oid4vci-issuer' && { holder: idOpts?.issuer as string }),\n presentation: presentation.compactSdJwtVc,\n kb: {\n payload: {\n ...presentation.kbJwt?.payload,\n iat: presentation.kbJwt?.payload?.iat ?? Math.floor(Date.now() / 1000 - CLOCK_SKEW),\n nonce: challenge ?? presentation.kbJwt?.payload?.nonce,\n aud: presentation.kbJwt?.payload?.aud ?? domain ?? args.domain,\n },\n },\n })\n\n return CredentialMapper.storedPresentationToOriginalFormat(presentationResult.presentation as OriginalVerifiablePresentation)\n } else {\n const resolution = await context.agent.identifierManagedGet(idOpts)\n\n if (proofFormat === 'dc+sd-jwt') {\n return Promise.reject(Error(`presentation payload does not match proof format ${proofFormat}`))\n }\n let header\n if (!presentation.holder) {\n presentation.holder = resolution.issuer\n }\n if (proofFormat === 'jwt') {\n header = {\n ...((isManagedIdentifierDidResult(resolution) || isManagedIdentifierX5cResult(resolution)) && resolution.kid && { kid: resolution.kid }),\n ...(isManagedIdentifierX5cResult(resolution) && { jwk: resolution.jwk }),\n }\n if (presentation.verifier || !presentation.aud) {\n presentation.aud = Array.isArray(presentation.verifier) ? presentation.verifier : (presentation.verifier ?? domain ?? args.domain)\n delete presentation.verifier\n }\n\n if (!presentation.nbf) {\n if (presentation.issuanceDate) {\n const converted = Date.parse(presentation.issuanceDate)\n if (!isNaN(converted)) {\n presentation.nbf = Math.floor(converted / 1000) // no skew here, as an explicit value was given\n }\n } else {\n presentation.nbf = Math.floor(Date.now() / 1000 - CLOCK_SKEW)\n }\n }\n\n if (!presentation.iat) {\n presentation.iat = presentation.nbf\n }\n\n if (!presentation.exp) {\n if (presentation.expirationDate) {\n const converted = Date.parse(presentation.expirationDate)\n if (!isNaN(converted)) {\n presentation.exp = Math.floor(converted / 1000) // no skew here as an explicit value w as given\n }\n } else {\n presentation.exp = presentation.nbf + 600 + CLOCK_SKEW\n }\n }\n\n if (!presentation.vp) {\n presentation.vp = {}\n }\n /*if (!presentation.sub) {\n presentation.sub = id.did\n }*/\n if (!presentation.vp.holder) {\n presentation.vp.holder = presentation.holder\n }\n }\n\n // we ignore the alg / proof_format for now, as we already have the kid anyway at this point\n\n // todo: look for jwt_vc_json and remove types and @context\n\n const vp = await context.agent.createVerifiablePresentation({\n presentation: presentation as PresentationPayload,\n removeOriginalFields: false,\n keyRef: resolution.kmsKeyRef,\n // domain: domain ?? args.domain, // handled above, and did-jwt-vc creates an array even for 1 entry\n challenge: challenge ?? args.challenge,\n fetchRemoteContexts: args.fetchRemoteContexts !== false,\n proofFormat: proofFormat as ProofFormat,\n header,\n })\n\n // makes sure we extract an actual JWT from the internal representation in case it is a JWT\n return CredentialMapper.storedPresentationToOriginalFormat(vp as OriginalVerifiablePresentation)\n }\n }\n}\n","/**\n * @public\n */\nconst schema = require('../plugin.schema.json')\nexport { schema }\nexport { PresentationExchange } from './agent/PresentationExchange'\nexport * from './types/IPresentationExchange'\nexport * from './functions'\n"],"mappings":";;;;;;;;AAAA;AAAA;AAAA;AAAA,MACE,6BAA+B;AAAA,QAC7B,YAAc;AAAA,UACZ,SAAW;AAAA,YACT,qBAAuB;AAAA,cACrB,MAAQ;AAAA,cACR,YAAc;AAAA,gBACZ,WAAa;AAAA,kBACX,MAAQ;AAAA,gBACV;AAAA,gBACA,sBAAwB;AAAA,cAC1B;AAAA,cACA,UAAY,CAAC,WAAW;AAAA,cACxB,aAAe;AAAA,YACjB;AAAA,YACA,0BAA4B;AAAA,cAC1B,MAAQ;AAAA,cACR,YAAc;AAAA,gBACZ,YAAc;AAAA,kBACZ,MAAQ;AAAA,kBACR,YAAc;AAAA,oBACZ,KAAO;AAAA,sBACL,MAAQ;AAAA,oBACV;AAAA,oBACA,OAAS;AAAA,sBACP,MAAQ;AAAA,oBACV;AAAA,oBACA,UAAY;AAAA,sBACV,MAAQ;AAAA,oBACV;AAAA,oBACA,iBAAmB;AAAA,sBACjB,MAAQ;AAAA,oBACV;AAAA,oBACA,MAAQ;AAAA,sBACN,MAAQ;AAAA,sBACR,OAAS;AAAA,wBACP,MAAQ;AAAA,wBACR,YAAc;AAAA,0BACZ,sBAAwB;AAAA,wBAC1B;AAAA,sBACF;AAAA,oBACF;AAAA,oBACA,UAAY;AAAA,sBACV,MAAQ;AAAA,sBACR,OAAS;AAAA,wBACP,MAAQ;AAAA,wBACR,YA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KAAK;AACrB3C,uBAAa2C,MAAM3C,aAAa6D;QAClC;AAEA,YAAI,CAAC7D,aAAakE,KAAK;AACrB,cAAIlE,aAAamE,gBAAgB;AAC/B,kBAAMJ,YAAYjB,KAAKkB,MAAMhE,aAAamE,cAAc;AACxD,gBAAI,CAACF,MAAMF,SAAAA,GAAY;AACrB/D,2BAAakE,MAAMtB,KAAKC,MAAMkB,YAAY,GAAA;YAC5C;UACF,OAAO;AACL/D,yBAAakE,MAAMlE,aAAa6D,MAAM,MAAMnC;UAC9C;QACF;AAEA,YAAI,CAAC1B,aAAaoE,IAAI;AACpBpE,uBAAaoE,KAAK,CAAC;QACrB;AAIA,YAAI,CAACpE,aAAaoE,GAAG/B,QAAQ;AAC3BrC,uBAAaoE,GAAG/B,SAASrC,aAAaqC;QACxC;MACF;AAMA,YAAM+B,KAAK,MAAMzE,QAAQuC,MAAMmC,6BAA6B;QAC1DrE;QACAsE,sBAAsB;QACtBC,QAAQpB,WAAWqB;;QAEnBjD,WAAWA,aAAa7B,KAAK6B;QAC7BkD,qBAAqB/E,KAAK+E,wBAAwB;QAClDjD;QACA6B;MACF,CAAA;AAGA,aAAOjD,kBAAiB8C,mCAAmCkB,EAAAA;IAC7D;EACF;AACF;AAnLsB3E;;;ACftB,IAAMiF,SAASC;","names":["PEX","CredentialMapper","JWT_PROOF_TYPE_2020","toDIDs","verifiableCredentialForRoleFilter","PresentationExchange","schema","IDidAuthSiopOpAuthenticator","pex","PEX","methods","pexValidateDefinition","bind","pexDefinitionVersion","pexDefinitionFilterCredentials","pexDefinitionFilterCredentialsPerInputDescriptor","opts","args","definition","invalids","result","validateDefinition","validations","Array","isArray","push","filter","v","status","error","message","tag","length","Error","map","toString","presentationDefinition","definitionVersionDiscovery","context","credentials","pexFilterCredentials","credentialFilterOpts","holderDIDs","toDIDs","agent","dataStoreORMGetIdentifiers","selectResults","selectFrom","limitDisclosureSignatureSuites","id","filteredCredentials","verifiableCredential","vc","CredentialMapper","storedCredentialToOriginalFormat","origDefinition","promises","Map","input_descriptors","forEach","inputDescriptor","credentialRole","set","verifiableCredentials","Promise","all","values","entry","entries","filterOpts","verifiableCredentialForRoleFilter","uniqueCredentials","crsGetUniqueCredentials","uniqueVC","uniformVerifiableCredential","proof","jwtProof","find","p","type","JWT_PROOF_TYPE_2020","jwt","isManagedIdentifierDidOpts","isManagedIdentifierDidResult","isManagedIdentifierX5cResult","CredentialMapper","createPEXPresentationSignCallback","args","context","determineProofFormat","determineArgs","format","presentationDefinition","presentation","formatOptions","input_descriptors","length","CredentialMapper","isSdJwtDecodedCredentialPayload","decodedPayload","isMsoMdocDecodedPresentation","isW3cPresentation","signedPayload","formats","Set","Object","keys","map","form","includes","size","values","next","value","has","domain","challenge","proofFormat","idOpts","CLOCK_SKEW","skipDidResolution","isManagedIdentifierDidOpts","offlineWhenNoDIDRegistered","Promise","reject","Error","presentationResult","agent","createSdJwtPresentation","method","holder","issuer","compactSdJwtVc","kb","payload","kbJwt","iat","Math","floor","Date","now","nonce","aud","storedPresentationToOriginalFormat","resolution","identifierManagedGet","header","isManagedIdentifierDidResult","isManagedIdentifierX5cResult","kid","jwk","verifier","Array","isArray","nbf","issuanceDate","converted","parse","isNaN","exp","expirationDate","vp","createVerifiablePresentation","removeOriginalFields","keyRef","kmsKeyRef","fetchRemoteContexts","schema","require"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ssi-sdk.presentation-exchange",
|
|
3
|
-
"version": "0.34.1-next.
|
|
3
|
+
"version": "0.34.1-next.85+019802c5",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -28,17 +28,17 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@sphereon/pex": "5.0.0-unstable.28",
|
|
30
30
|
"@sphereon/pex-models": "^2.3.2",
|
|
31
|
-
"@sphereon/ssi-sdk-ext.did-utils": "0.
|
|
32
|
-
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.
|
|
33
|
-
"@sphereon/ssi-sdk.credential-store": "0.34.1-next.
|
|
34
|
-
"@sphereon/ssi-sdk.data-store": "0.34.1-next.
|
|
35
|
-
"@sphereon/ssi-sdk.sd-jwt": "0.34.1-next.
|
|
36
|
-
"@sphereon/ssi-types": "0.34.1-next.
|
|
31
|
+
"@sphereon/ssi-sdk-ext.did-utils": "0.34.1-next.85+019802c5",
|
|
32
|
+
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.34.1-next.85+019802c5",
|
|
33
|
+
"@sphereon/ssi-sdk.credential-store": "0.34.1-next.85+019802c5",
|
|
34
|
+
"@sphereon/ssi-sdk.data-store": "0.34.1-next.85+019802c5",
|
|
35
|
+
"@sphereon/ssi-sdk.sd-jwt": "0.34.1-next.85+019802c5",
|
|
36
|
+
"@sphereon/ssi-types": "0.34.1-next.85+019802c5",
|
|
37
37
|
"@veramo/core": "4.2.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@sphereon/did-uni-client": "^0.6.3",
|
|
41
|
-
"@sphereon/ssi-sdk.agent-config": "0.34.1-next.
|
|
41
|
+
"@sphereon/ssi-sdk.agent-config": "0.34.1-next.85+019802c5",
|
|
42
42
|
"@types/json-buffer": "^3.0.2",
|
|
43
43
|
"@veramo/did-provider-key": "4.2.0",
|
|
44
44
|
"@veramo/did-resolver": "4.2.0",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"OpenID Connect",
|
|
75
75
|
"Authenticator"
|
|
76
76
|
],
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "019802c57e9c1f9e3df4ecbb1d6a17f49e8fdbeb"
|
|
78
78
|
}
|
package/src/functions.ts
CHANGED
|
@@ -42,7 +42,7 @@ export async function createPEXPresentationSignCallback(
|
|
|
42
42
|
// All format arguments are optional. So if no format has been given we go for the most supported 'jwt'
|
|
43
43
|
if (!formatOptions) {
|
|
44
44
|
if (CredentialMapper.isSdJwtDecodedCredentialPayload(presentation.decodedPayload)) {
|
|
45
|
-
return '
|
|
45
|
+
return 'dc+sd-jwt'
|
|
46
46
|
} else if (CredentialMapper.isMsoMdocDecodedPresentation(presentation.decodedPayload as OriginalVerifiablePresentation)) {
|
|
47
47
|
return 'mso_mdoc'
|
|
48
48
|
} else if (CredentialMapper.isW3cPresentation(presentation.decodedPayload)) {
|
|
@@ -57,9 +57,9 @@ export async function createPEXPresentationSignCallback(
|
|
|
57
57
|
return formatOptions
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
// here we transform all format options to either lds or jwt. but we also want to support sd-jwt, so we need to specifically check for this one. which is ['
|
|
60
|
+
// here we transform all format options to either lds or jwt. but we also want to support sd-jwt, so we need to specifically check for this one. which is ['dc+sd-jwt']
|
|
61
61
|
const formats = new Set(
|
|
62
|
-
Object.keys(formatOptions).map((form) => (form.includes('ldp') ? 'lds' : form.includes('
|
|
62
|
+
Object.keys(formatOptions).map((form) => (form.includes('ldp') ? 'lds' : form.includes('dc+sd-jwt') ? 'dc+sd-jwt' : 'jwt')),
|
|
63
63
|
)
|
|
64
64
|
|
|
65
65
|
// if we only have 1 format type we can return that
|
|
@@ -68,8 +68,8 @@ export async function createPEXPresentationSignCallback(
|
|
|
68
68
|
}
|
|
69
69
|
formats.keys().next()
|
|
70
70
|
// if we can go for sd-jwt, we go for sd-jwt
|
|
71
|
-
if (formats.has('
|
|
72
|
-
return '
|
|
71
|
+
if (formats.has('dc+sd-jwt')) {
|
|
72
|
+
return 'dc+sd-jwt'
|
|
73
73
|
}
|
|
74
74
|
// if it is not sd-jwt we would like to go for jwt
|
|
75
75
|
else if (formats.has('jwt')) {
|
|
@@ -101,7 +101,7 @@ export async function createPEXPresentationSignCallback(
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
if ('compactSdJwtVc' in presentation) {
|
|
104
|
-
if (proofFormat !== '
|
|
104
|
+
if (proofFormat !== 'dc+sd-jwt') {
|
|
105
105
|
return Promise.reject(Error(`presentation payload does not match proof format ${proofFormat}`))
|
|
106
106
|
}
|
|
107
107
|
|
|
@@ -122,7 +122,7 @@ export async function createPEXPresentationSignCallback(
|
|
|
122
122
|
} else {
|
|
123
123
|
const resolution = await context.agent.identifierManagedGet(idOpts)
|
|
124
124
|
|
|
125
|
-
if (proofFormat === '
|
|
125
|
+
if (proofFormat === 'dc+sd-jwt') {
|
|
126
126
|
return Promise.reject(Error(`presentation payload does not match proof format ${proofFormat}`))
|
|
127
127
|
}
|
|
128
128
|
let header
|