@sphereon/ssi-sdk.presentation-exchange 0.33.1-next.3 → 0.33.1-next.68
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 +619 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +83 -0
- package/dist/index.d.ts +79 -5
- package/dist/index.js +597 -25
- package/dist/index.js.map +1 -1
- package/package.json +27 -17
- package/dist/agent/PresentationExchange.d.ts +0 -16
- package/dist/agent/PresentationExchange.d.ts.map +0 -1
- package/dist/agent/PresentationExchange.js +0 -120
- package/dist/agent/PresentationExchange.js.map +0 -1
- package/dist/functions.d.ts +0 -13
- package/dist/functions.d.ts.map +0 -1
- package/dist/functions.js +0 -148
- package/dist/functions.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/types/IPresentationExchange.d.ts +0 -55
- package/dist/types/IPresentationExchange.d.ts.map +0 -1
- package/dist/types/IPresentationExchange.js +0 -3
- package/dist/types/IPresentationExchange.js.map +0 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,MAAM,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAA;AACtC,wBAAM;AACf,qEAAmE;AAA1D,4HAAA,oBAAoB,OAAA;AAC7B,gEAA6C;AAC7C,8CAA2B"}
|
|
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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WT_PROOF_TYPE_2020","toDIDs","verifiableCredentialForRoleFilter","PresentationExchange","schema","IDidAuthSiopOpAuthenticator","pex","PEX","methods","pexValidateDefinition","bind","pexDefinitionVersion","pexDefinitionFilterCredentials","pexDefinitionFilterCredentialsPerInputDescriptor","constructor","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,32 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ssi-sdk.presentation-exchange",
|
|
3
|
-
"version": "0.33.1-next.
|
|
3
|
+
"version": "0.33.1-next.68+b6c8b366",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
"react-native": "./dist/index.js",
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"require": {
|
|
16
|
+
"types": "./dist/index.d.cts",
|
|
17
|
+
"require": "./dist/index.cjs"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
7
20
|
"veramo": {
|
|
8
21
|
"pluginInterfaces": {
|
|
9
22
|
"IPresentationExchange": "./src/types/IPresentationExchange.ts"
|
|
10
23
|
}
|
|
11
24
|
},
|
|
12
25
|
"scripts": {
|
|
13
|
-
"build": "
|
|
14
|
-
"build:clean": "tsc --build --clean && tsc --build"
|
|
26
|
+
"build": "tsup --config ../../tsup.config.ts --tsconfig ../../tsconfig.tsup.json"
|
|
15
27
|
},
|
|
16
28
|
"dependencies": {
|
|
17
29
|
"@sphereon/pex": "5.0.0-unstable.28",
|
|
18
30
|
"@sphereon/pex-models": "^2.3.2",
|
|
19
|
-
"@sphereon/ssi-sdk-ext.did-utils": "0.28.
|
|
20
|
-
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.28.
|
|
21
|
-
"@sphereon/ssi-sdk.credential-store": "0.33.1-next.
|
|
22
|
-
"@sphereon/ssi-sdk.data-store": "0.33.1-next.
|
|
23
|
-
"@sphereon/ssi-sdk.sd-jwt": "0.33.1-next.
|
|
24
|
-
"@sphereon/ssi-types": "0.33.1-next.
|
|
31
|
+
"@sphereon/ssi-sdk-ext.did-utils": "0.28.1-next.53",
|
|
32
|
+
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.28.1-next.53",
|
|
33
|
+
"@sphereon/ssi-sdk.credential-store": "0.33.1-next.68+b6c8b366",
|
|
34
|
+
"@sphereon/ssi-sdk.data-store": "0.33.1-next.68+b6c8b366",
|
|
35
|
+
"@sphereon/ssi-sdk.sd-jwt": "0.33.1-next.68+b6c8b366",
|
|
36
|
+
"@sphereon/ssi-types": "0.33.1-next.68+b6c8b366",
|
|
25
37
|
"@veramo/core": "4.2.0"
|
|
26
38
|
},
|
|
27
39
|
"devDependencies": {
|
|
28
40
|
"@sphereon/did-uni-client": "^0.6.3",
|
|
29
|
-
"@sphereon/ssi-sdk.agent-config": "0.33.1-next.
|
|
41
|
+
"@sphereon/ssi-sdk.agent-config": "0.33.1-next.68+b6c8b366",
|
|
30
42
|
"@types/json-buffer": "^3.0.2",
|
|
31
43
|
"@veramo/did-provider-key": "4.2.0",
|
|
32
44
|
"@veramo/did-resolver": "4.2.0",
|
|
@@ -37,9 +49,8 @@
|
|
|
37
49
|
"nock": "^13.5.4"
|
|
38
50
|
},
|
|
39
51
|
"files": [
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"src/**/*",
|
|
52
|
+
"dist",
|
|
53
|
+
"src",
|
|
43
54
|
"README.md",
|
|
44
55
|
"plugin.schema.json",
|
|
45
56
|
"LICENSE"
|
|
@@ -63,6 +74,5 @@
|
|
|
63
74
|
"OpenID Connect",
|
|
64
75
|
"Authenticator"
|
|
65
76
|
],
|
|
66
|
-
"
|
|
67
|
-
"gitHead": "fd1a6fba306a83a73ff7c531db87fa207dbf436d"
|
|
77
|
+
"gitHead": "b6c8b36636fa3777494f55860d6a75f2e5a5611e"
|
|
68
78
|
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { IDefinitionCredentialFilterArgs, IPEXFilterResult, IPEXFilterResultWithInputDescriptor, IRequiredContext, PEXOpts, VersionDiscoveryResult } from '../index';
|
|
2
|
-
import { IAgentPlugin } from '@veramo/core';
|
|
3
|
-
import { IPresentationExchange } from '../types/IPresentationExchange';
|
|
4
|
-
import { IPresentationDefinition } from '@sphereon/pex';
|
|
5
|
-
export declare class PresentationExchange implements IAgentPlugin {
|
|
6
|
-
readonly schema: any;
|
|
7
|
-
private readonly pex;
|
|
8
|
-
readonly methods: IPresentationExchange;
|
|
9
|
-
constructor(opts?: PEXOpts);
|
|
10
|
-
private pexValidateDefinition;
|
|
11
|
-
pexDefinitionVersion(presentationDefinition: IPresentationDefinition): Promise<VersionDiscoveryResult>;
|
|
12
|
-
pexDefinitionFilterCredentials(args: IDefinitionCredentialFilterArgs, context: IRequiredContext): Promise<IPEXFilterResult>;
|
|
13
|
-
pexDefinitionFilterCredentialsPerInputDescriptor(args: IDefinitionCredentialFilterArgs, context: IRequiredContext): Promise<IPEXFilterResultWithInputDescriptor[]>;
|
|
14
|
-
private pexFilterCredentials;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=PresentationExchange.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PresentationExchange.d.ts","sourceRoot":"","sources":["../../src/agent/PresentationExchange.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,+BAA+B,EAE/B,gBAAgB,EAChB,mCAAmC,EACnC,gBAAgB,EAChB,OAAO,EAEP,sBAAsB,EACvB,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAE3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAA;AACtE,OAAO,EAAW,uBAAuB,EAAO,MAAM,eAAe,CAAA;AAOrE,qBAAa,oBAAqB,YAAW,YAAY;IACvD,QAAQ,CAAC,MAAM,MAAqC;IACpD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAY;IAEhC,QAAQ,CAAC,OAAO,EAAE,qBAAqB,CAKtC;gBAEW,IAAI,CAAC,EAAE,OAAO;YAEZ,qBAAqB;IA2B7B,oBAAoB,CAAC,sBAAsB,EAAE,uBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAItG,8BAA8B,CAAC,IAAI,EAAE,+BAA+B,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAe3H,gDAAgD,CACpD,IAAI,EAAE,+BAA+B,EACrC,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,mCAAmC,EAAE,CAAC;YAqCnC,oBAAoB;CAsBnC"}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.PresentationExchange = void 0;
|
|
13
|
-
const index_1 = require("../index");
|
|
14
|
-
const pex_1 = require("@sphereon/pex");
|
|
15
|
-
const ssi_types_1 = require("@sphereon/ssi-types");
|
|
16
|
-
const ssi_sdk_ext_did_utils_1 = require("@sphereon/ssi-sdk-ext.did-utils");
|
|
17
|
-
const ssi_sdk_credential_store_1 = require("@sphereon/ssi-sdk.credential-store");
|
|
18
|
-
class PresentationExchange {
|
|
19
|
-
constructor(opts) {
|
|
20
|
-
this.schema = index_1.schema.IDidAuthSiopOpAuthenticator;
|
|
21
|
-
this.pex = new pex_1.PEX();
|
|
22
|
-
this.methods = {
|
|
23
|
-
pexValidateDefinition: this.pexValidateDefinition.bind(this),
|
|
24
|
-
pexDefinitionVersion: this.pexDefinitionVersion.bind(this),
|
|
25
|
-
pexDefinitionFilterCredentials: this.pexDefinitionFilterCredentials.bind(this),
|
|
26
|
-
pexDefinitionFilterCredentialsPerInputDescriptor: this.pexDefinitionFilterCredentialsPerInputDescriptor.bind(this),
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
pexValidateDefinition(args) {
|
|
30
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
const { definition } = args;
|
|
32
|
-
const invalids = [];
|
|
33
|
-
try {
|
|
34
|
-
const result = pex_1.PEX.validateDefinition(definition);
|
|
35
|
-
const validations = Array.isArray(result) ? result : [result];
|
|
36
|
-
invalids.push(...validations.filter((v) => v.status === 'error'));
|
|
37
|
-
}
|
|
38
|
-
catch (error) {
|
|
39
|
-
invalids.push({
|
|
40
|
-
status: 'error',
|
|
41
|
-
message: typeof error === 'string'
|
|
42
|
-
? error
|
|
43
|
-
: typeof error === 'object' && 'message' in error
|
|
44
|
-
? error.message
|
|
45
|
-
: 'unknown error',
|
|
46
|
-
tag: 'validation',
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
if (invalids.length > 0) {
|
|
50
|
-
throw Error(`Invalid definition. ${invalids.map((v) => v.message).toString()}`);
|
|
51
|
-
}
|
|
52
|
-
return true; // Never returns false, but REST API does not allow Promise<void>
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
pexDefinitionVersion(presentationDefinition) {
|
|
56
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
return pex_1.PEX.definitionVersionDiscovery(presentationDefinition);
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
pexDefinitionFilterCredentials(args, context) {
|
|
61
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
var _a, _b, _c;
|
|
63
|
-
const credentials = yield this.pexFilterCredentials(args.credentialFilterOpts, context);
|
|
64
|
-
const holderDIDs = args.holderDIDs ? (0, ssi_sdk_ext_did_utils_1.toDIDs)(args.holderDIDs) : (0, ssi_sdk_ext_did_utils_1.toDIDs)(yield context.agent.dataStoreORMGetIdentifiers());
|
|
65
|
-
const selectResults = this.pex.selectFrom(args.presentationDefinition, credentials !== null && credentials !== void 0 ? credentials : [], Object.assign(Object.assign({}, args), { holderDIDs, limitDisclosureSignatureSuites: (_a = args.limitDisclosureSignatureSuites) !== null && _a !== void 0 ? _a : ['BbsBlsSignature2020'] }));
|
|
66
|
-
return {
|
|
67
|
-
id: args.presentationDefinition.id,
|
|
68
|
-
selectResults,
|
|
69
|
-
filteredCredentials: (_c = (_b = selectResults.verifiableCredential) === null || _b === void 0 ? void 0 : _b.map((vc) => ssi_types_1.CredentialMapper.storedCredentialToOriginalFormat(vc))) !== null && _c !== void 0 ? _c : [],
|
|
70
|
-
};
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
pexDefinitionFilterCredentialsPerInputDescriptor(args, context) {
|
|
74
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
var _a;
|
|
76
|
-
const origDefinition = args.presentationDefinition;
|
|
77
|
-
const credentials = yield this.pexFilterCredentials((_a = args.credentialFilterOpts) !== null && _a !== void 0 ? _a : {}, context);
|
|
78
|
-
const holderDIDs = args.holderDIDs ? (0, ssi_sdk_ext_did_utils_1.toDIDs)(args.holderDIDs) : (0, ssi_sdk_ext_did_utils_1.toDIDs)(yield context.agent.dataStoreORMGetIdentifiers());
|
|
79
|
-
const limitDisclosureSignatureSuites = args.limitDisclosureSignatureSuites;
|
|
80
|
-
const promises = new Map();
|
|
81
|
-
origDefinition.input_descriptors.forEach((inputDescriptor) => {
|
|
82
|
-
const presentationDefinition = {
|
|
83
|
-
id: inputDescriptor.id,
|
|
84
|
-
input_descriptors: [inputDescriptor],
|
|
85
|
-
};
|
|
86
|
-
const credentialRole = args.credentialFilterOpts.credentialRole;
|
|
87
|
-
promises.set(inputDescriptor, this.pexDefinitionFilterCredentials({
|
|
88
|
-
credentialFilterOpts: { credentialRole, verifiableCredentials: credentials },
|
|
89
|
-
// @ts-ignore
|
|
90
|
-
presentationDefinition,
|
|
91
|
-
holderDIDs,
|
|
92
|
-
limitDisclosureSignatureSuites,
|
|
93
|
-
}, context));
|
|
94
|
-
});
|
|
95
|
-
yield Promise.all(promises.values());
|
|
96
|
-
const result = [];
|
|
97
|
-
for (const entry of promises.entries()) {
|
|
98
|
-
result.push(Object.assign(Object.assign({}, (yield entry[1])), { inputDescriptor: entry[0] }));
|
|
99
|
-
}
|
|
100
|
-
return result;
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
pexFilterCredentials(filterOpts, context) {
|
|
104
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
105
|
-
if (filterOpts.verifiableCredentials && filterOpts.verifiableCredentials.length > 0) {
|
|
106
|
-
return filterOpts.verifiableCredentials;
|
|
107
|
-
}
|
|
108
|
-
const filter = (0, ssi_sdk_credential_store_1.verifiableCredentialForRoleFilter)(filterOpts.credentialRole, filterOpts.filter);
|
|
109
|
-
const uniqueCredentials = yield context.agent.crsGetUniqueCredentials({ filter });
|
|
110
|
-
return uniqueCredentials.map((uniqueVC) => {
|
|
111
|
-
const vc = uniqueVC.uniformVerifiableCredential;
|
|
112
|
-
const proof = Array.isArray(vc.proof) ? vc.proof : [vc.proof];
|
|
113
|
-
const jwtProof = proof.find((p) => (p === null || p === void 0 ? void 0 : p.type) === ssi_types_1.JWT_PROOF_TYPE_2020);
|
|
114
|
-
return jwtProof ? jwtProof.jwt : vc;
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
exports.PresentationExchange = PresentationExchange;
|
|
120
|
-
//# sourceMappingURL=PresentationExchange.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PresentationExchange.js","sourceRoot":"","sources":["../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E,CAAA;YACrD,CAAC,CAAC,CAAA;QACJ,CAAC;KAAA;CACF;AAzHD,oDAyHC"}
|
package/dist/functions.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Format } from '@sphereon/pex-models';
|
|
2
|
-
import { ManagedIdentifierOptsOrResult } from '@sphereon/ssi-sdk-ext.identifier-resolution';
|
|
3
|
-
import { ProofFormat } from '@veramo/core';
|
|
4
|
-
import { IPEXPresentationSignCallback, IRequiredContext } from './types/IPresentationExchange';
|
|
5
|
-
export declare function createPEXPresentationSignCallback(args: {
|
|
6
|
-
idOpts: ManagedIdentifierOptsOrResult;
|
|
7
|
-
fetchRemoteContexts?: boolean;
|
|
8
|
-
skipDidResolution?: boolean;
|
|
9
|
-
format?: Format | ProofFormat;
|
|
10
|
-
domain?: string;
|
|
11
|
-
challenge?: string;
|
|
12
|
-
}, context: IRequiredContext): Promise<IPEXPresentationSignCallback>;
|
|
13
|
-
//# sourceMappingURL=functions.d.ts.map
|
package/dist/functions.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../src/functions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC7C,OAAO,EAIL,6BAA6B,EAC9B,MAAM,6CAA6C,CAAA;AAQpD,OAAO,EAAuB,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/D,OAAO,EAAE,4BAA4B,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAE9F,wBAAsB,iCAAiC,CACrD,IAAI,EAAE;IACJ,MAAM,EAAE,6BAA6B,CAAA;IACrC,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,MAAM,CAAC,EAAE,MAAM,GAAG,WAAW,CAAA;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,EACD,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,4BAA4B,CAAC,CAyKvC"}
|
package/dist/functions.js
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.createPEXPresentationSignCallback = createPEXPresentationSignCallback;
|
|
13
|
-
const ssi_sdk_ext_identifier_resolution_1 = require("@sphereon/ssi-sdk-ext.identifier-resolution");
|
|
14
|
-
const ssi_types_1 = require("@sphereon/ssi-types");
|
|
15
|
-
function createPEXPresentationSignCallback(args, context) {
|
|
16
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
function determineProofFormat(determineArgs) {
|
|
18
|
-
var _a;
|
|
19
|
-
const { format, presentationDefinition, presentation } = determineArgs;
|
|
20
|
-
var formatOptions = (_a = format !== null && format !== void 0 ? format : presentationDefinition.format) !== null && _a !== void 0 ? _a : args.format;
|
|
21
|
-
// 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
|
|
22
|
-
if (!formatOptions && presentationDefinition.input_descriptors.length == 1 && 'format' in presentationDefinition.input_descriptors[0]) {
|
|
23
|
-
formatOptions = presentationDefinition.input_descriptors[0].format;
|
|
24
|
-
}
|
|
25
|
-
// All format arguments are optional. So if no format has been given we go for the most supported 'jwt'
|
|
26
|
-
if (!formatOptions) {
|
|
27
|
-
if (ssi_types_1.CredentialMapper.isSdJwtDecodedCredentialPayload(presentation.decodedPayload)) {
|
|
28
|
-
return 'vc+sd-jwt';
|
|
29
|
-
}
|
|
30
|
-
else if (ssi_types_1.CredentialMapper.isMsoMdocDecodedPresentation(presentation.decodedPayload)) {
|
|
31
|
-
return 'mso_mdoc';
|
|
32
|
-
}
|
|
33
|
-
else if (ssi_types_1.CredentialMapper.isW3cPresentation(presentation.decodedPayload)) {
|
|
34
|
-
if (typeof presentation.signedPayload === 'string') {
|
|
35
|
-
return 'jwt';
|
|
36
|
-
}
|
|
37
|
-
return 'lds';
|
|
38
|
-
}
|
|
39
|
-
return 'jwt';
|
|
40
|
-
}
|
|
41
|
-
else if (typeof formatOptions === 'string') {
|
|
42
|
-
// if formatOptions is a singular string we can return that as the format
|
|
43
|
-
return formatOptions;
|
|
44
|
-
}
|
|
45
|
-
// 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']
|
|
46
|
-
const formats = new Set(Object.keys(formatOptions).map((form) => (form.includes('ldp') ? 'lds' : form.includes('vc+sd-jwt') ? 'vc+sd-jwt' : 'jwt')));
|
|
47
|
-
// if we only have 1 format type we can return that
|
|
48
|
-
if (formats.size === 1) {
|
|
49
|
-
return formats.values().next().value;
|
|
50
|
-
}
|
|
51
|
-
formats.keys().next();
|
|
52
|
-
// if we can go for sd-jwt, we go for sd-jwt
|
|
53
|
-
if (formats.has('vc+sd-jwt')) {
|
|
54
|
-
return 'vc+sd-jwt';
|
|
55
|
-
}
|
|
56
|
-
// if it is not sd-jwt we would like to go for jwt
|
|
57
|
-
else if (formats.has('jwt')) {
|
|
58
|
-
return 'jwt';
|
|
59
|
-
}
|
|
60
|
-
// else we go for lds
|
|
61
|
-
return 'lds';
|
|
62
|
-
}
|
|
63
|
-
return (_a) => __awaiter(this, [_a], void 0, function* ({ presentation, domain, presentationDefinition, format, challenge, }) {
|
|
64
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
65
|
-
const proofFormat = determineProofFormat({ format, presentationDefinition, presentation });
|
|
66
|
-
const { idOpts } = args;
|
|
67
|
-
const CLOCK_SKEW = 120;
|
|
68
|
-
if (args.skipDidResolution && (0, ssi_sdk_ext_identifier_resolution_1.isManagedIdentifierDidOpts)(idOpts)) {
|
|
69
|
-
idOpts.offlineWhenNoDIDRegistered = true;
|
|
70
|
-
}
|
|
71
|
-
if ('compactSdJwtVc' in presentation) {
|
|
72
|
-
if (proofFormat !== 'vc+sd-jwt') {
|
|
73
|
-
return Promise.reject(Error(`presentation payload does not match proof format ${proofFormat}`));
|
|
74
|
-
}
|
|
75
|
-
const presentationResult = yield context.agent.createSdJwtPresentation(Object.assign(Object.assign({}, ((idOpts === null || idOpts === void 0 ? void 0 : idOpts.method) === 'oid4vci-issuer' && { holder: idOpts === null || idOpts === void 0 ? void 0 : idOpts.issuer })), { presentation: presentation.compactSdJwtVc, kb: {
|
|
76
|
-
payload: Object.assign(Object.assign({}, (_b = presentation.kbJwt) === null || _b === void 0 ? void 0 : _b.payload), { iat: (_e = (_d = (_c = presentation.kbJwt) === null || _c === void 0 ? void 0 : _c.payload) === null || _d === void 0 ? void 0 : _d.iat) !== null && _e !== void 0 ? _e : Math.floor(Date.now() / 1000 - CLOCK_SKEW), nonce: challenge !== null && challenge !== void 0 ? challenge : (_g = (_f = presentation.kbJwt) === null || _f === void 0 ? void 0 : _f.payload) === null || _g === void 0 ? void 0 : _g.nonce, aud: (_l = (_k = (_j = (_h = presentation.kbJwt) === null || _h === void 0 ? void 0 : _h.payload) === null || _j === void 0 ? void 0 : _j.aud) !== null && _k !== void 0 ? _k : domain) !== null && _l !== void 0 ? _l : args.domain }),
|
|
77
|
-
} }));
|
|
78
|
-
return ssi_types_1.CredentialMapper.storedPresentationToOriginalFormat(presentationResult.presentation);
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
const resolution = yield context.agent.identifierManagedGet(idOpts);
|
|
82
|
-
if (proofFormat === 'vc+sd-jwt') {
|
|
83
|
-
return Promise.reject(Error(`presentation payload does not match proof format ${proofFormat}`));
|
|
84
|
-
}
|
|
85
|
-
let header;
|
|
86
|
-
if (!presentation.holder) {
|
|
87
|
-
presentation.holder = resolution.issuer;
|
|
88
|
-
}
|
|
89
|
-
if (proofFormat === 'jwt') {
|
|
90
|
-
header = Object.assign(Object.assign({}, (((0, ssi_sdk_ext_identifier_resolution_1.isManagedIdentifierDidResult)(resolution) || (0, ssi_sdk_ext_identifier_resolution_1.isManagedIdentifierX5cResult)(resolution)) && resolution.kid && { kid: resolution.kid })), ((0, ssi_sdk_ext_identifier_resolution_1.isManagedIdentifierX5cResult)(resolution) && { jwk: resolution.jwk }));
|
|
91
|
-
if (presentation.verifier || !presentation.aud) {
|
|
92
|
-
presentation.aud = Array.isArray(presentation.verifier) ? presentation.verifier : ((_o = (_m = presentation.verifier) !== null && _m !== void 0 ? _m : domain) !== null && _o !== void 0 ? _o : args.domain);
|
|
93
|
-
delete presentation.verifier;
|
|
94
|
-
}
|
|
95
|
-
if (!presentation.nbf) {
|
|
96
|
-
if (presentation.issuanceDate) {
|
|
97
|
-
const converted = Date.parse(presentation.issuanceDate);
|
|
98
|
-
if (!isNaN(converted)) {
|
|
99
|
-
presentation.nbf = Math.floor(converted / 1000); // no skew here, as an explicit value was given
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
presentation.nbf = Math.floor(Date.now() / 1000 - CLOCK_SKEW);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
if (!presentation.iat) {
|
|
107
|
-
presentation.iat = presentation.nbf;
|
|
108
|
-
}
|
|
109
|
-
if (!presentation.exp) {
|
|
110
|
-
if (presentation.expirationDate) {
|
|
111
|
-
const converted = Date.parse(presentation.expirationDate);
|
|
112
|
-
if (!isNaN(converted)) {
|
|
113
|
-
presentation.exp = Math.floor(converted / 1000); // no skew here as an explicit value w as given
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
presentation.exp = presentation.nbf + 600 + CLOCK_SKEW;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
if (!presentation.vp) {
|
|
121
|
-
presentation.vp = {};
|
|
122
|
-
}
|
|
123
|
-
/*if (!presentation.sub) {
|
|
124
|
-
presentation.sub = id.did
|
|
125
|
-
}*/
|
|
126
|
-
if (!presentation.vp.holder) {
|
|
127
|
-
presentation.vp.holder = presentation.holder;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
// we ignore the alg / proof_format for now, as we already have the kid anyway at this point
|
|
131
|
-
// todo: look for jwt_vc_json and remove types and @context
|
|
132
|
-
const vp = yield context.agent.createVerifiablePresentation({
|
|
133
|
-
presentation: presentation,
|
|
134
|
-
removeOriginalFields: false,
|
|
135
|
-
keyRef: resolution.kmsKeyRef,
|
|
136
|
-
// domain: domain ?? args.domain, // handled above, and did-jwt-vc creates an array even for 1 entry
|
|
137
|
-
challenge: challenge !== null && challenge !== void 0 ? challenge : args.challenge,
|
|
138
|
-
fetchRemoteContexts: args.fetchRemoteContexts !== false,
|
|
139
|
-
proofFormat: proofFormat,
|
|
140
|
-
header,
|
|
141
|
-
});
|
|
142
|
-
// makes sure we extract an actual JWT from the internal representation in case it is a JWT
|
|
143
|
-
return ssi_types_1.CredentialMapper.storedPresentationToOriginalFormat(vp);
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
//# sourceMappingURL=functions.js.map
|
package/dist/functions.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../src/functions.ts"],"names":[],"mappings":";;;;;;;;;;;AAkBA,8EAmLC;AAnMD,mGAKoD;AACpD,mDAM4B;AAI5B,SAAsB,iCAAiC,CACrD,IAOC,EACD,OAAyB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AAC,mBAAmB,KAAK,KAAK;oBACvD,WAAW,EAAE,WAA0B;oBACvC,MAAM;iBACP,CAAC,CAAA;gBAEF,2FAA2F;gBAC3F,OAAO,4BAAgB,CAAC,kCAAkC,CAAC,EAAoC,CAAC,CAAA;YAClG,CAAC;QACH,CAAC,CAAA,CAAA;IACH,CAAC;CAAA"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,QAAA,MAAM,MAAM,KAAmC,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,CAAA;AACjB,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AACnE,cAAc,+BAA+B,CAAA;AAC7C,cAAc,aAAa,CAAA"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { IIdentifierResolution } from '@sphereon/ssi-sdk-ext.identifier-resolution';
|
|
2
|
-
import { IAgentContext, ICredentialPlugin, IDataStoreORM, IDIDManager, IIdentifier, IPluginMethodMap, IResolver, PresentationPayload } from '@veramo/core';
|
|
3
|
-
import { IPresentation, Optional, SdJwtDecodedVerifiableCredential, W3CVerifiableCredential, W3CVerifiablePresentation } from '@sphereon/ssi-types';
|
|
4
|
-
import { IPresentationDefinition, PEVersion, SelectResults } from '@sphereon/pex';
|
|
5
|
-
import { Format, InputDescriptorV1, InputDescriptorV2 } from '@sphereon/pex-models';
|
|
6
|
-
import { CredentialRole, FindDigitalCredentialArgs } from '@sphereon/ssi-sdk.data-store';
|
|
7
|
-
import { ISDJwtPlugin } from '@sphereon/ssi-sdk.sd-jwt';
|
|
8
|
-
export interface IPresentationExchange extends IPluginMethodMap {
|
|
9
|
-
pexValidateDefinition(args: IDefinitionValidateArgs): Promise<boolean>;
|
|
10
|
-
pexDefinitionVersion(presentationDefinition: IPresentationDefinition): Promise<VersionDiscoveryResult>;
|
|
11
|
-
pexDefinitionFilterCredentials(args: IDefinitionCredentialFilterArgs, context: IRequiredContext): Promise<IPEXFilterResult>;
|
|
12
|
-
pexDefinitionFilterCredentialsPerInputDescriptor(args: IDefinitionCredentialFilterArgs, context: IRequiredContext): Promise<IPEXFilterResultWithInputDescriptor[]>;
|
|
13
|
-
}
|
|
14
|
-
export interface IDefinitionValidateArgs {
|
|
15
|
-
definition: IPresentationDefinition;
|
|
16
|
-
}
|
|
17
|
-
export interface IDefinitionCredentialFilterArgs {
|
|
18
|
-
presentationDefinition: IPresentationDefinition;
|
|
19
|
-
credentialFilterOpts: {
|
|
20
|
-
credentialRole: CredentialRole;
|
|
21
|
-
verifiableCredentials?: W3CVerifiableCredential[];
|
|
22
|
-
filter?: FindDigitalCredentialArgs;
|
|
23
|
-
};
|
|
24
|
-
holderDIDs?: (string | IIdentifier)[];
|
|
25
|
-
limitDisclosureSignatureSuites?: string[];
|
|
26
|
-
restrictToFormats?: Format;
|
|
27
|
-
restrictToDIDMethods?: string[];
|
|
28
|
-
}
|
|
29
|
-
export interface PEXOpts {
|
|
30
|
-
defaultStore?: string;
|
|
31
|
-
defaultNamespace?: string;
|
|
32
|
-
}
|
|
33
|
-
export interface IPEXOptions {
|
|
34
|
-
definition?: IPresentationDefinition;
|
|
35
|
-
definitionId: string;
|
|
36
|
-
}
|
|
37
|
-
export interface IPEXFilterResultWithInputDescriptor extends IPEXFilterResult {
|
|
38
|
-
inputDescriptor: InputDescriptorV1 | InputDescriptorV2;
|
|
39
|
-
}
|
|
40
|
-
export interface IPEXFilterResult {
|
|
41
|
-
id: string;
|
|
42
|
-
selectResults: SelectResults;
|
|
43
|
-
filteredCredentials: W3CVerifiableCredential[];
|
|
44
|
-
}
|
|
45
|
-
export interface VersionDiscoveryResult {
|
|
46
|
-
version?: PEVersion;
|
|
47
|
-
error?: string;
|
|
48
|
-
}
|
|
49
|
-
export type IPEXPresentationSignCallback = (args: IPEXPresentationSignCallBackParams) => Promise<W3CVerifiablePresentation>;
|
|
50
|
-
export interface IPEXPresentationSignCallBackParams {
|
|
51
|
-
presentation: IPresentation | Optional<PresentationPayload, 'holder'> | SdJwtDecodedVerifiableCredential;
|
|
52
|
-
presentationDefinition: IPresentationDefinition;
|
|
53
|
-
}
|
|
54
|
-
export type IRequiredContext = IAgentContext<IDataStoreORM & IResolver & IDIDManager & IIdentifierResolution & ICredentialPlugin & ISDJwtPlugin>;
|
|
55
|
-
//# sourceMappingURL=IPresentationExchange.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IPresentationExchange.d.ts","sourceRoot":"","sources":["../../src/types/IPresentationExchange.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAA;AACnF,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,SAAS,EACT,mBAAmB,EACpB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,gCAAgC,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AACnJ,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AACjF,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACnF,OAAO,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAA;AACxF,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEvD,MAAM,WAAW,qBAAsB,SAAQ,gBAAgB;IAC7D,qBAAqB,CAAC,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAEtE,oBAAoB,CAAC,sBAAsB,EAAE,uBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAA;IAEtG,8BAA8B,CAAC,IAAI,EAAE,+BAA+B,EAAE,OAAO,EAA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