@credo-ts/openid4vc 0.6.1-pr-2091-20241119140918 → 0.6.1
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/build/OpenId4VcApi.d.mts +24 -0
- package/build/OpenId4VcApi.d.mts.map +1 -0
- package/build/OpenId4VcApi.mjs +35 -0
- package/build/OpenId4VcApi.mjs.map +1 -0
- package/build/OpenId4VcModule.d.mts +30 -0
- package/build/OpenId4VcModule.d.mts.map +1 -0
- package/build/OpenId4VcModule.mjs +42 -0
- package/build/OpenId4VcModule.mjs.map +1 -0
- package/build/OpenId4VcModuleConfig.d.mts +44 -0
- package/build/OpenId4VcModuleConfig.d.mts.map +1 -0
- package/build/OpenId4VcModuleConfig.mjs +24 -0
- package/build/OpenId4VcModuleConfig.mjs.map +1 -0
- package/build/_virtual/_@oxc-project_runtime@0.99.0/helpers/decorate.mjs +10 -0
- package/build/_virtual/_@oxc-project_runtime@0.99.0/helpers/decorateMetadata.mjs +7 -0
- package/build/_virtual/_@oxc-project_runtime@0.99.0/helpers/decorateParam.mjs +9 -0
- package/build/index.d.mts +42 -0
- package/build/index.mjs +37 -0
- package/build/openid4vc-holder/OpenId4VcHolderApi.d.mts +238 -0
- package/build/openid4vc-holder/OpenId4VcHolderApi.d.mts.map +1 -0
- package/build/openid4vc-holder/OpenId4VcHolderApi.mjs +174 -0
- package/build/openid4vc-holder/OpenId4VcHolderApi.mjs.map +1 -0
- package/build/openid4vc-holder/OpenId4VcHolderModule.d.mts +17 -0
- package/build/openid4vc-holder/OpenId4VcHolderModule.d.mts.map +1 -0
- package/build/openid4vc-holder/OpenId4VcHolderModule.mjs +23 -0
- package/build/openid4vc-holder/OpenId4VcHolderModule.mjs.map +1 -0
- package/build/openid4vc-holder/OpenId4VciHolderService.d.mts +69 -0
- package/build/openid4vc-holder/OpenId4VciHolderService.d.mts.map +1 -0
- package/build/openid4vc-holder/OpenId4VciHolderService.mjs +751 -0
- package/build/openid4vc-holder/OpenId4VciHolderService.mjs.map +1 -0
- package/build/openid4vc-holder/OpenId4VciHolderServiceOptions.d.mts +398 -0
- package/build/openid4vc-holder/OpenId4VciHolderServiceOptions.d.mts.map +1 -0
- package/build/openid4vc-holder/OpenId4VciHolderServiceOptions.mjs +16 -0
- package/build/openid4vc-holder/OpenId4VciHolderServiceOptions.mjs.map +1 -0
- package/build/openid4vc-holder/OpenId4vpHolderService.d.mts +130 -0
- package/build/openid4vc-holder/OpenId4vpHolderService.d.mts.map +1 -0
- package/build/openid4vc-holder/OpenId4vpHolderService.mjs +278 -0
- package/build/openid4vc-holder/OpenId4vpHolderService.mjs.map +1 -0
- package/build/openid4vc-holder/OpenId4vpHolderServiceOptions.d.mts +112 -0
- package/build/openid4vc-holder/OpenId4vpHolderServiceOptions.d.mts.map +1 -0
- package/build/openid4vc-holder/index.d.mts +6 -0
- package/build/openid4vc-holder/index.mjs +5 -0
- package/build/openid4vc-issuer/OpenId4VcIssuanceSessionState.d.mts +16 -0
- package/build/openid4vc-issuer/OpenId4VcIssuanceSessionState.d.mts.map +1 -0
- package/build/openid4vc-issuer/OpenId4VcIssuanceSessionState.mjs +18 -0
- package/build/openid4vc-issuer/OpenId4VcIssuanceSessionState.mjs.map +1 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerApi.d.mts +137 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerApi.d.mts.map +1 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerApi.mjs +108 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerApi.mjs.map +1 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerEvents.d.mts +19 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerEvents.d.mts.map +1 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerEvents.mjs +9 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerEvents.mjs.map +1 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerModule.d.mts +27 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerModule.d.mts.map +1 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerModule.mjs +150 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerModule.mjs.map +1 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.d.mts +279 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.d.mts.map +1 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.mjs +179 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.mjs.map +1 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerService.d.mts +182 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerService.d.mts.map +1 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerService.mjs +881 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerService.mjs.map +1 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerServiceOptions.d.mts +340 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerServiceOptions.d.mts.map +1 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerServiceOptions.mjs +1 -0
- package/build/openid4vc-issuer/index.d.mts +11 -0
- package/build/openid4vc-issuer/index.mjs +11 -0
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRecord.d.mts +300 -0
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRecord.d.mts.map +1 -0
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRecord.mjs +102 -0
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRecord.mjs.map +1 -0
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRepository.d.mts +10 -0
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRepository.d.mts.map +1 -0
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRepository.mjs +22 -0
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRepository.mjs.map +1 -0
- package/build/openid4vc-issuer/repository/OpenId4VcIssuerRecord.d.mts +84 -0
- package/build/openid4vc-issuer/repository/OpenId4VcIssuerRecord.d.mts.map +1 -0
- package/build/openid4vc-issuer/repository/OpenId4VcIssuerRecord.mjs +89 -0
- package/build/openid4vc-issuer/repository/OpenId4VcIssuerRecord.mjs.map +1 -0
- package/build/openid4vc-issuer/repository/OpenId4VcIssuerRepository.d.mts +12 -0
- package/build/openid4vc-issuer/repository/OpenId4VcIssuerRepository.d.mts.map +1 -0
- package/build/openid4vc-issuer/repository/OpenId4VcIssuerRepository.mjs +28 -0
- package/build/openid4vc-issuer/repository/OpenId4VcIssuerRepository.mjs.map +1 -0
- package/build/openid4vc-issuer/repository/index.d.mts +4 -0
- package/build/openid4vc-issuer/repository/index.mjs +4 -0
- package/build/openid4vc-issuer/router/accessTokenEndpoint.mjs +199 -0
- package/build/openid4vc-issuer/router/accessTokenEndpoint.mjs.map +1 -0
- package/build/openid4vc-issuer/router/authorizationChallengeEndpoint.mjs +241 -0
- package/build/openid4vc-issuer/router/authorizationChallengeEndpoint.mjs.map +1 -0
- package/build/openid4vc-issuer/router/authorizationEndpoint.mjs +51 -0
- package/build/openid4vc-issuer/router/authorizationEndpoint.mjs.map +1 -0
- package/build/openid4vc-issuer/router/authorizationServerMetadataEndpoint.mjs +25 -0
- package/build/openid4vc-issuer/router/authorizationServerMetadataEndpoint.mjs.map +1 -0
- package/build/openid4vc-issuer/router/credentialEndpoint.mjs +142 -0
- package/build/openid4vc-issuer/router/credentialEndpoint.mjs.map +1 -0
- package/build/openid4vc-issuer/router/credentialOfferEndpoint.mjs +38 -0
- package/build/openid4vc-issuer/router/credentialOfferEndpoint.mjs.map +1 -0
- package/build/openid4vc-issuer/router/deferredCredentialEndpoint.mjs +84 -0
- package/build/openid4vc-issuer/router/deferredCredentialEndpoint.mjs.map +1 -0
- package/build/openid4vc-issuer/router/index.mjs +12 -0
- package/build/openid4vc-issuer/router/issuerMetadataEndpoint.mjs +43 -0
- package/build/openid4vc-issuer/router/issuerMetadataEndpoint.mjs.map +1 -0
- package/build/openid4vc-issuer/router/jwksEndpoint.mjs +18 -0
- package/build/openid4vc-issuer/router/jwksEndpoint.mjs.map +1 -0
- package/build/openid4vc-issuer/router/nonceEndpoint.mjs +29 -0
- package/build/openid4vc-issuer/router/nonceEndpoint.mjs.map +1 -0
- package/build/openid4vc-issuer/router/pushedAuthorizationRequestEndpoint.mjs +164 -0
- package/build/openid4vc-issuer/router/pushedAuthorizationRequestEndpoint.mjs.map +1 -0
- package/build/openid4vc-issuer/router/redirectEndpoint.mjs +124 -0
- package/build/openid4vc-issuer/router/redirectEndpoint.mjs.map +1 -0
- package/build/openid4vc-issuer/util/txCode.mjs +18 -0
- package/build/openid4vc-issuer/util/txCode.mjs.map +1 -0
- package/build/openid4vc-verifier/OpenId4VcVerificationSessionState.d.mts +10 -0
- package/build/openid4vc-verifier/OpenId4VcVerificationSessionState.d.mts.map +1 -0
- package/build/openid4vc-verifier/OpenId4VcVerificationSessionState.mjs +12 -0
- package/build/openid4vc-verifier/OpenId4VcVerificationSessionState.mjs.map +1 -0
- package/build/openid4vc-verifier/OpenId4VcVerifierApi.d.mts +60 -0
- package/build/openid4vc-verifier/OpenId4VcVerifierApi.d.mts.map +1 -0
- package/build/openid4vc-verifier/OpenId4VcVerifierApi.mjs +83 -0
- package/build/openid4vc-verifier/OpenId4VcVerifierApi.mjs.map +1 -0
- package/build/openid4vc-verifier/OpenId4VcVerifierEvents.d.mts +19 -0
- package/build/openid4vc-verifier/OpenId4VcVerifierEvents.d.mts.map +1 -0
- package/build/openid4vc-verifier/OpenId4VcVerifierEvents.mjs +9 -0
- package/build/openid4vc-verifier/OpenId4VcVerifierEvents.mjs.map +1 -0
- package/build/openid4vc-verifier/OpenId4VcVerifierModule.d.mts +25 -0
- package/build/openid4vc-verifier/OpenId4VcVerifierModule.d.mts.map +1 -0
- package/build/openid4vc-verifier/OpenId4VcVerifierModule.mjs +91 -0
- package/build/openid4vc-verifier/OpenId4VcVerifierModule.mjs.map +1 -0
- package/build/openid4vc-verifier/OpenId4VcVerifierModuleConfig.d.mts +55 -0
- package/build/openid4vc-verifier/OpenId4VcVerifierModuleConfig.d.mts.map +1 -0
- package/build/openid4vc-verifier/OpenId4VcVerifierModuleConfig.mjs +36 -0
- package/build/openid4vc-verifier/OpenId4VcVerifierModuleConfig.mjs.map +1 -0
- package/build/openid4vc-verifier/OpenId4VpVerifierService.d.mts +60 -0
- package/build/openid4vc-verifier/OpenId4VpVerifierService.d.mts.map +1 -0
- package/build/openid4vc-verifier/OpenId4VpVerifierService.mjs +714 -0
- package/build/openid4vc-verifier/OpenId4VpVerifierService.mjs.map +1 -0
- package/build/openid4vc-verifier/OpenId4VpVerifierServiceOptions.d.mts +194 -0
- package/build/openid4vc-verifier/OpenId4VpVerifierServiceOptions.d.mts.map +1 -0
- package/build/openid4vc-verifier/index.d.mts +12 -0
- package/build/openid4vc-verifier/index.mjs +11 -0
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRecord.d.mts +129 -0
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRecord.d.mts.map +1 -0
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRecord.mjs +64 -0
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRecord.mjs.map +1 -0
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRepository.d.mts +10 -0
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRepository.d.mts.map +1 -0
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRepository.mjs +22 -0
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRepository.mjs.map +1 -0
- package/build/openid4vc-verifier/repository/OpenId4VcVerifierRecord.d.mts +33 -0
- package/build/openid4vc-verifier/repository/OpenId4VcVerifierRecord.d.mts.map +1 -0
- package/build/openid4vc-verifier/repository/OpenId4VcVerifierRecord.mjs +32 -0
- package/build/openid4vc-verifier/repository/OpenId4VcVerifierRecord.mjs.map +1 -0
- package/build/openid4vc-verifier/repository/OpenId4VcVerifierRepository.d.mts +12 -0
- package/build/openid4vc-verifier/repository/OpenId4VcVerifierRepository.d.mts.map +1 -0
- package/build/openid4vc-verifier/repository/OpenId4VcVerifierRepository.mjs +28 -0
- package/build/openid4vc-verifier/repository/OpenId4VcVerifierRepository.mjs.map +1 -0
- package/build/openid4vc-verifier/repository/index.d.mts +4 -0
- package/build/openid4vc-verifier/repository/index.mjs +4 -0
- package/build/openid4vc-verifier/router/authorizationEndpoint.mjs +117 -0
- package/build/openid4vc-verifier/router/authorizationEndpoint.mjs.map +1 -0
- package/build/openid4vc-verifier/router/authorizationRequestEndpoint.mjs +39 -0
- package/build/openid4vc-verifier/router/authorizationRequestEndpoint.mjs.map +1 -0
- package/build/openid4vc-verifier/router/index.mjs +1 -0
- package/build/shared/callbacks.d.mts +47 -0
- package/build/shared/callbacks.d.mts.map +1 -0
- package/build/shared/callbacks.mjs +279 -0
- package/build/shared/callbacks.mjs.map +1 -0
- package/build/shared/index.d.mts +7 -0
- package/build/shared/index.mjs +4 -0
- package/build/shared/issuerMetadataUtils.d.mts +22 -0
- package/build/shared/issuerMetadataUtils.d.mts.map +1 -0
- package/build/shared/issuerMetadataUtils.mjs +30 -0
- package/build/shared/issuerMetadataUtils.mjs.map +1 -0
- package/build/shared/models/CredentialHolderBinding.d.mts +71 -0
- package/build/shared/models/CredentialHolderBinding.d.mts.map +1 -0
- package/build/shared/models/CredentialHolderBinding.mjs +1 -0
- package/build/shared/models/OpenId4VcJwtIssuer.d.mts +46 -0
- package/build/shared/models/OpenId4VcJwtIssuer.d.mts.map +1 -0
- package/build/shared/models/OpenId4VcJwtIssuer.mjs +1 -0
- package/build/shared/models/OpenId4VciAuthorizationServerConfig.d.mts +71 -0
- package/build/shared/models/OpenId4VciAuthorizationServerConfig.d.mts.map +1 -0
- package/build/shared/models/OpenId4VciCredentialFormatProfile.d.mts +12 -0
- package/build/shared/models/OpenId4VciCredentialFormatProfile.d.mts.map +1 -0
- package/build/shared/models/OpenId4VciCredentialFormatProfile.mjs +14 -0
- package/build/shared/models/OpenId4VciCredentialFormatProfile.mjs.map +1 -0
- package/build/shared/models/index.d.mts +30 -0
- package/build/shared/models/index.d.mts.map +1 -0
- package/build/shared/models/index.mjs +6 -0
- package/build/shared/router/context.mjs +52 -0
- package/build/shared/router/context.mjs.map +1 -0
- package/build/shared/router/express.browser.d.mts +5 -0
- package/build/shared/router/express.browser.d.mts.map +1 -0
- package/build/shared/router/express.browser.mjs +8 -0
- package/build/shared/router/express.browser.mjs.map +1 -0
- package/build/shared/router/express.mjs +10 -0
- package/build/shared/router/express.mjs.map +1 -0
- package/build/shared/router/express.native.d.mts +5 -0
- package/build/shared/router/express.native.d.mts.map +1 -0
- package/build/shared/router/express.native.mjs +8 -0
- package/build/shared/router/express.native.mjs.map +1 -0
- package/build/shared/router/index.mjs +3 -0
- package/build/shared/router/tenants.mjs +36 -0
- package/build/shared/router/tenants.mjs.map +1 -0
- package/build/shared/transactionData.mjs +19 -0
- package/build/shared/transactionData.mjs.map +1 -0
- package/build/shared/utils.mjs +90 -0
- package/build/shared/utils.mjs.map +1 -0
- package/package.json +30 -23
- package/build/index.d.ts +0 -4
- package/build/index.js +0 -21
- package/build/index.js.map +0 -1
- package/build/openid4vc-holder/OpenId4VcHolderApi.d.ts +0 -124
- package/build/openid4vc-holder/OpenId4VcHolderApi.js +0 -155
- package/build/openid4vc-holder/OpenId4VcHolderApi.js.map +0 -1
- package/build/openid4vc-holder/OpenId4VcHolderModule.d.ts +0 -13
- package/build/openid4vc-holder/OpenId4VcHolderModule.js +0 -35
- package/build/openid4vc-holder/OpenId4VcHolderModule.js.map +0 -1
- package/build/openid4vc-holder/OpenId4VciHolderService.d.ts +0 -72
- package/build/openid4vc-holder/OpenId4VciHolderService.js +0 -569
- package/build/openid4vc-holder/OpenId4VciHolderService.js.map +0 -1
- package/build/openid4vc-holder/OpenId4VciHolderServiceOptions.d.ts +0 -238
- package/build/openid4vc-holder/OpenId4VciHolderServiceOptions.js +0 -14
- package/build/openid4vc-holder/OpenId4VciHolderServiceOptions.js.map +0 -1
- package/build/openid4vc-holder/OpenId4vcSiopHolderService.d.ts +0 -32
- package/build/openid4vc-holder/OpenId4vcSiopHolderService.js +0 -302
- package/build/openid4vc-holder/OpenId4vcSiopHolderService.js.map +0 -1
- package/build/openid4vc-holder/OpenId4vcSiopHolderServiceOptions.d.ts +0 -38
- package/build/openid4vc-holder/OpenId4vcSiopHolderServiceOptions.js +0 -3
- package/build/openid4vc-holder/OpenId4vcSiopHolderServiceOptions.js.map +0 -1
- package/build/openid4vc-holder/index.d.ts +0 -6
- package/build/openid4vc-holder/index.js +0 -23
- package/build/openid4vc-holder/index.js.map +0 -1
- package/build/openid4vc-issuer/OpenId4VcIssuanceSessionState.d.ts +0 -12
- package/build/openid4vc-issuer/OpenId4VcIssuanceSessionState.js +0 -19
- package/build/openid4vc-issuer/OpenId4VcIssuanceSessionState.js.map +0 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerApi.d.ts +0 -101
- package/build/openid4vc-issuer/OpenId4VcIssuerApi.js +0 -110
- package/build/openid4vc-issuer/OpenId4VcIssuerApi.js.map +0 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerEvents.d.ts +0 -13
- package/build/openid4vc-issuer/OpenId4VcIssuerEvents.js +0 -8
- package/build/openid4vc-issuer/OpenId4VcIssuerEvents.js.map +0 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerModule.d.ts +0 -21
- package/build/openid4vc-issuer/OpenId4VcIssuerModule.js +0 -121
- package/build/openid4vc-issuer/OpenId4VcIssuerModule.js.map +0 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.d.ts +0 -190
- package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.js +0 -141
- package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.js.map +0 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerService.d.ts +0 -116
- package/build/openid4vc-issuer/OpenId4VcIssuerService.js +0 -698
- package/build/openid4vc-issuer/OpenId4VcIssuerService.js.map +0 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerServiceOptions.d.ts +0 -229
- package/build/openid4vc-issuer/OpenId4VcIssuerServiceOptions.js +0 -3
- package/build/openid4vc-issuer/OpenId4VcIssuerServiceOptions.js.map +0 -1
- package/build/openid4vc-issuer/index.d.ts +0 -8
- package/build/openid4vc-issuer/index.js +0 -27
- package/build/openid4vc-issuer/index.js.map +0 -1
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRecord.d.ts +0 -160
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRecord.js +0 -88
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRecord.js.map +0 -1
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRepository.d.ts +0 -5
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRepository.js +0 -29
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRepository.js.map +0 -1
- package/build/openid4vc-issuer/repository/OpenId4VcIssuerRecord.d.ts +0 -56
- package/build/openid4vc-issuer/repository/OpenId4VcIssuerRecord.js +0 -83
- package/build/openid4vc-issuer/repository/OpenId4VcIssuerRecord.js.map +0 -1
- package/build/openid4vc-issuer/repository/OpenId4VcIssuerRepository.d.ts +0 -8
- package/build/openid4vc-issuer/repository/OpenId4VcIssuerRepository.js +0 -35
- package/build/openid4vc-issuer/repository/OpenId4VcIssuerRepository.js.map +0 -1
- package/build/openid4vc-issuer/repository/index.d.ts +0 -4
- package/build/openid4vc-issuer/repository/index.js +0 -21
- package/build/openid4vc-issuer/repository/index.js.map +0 -1
- package/build/openid4vc-issuer/router/accessTokenEndpoint.d.ts +0 -5
- package/build/openid4vc-issuer/router/accessTokenEndpoint.js +0 -164
- package/build/openid4vc-issuer/router/accessTokenEndpoint.js.map +0 -1
- package/build/openid4vc-issuer/router/authorizationChallengeEndpoint.d.ts +0 -3
- package/build/openid4vc-issuer/router/authorizationChallengeEndpoint.js +0 -213
- package/build/openid4vc-issuer/router/authorizationChallengeEndpoint.js.map +0 -1
- package/build/openid4vc-issuer/router/authorizationServerMetadataEndpoint.d.ts +0 -6
- package/build/openid4vc-issuer/router/authorizationServerMetadataEndpoint.js +0 -25
- package/build/openid4vc-issuer/router/authorizationServerMetadataEndpoint.js.map +0 -1
- package/build/openid4vc-issuer/router/credentialEndpoint.d.ts +0 -3
- package/build/openid4vc-issuer/router/credentialEndpoint.js +0 -176
- package/build/openid4vc-issuer/router/credentialEndpoint.js.map +0 -1
- package/build/openid4vc-issuer/router/credentialOfferEndpoint.d.ts +0 -3
- package/build/openid4vc-issuer/router/credentialOfferEndpoint.js +0 -45
- package/build/openid4vc-issuer/router/credentialOfferEndpoint.js.map +0 -1
- package/build/openid4vc-issuer/router/index.d.ts +0 -9
- package/build/openid4vc-issuer/router/index.js +0 -20
- package/build/openid4vc-issuer/router/index.js.map +0 -1
- package/build/openid4vc-issuer/router/issuerMetadataEndpoint.d.ts +0 -2
- package/build/openid4vc-issuer/router/issuerMetadataEndpoint.js +0 -26
- package/build/openid4vc-issuer/router/issuerMetadataEndpoint.js.map +0 -1
- package/build/openid4vc-issuer/router/jwksEndpoint.d.ts +0 -3
- package/build/openid4vc-issuer/router/jwksEndpoint.js +0 -20
- package/build/openid4vc-issuer/router/jwksEndpoint.js.map +0 -1
- package/build/openid4vc-issuer/router/nonceEndpoint.d.ts +0 -3
- package/build/openid4vc-issuer/router/nonceEndpoint.js +0 -26
- package/build/openid4vc-issuer/router/nonceEndpoint.js.map +0 -1
- package/build/openid4vc-issuer/router/requestContext.d.ts +0 -5
- package/build/openid4vc-issuer/router/requestContext.js +0 -3
- package/build/openid4vc-issuer/router/requestContext.js.map +0 -1
- package/build/openid4vc-issuer/util/txCode.d.ts +0 -3
- package/build/openid4vc-issuer/util/txCode.js +0 -18
- package/build/openid4vc-issuer/util/txCode.js.map +0 -1
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.d.ts +0 -55
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.js +0 -498
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.js.map +0 -1
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierServiceOptions.d.ts +0 -77
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierServiceOptions.js +0 -3
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierServiceOptions.js.map +0 -1
- package/build/openid4vc-verifier/OpenId4VcVerificationSessionState.d.ts +0 -6
- package/build/openid4vc-verifier/OpenId4VcVerificationSessionState.js +0 -11
- package/build/openid4vc-verifier/OpenId4VcVerificationSessionState.js.map +0 -1
- package/build/openid4vc-verifier/OpenId4VcVerifierApi.d.ts +0 -61
- package/build/openid4vc-verifier/OpenId4VcVerifierApi.js +0 -108
- package/build/openid4vc-verifier/OpenId4VcVerifierApi.js.map +0 -1
- package/build/openid4vc-verifier/OpenId4VcVerifierEvents.d.ts +0 -13
- package/build/openid4vc-verifier/OpenId4VcVerifierEvents.js +0 -8
- package/build/openid4vc-verifier/OpenId4VcVerifierEvents.js.map +0 -1
- package/build/openid4vc-verifier/OpenId4VcVerifierModule.d.ts +0 -21
- package/build/openid4vc-verifier/OpenId4VcVerifierModule.js +0 -109
- package/build/openid4vc-verifier/OpenId4VcVerifierModule.js.map +0 -1
- package/build/openid4vc-verifier/OpenId4VcVerifierModuleConfig.d.ts +0 -31
- package/build/openid4vc-verifier/OpenId4VcVerifierModuleConfig.js +0 -28
- package/build/openid4vc-verifier/OpenId4VcVerifierModuleConfig.js.map +0 -1
- package/build/openid4vc-verifier/index.d.ts +0 -8
- package/build/openid4vc-verifier/index.js +0 -25
- package/build/openid4vc-verifier/index.js.map +0 -1
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartyEventEmitter.d.ts +0 -49
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartyEventEmitter.js +0 -234
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartyEventEmitter.js.map +0 -1
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartySessionManager.d.ts +0 -19
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartySessionManager.js +0 -146
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartySessionManager.js.map +0 -1
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRecord.d.ts +0 -71
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRecord.js +0 -46
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRecord.js.map +0 -1
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRepository.d.ts +0 -5
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRepository.js +0 -29
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRepository.js.map +0 -1
- package/build/openid4vc-verifier/repository/OpenId4VcVerifierRecord.d.ts +0 -29
- package/build/openid4vc-verifier/repository/OpenId4VcVerifierRecord.js +0 -29
- package/build/openid4vc-verifier/repository/OpenId4VcVerifierRecord.js.map +0 -1
- package/build/openid4vc-verifier/repository/OpenId4VcVerifierRepository.d.ts +0 -8
- package/build/openid4vc-verifier/repository/OpenId4VcVerifierRepository.js +0 -35
- package/build/openid4vc-verifier/repository/OpenId4VcVerifierRepository.js.map +0 -1
- package/build/openid4vc-verifier/repository/index.d.ts +0 -4
- package/build/openid4vc-verifier/repository/index.js +0 -21
- package/build/openid4vc-verifier/repository/index.js.map +0 -1
- package/build/openid4vc-verifier/router/authorizationEndpoint.d.ts +0 -11
- package/build/openid4vc-verifier/router/authorizationEndpoint.js +0 -102
- package/build/openid4vc-verifier/router/authorizationEndpoint.js.map +0 -1
- package/build/openid4vc-verifier/router/authorizationRequestEndpoint.d.ts +0 -11
- package/build/openid4vc-verifier/router/authorizationRequestEndpoint.js +0 -63
- package/build/openid4vc-verifier/router/authorizationRequestEndpoint.js.map +0 -1
- package/build/openid4vc-verifier/router/index.d.ts +0 -2
- package/build/openid4vc-verifier/router/index.js +0 -6
- package/build/openid4vc-verifier/router/index.js.map +0 -1
- package/build/openid4vc-verifier/router/requestContext.d.ts +0 -5
- package/build/openid4vc-verifier/router/requestContext.js +0 -3
- package/build/openid4vc-verifier/router/requestContext.js.map +0 -1
- package/build/shared/callbacks.d.ts +0 -18
- package/build/shared/callbacks.js +0 -81
- package/build/shared/callbacks.js.map +0 -1
- package/build/shared/index.d.ts +0 -2
- package/build/shared/index.js +0 -19
- package/build/shared/index.js.map +0 -1
- package/build/shared/issuerMetadataUtils.d.ts +0 -158
- package/build/shared/issuerMetadataUtils.js +0 -38
- package/build/shared/issuerMetadataUtils.js.map +0 -1
- package/build/shared/models/CredentialHolderBinding.d.ts +0 -13
- package/build/shared/models/CredentialHolderBinding.js +0 -3
- package/build/shared/models/CredentialHolderBinding.js.map +0 -1
- package/build/shared/models/OpenId4VcJwtIssuer.d.ts +0 -28
- package/build/shared/models/OpenId4VcJwtIssuer.js +0 -3
- package/build/shared/models/OpenId4VcJwtIssuer.js.map +0 -1
- package/build/shared/models/OpenId4VciAuthorizationServerConfig.d.ts +0 -10
- package/build/shared/models/OpenId4VciAuthorizationServerConfig.js +0 -3
- package/build/shared/models/OpenId4VciAuthorizationServerConfig.js.map +0 -1
- package/build/shared/models/OpenId4VciCredentialFormatProfile.d.ts +0 -7
- package/build/shared/models/OpenId4VciCredentialFormatProfile.js +0 -12
- package/build/shared/models/OpenId4VciCredentialFormatProfile.js.map +0 -1
- package/build/shared/models/index.d.ts +0 -24
- package/build/shared/models/index.js +0 -25
- package/build/shared/models/index.js.map +0 -1
- package/build/shared/router/context.d.ts +0 -17
- package/build/shared/router/context.js +0 -76
- package/build/shared/router/context.js.map +0 -1
- package/build/shared/router/express.d.ts +0 -2
- package/build/shared/router/express.js +0 -15
- package/build/shared/router/express.js.map +0 -1
- package/build/shared/router/express.native.d.ts +0 -1
- package/build/shared/router/express.native.js +0 -7
- package/build/shared/router/express.native.js.map +0 -1
- package/build/shared/router/index.d.ts +0 -3
- package/build/shared/router/index.js +0 -20
- package/build/shared/router/index.js.map +0 -1
- package/build/shared/router/tenants.d.ts +0 -13
- package/build/shared/router/tenants.js +0 -49
- package/build/shared/router/tenants.js.map +0 -1
- package/build/shared/transform.d.ts +0 -5
- package/build/shared/transform.js +0 -73
- package/build/shared/transform.js.map +0 -1
- package/build/shared/utils.d.ts +0 -22
- package/build/shared/utils.js +0 -154
- package/build/shared/utils.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenId4VciHolderServiceOptions.mjs","names":["openId4VciSupportedCredentialFormats: OpenId4VciSupportedCredentialFormats[]"],"sources":["../../src/openid4vc-holder/OpenId4VciHolderServiceOptions.ts"],"sourcesContent":["import type {\n AgentContext,\n Kms,\n MdocRecord,\n SdJwtVcRecord,\n W3cCredentialRecord,\n W3cV2CredentialRecord,\n} from '@credo-ts/core'\nimport type { CredentialOfferObject, IssuerMetadataResult } from '@openid4vc/openid4vci'\nimport { AuthorizationFlow as OpenId4VciAuthorizationFlow } from '@openid4vc/openid4vci'\nimport type {\n OpenId4VcCredentialHolderBinding,\n OpenId4VciAccessTokenResponse,\n OpenId4VciCredentialConfigurationSupportedWithFormats,\n OpenId4VciCredentialConfigurationsSupportedWithFormats,\n OpenId4VciMetadata,\n} from '../shared'\nimport { OpenId4VciCredentialFormatProfile } from '../shared/models/OpenId4VciCredentialFormatProfile'\n\nexport { OpenId4VciAuthorizationFlow }\n\nexport type OpenId4VciSupportedCredentialFormats =\n | OpenId4VciCredentialFormatProfile.JwtVcJson\n | OpenId4VciCredentialFormatProfile.JwtVcJsonLd\n | OpenId4VciCredentialFormatProfile.SdJwtVc\n | OpenId4VciCredentialFormatProfile.SdJwtDc\n | OpenId4VciCredentialFormatProfile.LdpVc\n | OpenId4VciCredentialFormatProfile.MsoMdoc\n\nexport const openId4VciSupportedCredentialFormats: OpenId4VciSupportedCredentialFormats[] = [\n OpenId4VciCredentialFormatProfile.JwtVcJson,\n OpenId4VciCredentialFormatProfile.JwtVcJsonLd,\n OpenId4VciCredentialFormatProfile.SdJwtVc,\n OpenId4VciCredentialFormatProfile.SdJwtDc,\n OpenId4VciCredentialFormatProfile.LdpVc,\n OpenId4VciCredentialFormatProfile.MsoMdoc,\n]\n\nexport interface OpenId4VciDpopRequestOptions {\n jwk: Kms.PublicJwk\n alg: Kms.KnownJwaSignatureAlgorithm\n nonce?: string\n}\n\n/**\n * 'credential_accepted' The Credential was successfully stored in the Wallet.\n * 'credential_deleted' when the unsuccessful Credential issuance was caused by a user action.\n * 'credential_failure' otherwise.\n */\nexport type OpenId4VciNotificationEvent = 'credential_accepted' | 'credential_failure' | 'credential_deleted'\n\nexport type OpenId4VciRequestTokenResponse = {\n accessToken: string\n refreshToken?: string\n cNonce?: string\n dpop?: OpenId4VciDpopRequestOptions\n authorizationServer?: string\n\n accessTokenResponse: OpenId4VciAccessTokenResponse\n}\n\nexport interface OpenId4VciCredentialResponse {\n credentialConfigurationId: string\n credentialConfiguration: OpenId4VciCredentialConfigurationSupportedWithFormats\n\n /**\n * The record containing the credentials returned in the OpenID4VCI credential response\n *\n * The credential is returned as a record, which can be provided to the\n * respective `store()` method of each credential-specific API.\n *\n * The record contains the credential instance (instances in case of batch issuance)\n * along with metadata such as the VCT Type Metadata (in case of SD-JWT)\n */\n record: SdJwtVcRecord | MdocRecord | W3cCredentialRecord | W3cV2CredentialRecord\n\n notificationId?: string\n}\n\nexport interface OpenId4VciDeferredCredentialResponse {\n credentialConfigurationId: string\n credentialConfiguration: OpenId4VciCredentialConfigurationSupportedWithFormats\n transactionId: string\n interval?: number\n notificationId?: string\n /**\n * Mapping from JWK thumbprint values to KMS key ids that were submitted in the credential request.\n * These should be used when retrieving the deferred credentials, to store the associated kms key id\n * for each received credential.\n */\n jwkThumbprintKmsKeyIdMapping?: Record<string, string>\n}\n\nexport interface OpenId4VciResolvedCredentialOffer {\n metadata: IssuerMetadataResult\n credentialOfferPayload: CredentialOfferObject\n\n /**\n * Offered credential configurations with known formats\n */\n offeredCredentialConfigurations: OpenId4VciCredentialConfigurationsSupportedWithFormats\n}\n\nexport type OpenId4VciResolvedAuthorizationRequest =\n | {\n openid4vpRequestUrl: string\n authorizationFlow: OpenId4VciAuthorizationFlow.PresentationDuringIssuance\n authSession: string\n\n /**\n * DPoP request options if DPoP was used for the authorization challenge request\n */\n dpop?: OpenId4VciDpopRequestOptions\n }\n | {\n authorizationRequestUrl: string\n authorizationFlow: OpenId4VciAuthorizationFlow.Oauth2Redirect\n codeVerifier?: string\n\n /**\n * DPoP request options if DPoP was used for the pushed authorization reuqest\n */\n dpop?: OpenId4VciDpopRequestOptions\n }\n\nexport interface OpenId4VciSendNotificationOptions {\n metadata: IssuerMetadataResult\n\n notificationId: string\n\n /**\n * The access token obtained through @see requestToken\n */\n accessToken: string\n\n /**\n * The notification event\n *\n * 'credential_accepted' The Credential was successfully stored in the Wallet.\n * 'credential_deleted' when the unsuccessful Credential issuance was caused by a user action.\n * 'credential_failure' otherwise.\n */\n notificationEvent: OpenId4VciNotificationEvent\n\n dpop?: OpenId4VciDpopRequestOptions\n}\n\nexport interface OpenId4VcAuthorizationCodeTokenRequestOptions {\n resolvedCredentialOffer: OpenId4VciResolvedCredentialOffer\n code: string\n clientId: string\n codeVerifier?: string\n redirectUri?: string\n\n txCode?: never\n\n /**\n * DPoP parameters to use in the request if supported by the authorization server.\n *\n * If DPoP was already used in the initiateAuthorization method, it should be provided\n * here as well and be bound to the same key.\n */\n dpop?: OpenId4VciDpopRequestOptions\n\n /**\n * The wallet attestation to send to the issuer. This will only be used\n * if client attestations are supported by the issuer, and should be provided\n * if wallet attestation was provided in the authorization request as well.\n *\n * A Proof of Possession will be created based on the wallet attestation,\n * so the key bound to the wallet attestation must be in the wallet.\n */\n walletAttestationJwt?: string\n}\n\n// TODO: support wallet attestation for pre-auth flow\nexport interface OpenId4VciPreAuthorizedTokenRequestOptions {\n resolvedCredentialOffer: OpenId4VciResolvedCredentialOffer\n txCode?: string\n\n code?: undefined\n\n /**\n * DPoP parameters to use in the request if supported by the authorization server.\n */\n dpop?: OpenId4VciDpopRequestOptions\n\n /**\n * The wallet attestation to send to the issuer. This will only be used\n * if client attestations are supported by the issuer.\n *\n * A Proof of Possession will be created based on the wallet attestation,\n * so the key bound to the wallet attestation must be in the wallet.\n */\n walletAttestationJwt?: string\n}\n\nexport type OpenId4VciTokenRequestOptions =\n | OpenId4VciPreAuthorizedTokenRequestOptions\n | OpenId4VcAuthorizationCodeTokenRequestOptions\n\nexport type OpenId4VciTokenRefreshOptions = {\n refreshToken: string\n\n /**\n * The issuer metadata.\n */\n issuerMetadata: IssuerMetadataResult\n\n /**\n * The authorization server where the refresh token was obtained from.\n */\n authorizationServer?: string\n\n /**\n * DPoP parameters to use in the request if supported by the authorization server.\n */\n dpop?: OpenId4VciDpopRequestOptions\n\n /**\n * The client id used for authorization. Only required if authorization_code flow was used.\n */\n clientId?: string\n\n /**\n * The wallet attestation to send to the issuer. This will only be used\n * if client attestations are supported by the issuer, and should be provided\n * if wallet attestation was provided in the authorization request as well.\n *\n * A Proof of Possession will be created based on the wallet attestation,\n * so the key bound to the wallet attestation must be in the wallet.\n */\n walletAttestationJwt?: string\n}\n\nexport interface OpenId4VciRetrieveAuthorizationCodeUsingPresentationOptions {\n resolvedCredentialOffer: OpenId4VciResolvedCredentialOffer\n dpop?: OpenId4VciDpopRequestOptions\n\n /**\n * The wallet attestation to send to the issuer. This will only be used\n * if client attestations are supported by the issuer, and should be provided\n * if wallet attestation was provided in the authorization request as well.\n *\n * A Proof of Possession will be created based on the wallet attestation,\n * so the key bound to the wallet attestation must be in the wallet.\n */\n walletAttestationJwt?: string\n\n /**\n * auth session returned at an earlier call to the authorization challenge endpoint\n */\n authSession: string\n\n /**\n * Presentation during issuance session returned by the verifier after submitting a valid presentation\n */\n presentationDuringIssuanceSession?: string\n}\n\nexport interface OpenId4VciCredentialRequestOptions extends Omit<OpenId4VciAcceptCredentialOfferOptions, 'userPin'> {\n resolvedCredentialOffer: OpenId4VciResolvedCredentialOffer\n accessToken: string\n cNonce?: string\n dpop?: OpenId4VciDpopRequestOptions\n\n /**\n * The client id used for authorization. Only required if authorization_code flow was used.\n */\n clientId?: string\n}\n\n/**\n * Options that are used to accept a credential offer for both the pre-authorized code flow and authorization code flow.\n * NOTE: Merge with @see OpenId4VciCredentialRequestOptions for 0.6\n */\nexport interface OpenId4VciAcceptCredentialOfferOptions {\n /**\n * This is the list of credentials configuration ids that will be requested from the issuer.\n * Should be a list of ids of the credentials that are included in the credential offer.\n * If not provided all offered credentials will be requested.\n */\n credentialConfigurationIds?: string[]\n\n verifyCredentialStatus?: boolean\n\n /**\n * A list of allowed proof of possession signature algorithms in order of preference.\n *\n * Note that the signature algorithms must be supported by the wallet implementation.\n * Signature algorithms that are not supported by the wallet will be ignored.\n *\n * The proof of possession (pop) signature algorithm is used in the credential request\n * to bind the credential to a did. In most cases the JWA signature algorithm\n * that is used in the pop will determine the cryptographic suite that is used\n * for signing the credential, but this not a requirement for the spec. E.g. if the\n * pop uses EdDsa, the credential will most commonly also use EdDsa, or Ed25519Signature2018/2020.\n */\n allowedProofOfPossessionSignatureAlgorithms?: Kms.KnownJwaSignatureAlgorithm[]\n\n /**\n * A function that should resolve key material for binding the to-be-issued credential\n * to the holder based on the options passed. This key material will be used for signing\n * the proof of possession included in the credential request.\n *\n * This method will be called once for each of the credentials that are included\n * in the credential offer.\n *\n * Based on the credential format, JWA signature algorithm, verification method types\n * and binding methods (did methods, jwk), the resolver must return an object\n * conformant to the `CredentialHolderBinding` interface, which will be used\n * for the proof of possession signature.\n */\n credentialBindingResolver: OpenId4VciCredentialBindingResolver\n}\n\n/**\n * Options to request deferred credentials from the issuer.\n */\nexport interface OpenId4VciDeferredCredentialRequestOptions {\n issuerMetadata: IssuerMetadataResult\n transactionId: string\n credentialConfigurationId: string\n credentialConfiguration: OpenId4VciCredentialConfigurationSupportedWithFormats\n verifyCredentialStatus?: boolean\n accessToken: string\n dpop?: OpenId4VciDpopRequestOptions\n\n /**\n * Mapping from JWK thumbprint values to KMS key ids that were submitted in the credential request.\n * These were returned in the deferred credential return value in case JWKs were used in the proof\n * of possession of the credential request\n */\n jwkThumbprintKmsKeyIdMapping?: Record<string, string>\n}\n\n/**\n * Options that are used for the authorization code flow.\n */\nexport interface OpenId4VciAuthCodeFlowOptions {\n clientId: string\n\n /**\n * The wallet attestation to send to the issuer. This will only be used\n * if client attestations and PAR are supported by the issuer.\n *\n * A Proof of Possesion will be created based on the wallet attestation,\n * so the key bound to the wallet attestation must be in the wallet.\n */\n walletAttestationJwt?: string\n\n redirectUri: string\n scope?: string[]\n}\n\nexport interface OpenId4VciCredentialBindingOptions {\n agentContext: AgentContext\n\n /**\n * The OpenID4VCI metadata, consisting of the draft version used,\n * the issuer metadatan and the authorization server metadata\n */\n metadata: OpenId4VciMetadata\n\n /**\n * The credential format that will be requested from the issuer.\n * E.g. `jwt_vc` or `ldp_vc`.\n */\n credentialFormat: OpenId4VciSupportedCredentialFormats\n\n /**\n * The max batch size as configured by the issuer. If the issuer has not indicated support for batch issuance\n * this will be `1`.\n */\n issuerMaxBatchSize: number\n\n /**\n * The proof types supported by the credential issuer that are also supported\n * by credo. Currently `jwt` and `attestation` are supported.\n *\n * Each proof type will list the supported algorithms, key types\n * and whether key attesations are required\n */\n proofTypes: OpenId4VciProofOfPressionProofTypes\n\n /**\n * The id of the credential configuration that will be requested from the issuer.\n */\n credentialConfigurationId: string\n\n /**\n * The credential configuration that will be requested from the issuer.\n */\n credentialConfiguration: OpenId4VciCredentialConfigurationSupportedWithFormats\n\n /**\n * Whether the issuer supports the `did` cryptographic binding method,\n * indicating they support all did methods. In most cases, they do not\n * support all did methods, and it means we have to make an assumption\n * about the did methods they support.\n *\n * If this value is `false`, the `supportedDidMethods` property will\n * contain a list of supported did methods.\n *\n * NOTE: when key attestations are required for a specific proof type, support for did method\n * binding is not supported at the moment, as there's no way to indicate which did the credential\n * should be bound to.\n * https://github.com/openid/OpenID4VCI/issues/475\n */\n supportsAllDidMethods: boolean\n\n /**\n * A list of supported did methods. This is only used if the `supportsAllDidMethods`\n * property is `false`. When this array is populated, the returned verification method\n * MUST be based on one of these did methods.\n *\n * The did methods are returned in the format `did:<method>`, e.g. `did:web`.\n *\n * The value is undefined in the case the supported did methods could not be extracted.\n * This is the case when the issuer didn't include the supported did methods in the issuer metadata.\n *\n * NOTE: an empty array (no did methods supported) has a different meaning from the value\n * being undefined (the supported did methods could not be extracted). If `supportsAllDidMethods`\n * is true, the value of this property MUST be ignored.\n *\n * NOTE: when key attestations are required for a specific proof type, support for did method\n * binding is not supported at the moment, as there's no way to indicate which did the credential\n * should be bound to.\n * https://github.com/openid/OpenID4VCI/issues/475\n */\n supportedDidMethods?: string[]\n\n /**\n * Whether the issuer supports the `jwk` cryptographic binding method,\n * indicating they support proof of possession signatures bound to a jwk.\n */\n supportsJwk: boolean\n\n /**\n * The cNonce that will be used for the credential request. May be used if dynamically creating a key attestation\n * that must include the cNonce.\n */\n cNonce: string\n}\n\n/**\n * The proof of possession verification method resolver is a function that can be passed by the\n * user of the framework and allows them to determine which verification method should be used\n * for the proof of possession signature.\n */\nexport type OpenId4VciCredentialBindingResolver = (\n options: OpenId4VciCredentialBindingOptions\n) => Promise<OpenId4VcCredentialHolderBinding> | OpenId4VcCredentialHolderBinding\n\nexport type OpenId4VciProofOfPressionProofTypes = Record<\n 'jwt' | 'attestation',\n | {\n /**\n * The JWA Signature Algorithm(s) that can be used in the proof of possession.\n * This is based on the `allowedProofOfPossessionSignatureAlgorithms` passed\n * to the request credential method, and the supported proof type signature\n * algorithms for the specific credential configuration\n */\n supportedSignatureAlgorithms: Kms.KnownJwaSignatureAlgorithm[]\n\n /**\n * Whether key attestations are required and which level needs to be met. If the object\n * is not defined, it can be interpreted that key attestations are not required.\n *\n * OpenID4VCI defined common levels in https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0.html#appendix-D.2, such as:\n * - `iso_18045_high`\n * - `iso_18045_moderate`\n * - `iso_18045_enhanced-basic`\n * - `iso_18045_basic`\n *\n * Other values may be defined and present as well. When key attestations are required you MUST return a key attestation.\n * If `userAuthentication` or `keyStorage` are defined you MUST return a key attestation that reaches the level as required\n * by the `keyStorage` and `userAuthentication` values.\n */\n keyAttestationsRequired?: {\n keyStorage?: string[]\n userAuthentication?: string[]\n }\n }\n | undefined\n>\n\n/**\n * @internal\n */\nexport interface OpenId4VciProofOfPossessionRequirements {\n proofTypes: OpenId4VciProofOfPressionProofTypes\n supportedDidMethods?: string[]\n supportsAllDidMethods: boolean\n supportsJwk: boolean\n}\n"],"mappings":";;;;AA6BA,MAAaA,uCAA+E;CAC1F,kCAAkC;CAClC,kCAAkC;CAClC,kCAAkC;CAClC,kCAAkC;CAClC,kCAAkC;CAClC,kCAAkC;CACnC"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { OpenId4VpAcceptAuthorizationRequestOptions, OpenId4VpResolvedAuthorizationRequest, ResolveOpenId4VpAuthorizationRequestOptions } from "./OpenId4vpHolderServiceOptions.mjs";
|
|
2
|
+
import { AgentContext, DcqlService, DifPresentationExchangeService, DifPresentationExchangeSubmission } from "@credo-ts/core";
|
|
3
|
+
|
|
4
|
+
//#region src/openid4vc-holder/OpenId4vpHolderService.d.ts
|
|
5
|
+
declare class OpenId4VpHolderService {
|
|
6
|
+
private presentationExchangeService;
|
|
7
|
+
private dcqlService;
|
|
8
|
+
constructor(presentationExchangeService: DifPresentationExchangeService, dcqlService: DcqlService);
|
|
9
|
+
private getOpenid4vpClient;
|
|
10
|
+
private handlePresentationExchangeRequest;
|
|
11
|
+
private handleDcqlRequest;
|
|
12
|
+
resolveAuthorizationRequest(agentContext: AgentContext,
|
|
13
|
+
/**
|
|
14
|
+
* Can be:
|
|
15
|
+
* - JWT
|
|
16
|
+
* - URI containing request or request_uri param
|
|
17
|
+
* - Request payload
|
|
18
|
+
*/
|
|
19
|
+
authorizationRequest: string | Record<string, unknown>, options?: ResolveOpenId4VpAuthorizationRequestOptions): Promise<OpenId4VpResolvedAuthorizationRequest>;
|
|
20
|
+
private extendCredentialsWithTransactionDataHashes;
|
|
21
|
+
acceptAuthorizationRequest(agentContext: AgentContext, options: OpenId4VpAcceptAuthorizationRequestOptions): Promise<{
|
|
22
|
+
readonly ok: true;
|
|
23
|
+
readonly authorizationResponse: ({
|
|
24
|
+
[x: string]: unknown;
|
|
25
|
+
vp_token: string | Record<string, any> | [string | Record<string, any>, ...(string | Record<string, any>)[]] | Record<string, string | Record<string, any> | [string | Record<string, any>, ...(string | Record<string, any>)[]]>;
|
|
26
|
+
state?: string | undefined;
|
|
27
|
+
id_token?: string | undefined;
|
|
28
|
+
presentation_submission?: any;
|
|
29
|
+
refresh_token?: string | undefined;
|
|
30
|
+
token_type?: string | undefined;
|
|
31
|
+
access_token?: string | undefined;
|
|
32
|
+
expires_in?: number | undefined;
|
|
33
|
+
} & {
|
|
34
|
+
presentation_submission?: DifPresentationExchangeSubmission;
|
|
35
|
+
}) | {
|
|
36
|
+
response: string;
|
|
37
|
+
};
|
|
38
|
+
readonly authorizationResponsePayload: {
|
|
39
|
+
[x: string]: unknown;
|
|
40
|
+
vp_token: string | Record<string, any> | [string | Record<string, any>, ...(string | Record<string, any>)[]] | Record<string, string | Record<string, any> | [string | Record<string, any>, ...(string | Record<string, any>)[]]>;
|
|
41
|
+
state?: string | undefined;
|
|
42
|
+
id_token?: string | undefined;
|
|
43
|
+
presentation_submission?: any;
|
|
44
|
+
refresh_token?: string | undefined;
|
|
45
|
+
token_type?: string | undefined;
|
|
46
|
+
access_token?: string | undefined;
|
|
47
|
+
expires_in?: number | undefined;
|
|
48
|
+
} & {
|
|
49
|
+
presentation_submission?: DifPresentationExchangeSubmission;
|
|
50
|
+
};
|
|
51
|
+
readonly serverResponse?: undefined;
|
|
52
|
+
readonly redirectUri?: undefined;
|
|
53
|
+
readonly presentationDuringIssuanceSession?: undefined;
|
|
54
|
+
} | {
|
|
55
|
+
readonly ok: false;
|
|
56
|
+
readonly serverResponse: {
|
|
57
|
+
readonly status: number;
|
|
58
|
+
readonly body: string | Record<string, unknown> | null;
|
|
59
|
+
};
|
|
60
|
+
readonly authorizationResponse: ({
|
|
61
|
+
[x: string]: unknown;
|
|
62
|
+
vp_token: string | Record<string, any> | [string | Record<string, any>, ...(string | Record<string, any>)[]] | Record<string, string | Record<string, any> | [string | Record<string, any>, ...(string | Record<string, any>)[]]>;
|
|
63
|
+
state?: string | undefined;
|
|
64
|
+
id_token?: string | undefined;
|
|
65
|
+
presentation_submission?: any;
|
|
66
|
+
refresh_token?: string | undefined;
|
|
67
|
+
token_type?: string | undefined;
|
|
68
|
+
access_token?: string | undefined;
|
|
69
|
+
expires_in?: number | undefined;
|
|
70
|
+
} & {
|
|
71
|
+
presentation_submission?: DifPresentationExchangeSubmission;
|
|
72
|
+
}) | {
|
|
73
|
+
response: string;
|
|
74
|
+
};
|
|
75
|
+
readonly authorizationResponsePayload: {
|
|
76
|
+
[x: string]: unknown;
|
|
77
|
+
vp_token: string | Record<string, any> | [string | Record<string, any>, ...(string | Record<string, any>)[]] | Record<string, string | Record<string, any> | [string | Record<string, any>, ...(string | Record<string, any>)[]]>;
|
|
78
|
+
state?: string | undefined;
|
|
79
|
+
id_token?: string | undefined;
|
|
80
|
+
presentation_submission?: any;
|
|
81
|
+
refresh_token?: string | undefined;
|
|
82
|
+
token_type?: string | undefined;
|
|
83
|
+
access_token?: string | undefined;
|
|
84
|
+
expires_in?: number | undefined;
|
|
85
|
+
} & {
|
|
86
|
+
presentation_submission?: DifPresentationExchangeSubmission;
|
|
87
|
+
};
|
|
88
|
+
readonly redirectUri?: undefined;
|
|
89
|
+
readonly presentationDuringIssuanceSession?: undefined;
|
|
90
|
+
} | {
|
|
91
|
+
readonly ok: true;
|
|
92
|
+
readonly serverResponse: {
|
|
93
|
+
readonly status: number;
|
|
94
|
+
readonly body: Record<string, unknown>;
|
|
95
|
+
};
|
|
96
|
+
readonly authorizationResponse: ({
|
|
97
|
+
[x: string]: unknown;
|
|
98
|
+
vp_token: string | Record<string, any> | [string | Record<string, any>, ...(string | Record<string, any>)[]] | Record<string, string | Record<string, any> | [string | Record<string, any>, ...(string | Record<string, any>)[]]>;
|
|
99
|
+
state?: string | undefined;
|
|
100
|
+
id_token?: string | undefined;
|
|
101
|
+
presentation_submission?: any;
|
|
102
|
+
refresh_token?: string | undefined;
|
|
103
|
+
token_type?: string | undefined;
|
|
104
|
+
access_token?: string | undefined;
|
|
105
|
+
expires_in?: number | undefined;
|
|
106
|
+
} & {
|
|
107
|
+
presentation_submission?: DifPresentationExchangeSubmission;
|
|
108
|
+
}) | {
|
|
109
|
+
response: string;
|
|
110
|
+
};
|
|
111
|
+
readonly authorizationResponsePayload: {
|
|
112
|
+
[x: string]: unknown;
|
|
113
|
+
vp_token: string | Record<string, any> | [string | Record<string, any>, ...(string | Record<string, any>)[]] | Record<string, string | Record<string, any> | [string | Record<string, any>, ...(string | Record<string, any>)[]]>;
|
|
114
|
+
state?: string | undefined;
|
|
115
|
+
id_token?: string | undefined;
|
|
116
|
+
presentation_submission?: any;
|
|
117
|
+
refresh_token?: string | undefined;
|
|
118
|
+
token_type?: string | undefined;
|
|
119
|
+
access_token?: string | undefined;
|
|
120
|
+
expires_in?: number | undefined;
|
|
121
|
+
} & {
|
|
122
|
+
presentation_submission?: DifPresentationExchangeSubmission;
|
|
123
|
+
};
|
|
124
|
+
readonly redirectUri: string | undefined;
|
|
125
|
+
readonly presentationDuringIssuanceSession: string | undefined;
|
|
126
|
+
}>;
|
|
127
|
+
}
|
|
128
|
+
//#endregion
|
|
129
|
+
export { OpenId4VpHolderService };
|
|
130
|
+
//# sourceMappingURL=OpenId4vpHolderService.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenId4vpHolderService.d.mts","names":[],"sources":["../../src/openid4vc-holder/OpenId4vpHolderService.ts"],"sourcesContent":[],"mappings":";;;;cA2Ca,sBAAA;EAAA,QAAA,2BAAsB;EAEM,QAAA,WAAA;EAChB,WAAA,CAAA,2BAAA,EADgB,8BAChB,EAAA,WAAA,EAAA,WAAA;EAiEP,QAAA,kBAAA;EAOiB,QAAA,iCAAA;EACrB,QAAA,iBAAA;EACD,2BAAA,CAAA,YAAA,EATK,YASL;EAAR;;;;;;iCAF8B,mCACrB,8CACT,QAAQ;;2CAiLK,uBACL,6CAA0C;;IAkOvB,SAAA,qBAAA,EAAA,CAAA;;;;;;;;MAAA,YAAA,CAAA,EAAA,MAAA,GAAA,SAAA;;;gCAAA;;;;;;MAAA,QAAA,EAAA,MAAA,SAAA,CAAA,MAAA,EAAA,GAAA,CAAA,GAAA,CAAA,MAAA,SAAA,CAAA,MAAA,EAAA,GAAA,CAAA,EAAA,GAAA,CAAA,MAAA,SAAA,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,EAAA,CAAA,SAAA,CAAA,MAAA,EAAA,MAAA,SAAA,CAAA,MAAA,EAAA,GAAA,CAAA,GAAA,CAAA,MAAA,SAAA,CAAA,MAAA,EAAA,GAAA,CAAA,EAAA,GAAA,CAAA,MAAA,SAAA,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,EAAA,CAAA,CAAA;;;;;;;;IAAA,CAAA,GAAA;gCAAA;;;;;;;;MAAA,SAAA,MAAA,EAAA,MAAA;;;;;;;;MAAA,uBAAA,CAAA,EAAA,GAAA;MAlOuB,aAAA,CAAA,EAAA,MAAA,GAAA,SAAA;MAAA,UAAA,CAAA,EAAA,MAAA,GAAA,SAAA;;;;gCAkOvB;;;;;;;;;;;;;;;gCAAA;;;;;;;;;;;;;;;;;;;;;gCAAA;;;;;;;;;;;;;;;gCAAA"}
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { getOid4vcCallbacks } from "../shared/callbacks.mjs";
|
|
2
|
+
import { __decorateMetadata } from "../_virtual/_@oxc-project_runtime@0.99.0/helpers/decorateMetadata.mjs";
|
|
3
|
+
import { __decorate } from "../_virtual/_@oxc-project_runtime@0.99.0/helpers/decorate.mjs";
|
|
4
|
+
import { ClaimFormat, CredoError, DcqlService, DifPresentationExchangeService, DifPresentationExchangeSubmissionLocation, Hasher, Kms, TypedArrayEncoder, injectable } from "@credo-ts/core";
|
|
5
|
+
import { Openid4vpClient, extractEncryptionJwkFromJwks, getOpenid4vpClientId, isJarmResponseMode, isOpenid4vpAuthorizationRequestDcApi, parseAuthorizationRequestVersion, parseTransactionData } from "@openid4vc/openid4vp";
|
|
6
|
+
|
|
7
|
+
//#region src/openid4vc-holder/OpenId4vpHolderService.ts
|
|
8
|
+
var _ref, _ref2;
|
|
9
|
+
let OpenId4VpHolderService = class OpenId4VpHolderService$1 {
|
|
10
|
+
constructor(presentationExchangeService, dcqlService) {
|
|
11
|
+
this.presentationExchangeService = presentationExchangeService;
|
|
12
|
+
this.dcqlService = dcqlService;
|
|
13
|
+
}
|
|
14
|
+
getOpenid4vpClient(agentContext, options) {
|
|
15
|
+
return new Openid4vpClient({ callbacks: getOid4vcCallbacks(agentContext, {
|
|
16
|
+
trustedCertificates: options?.trustedCertificates,
|
|
17
|
+
isVerifyOpenId4VpAuthorizationRequest: options?.isVerifyOpenId4VpAuthorizationRequest
|
|
18
|
+
}) });
|
|
19
|
+
}
|
|
20
|
+
async handlePresentationExchangeRequest(agentContext, _presentationDefinition, transactionData) {
|
|
21
|
+
const presentationDefinition = _presentationDefinition;
|
|
22
|
+
this.presentationExchangeService.validatePresentationDefinition(presentationDefinition);
|
|
23
|
+
const presentationExchange = {
|
|
24
|
+
definition: presentationDefinition,
|
|
25
|
+
credentialsForRequest: await this.presentationExchangeService.getCredentialsForRequest(agentContext, presentationDefinition)
|
|
26
|
+
};
|
|
27
|
+
const availableCredentialIds = presentationExchange.credentialsForRequest.requirements.flatMap((requirement) => requirement.submissionEntry.map((entry) => entry.inputDescriptorId));
|
|
28
|
+
return {
|
|
29
|
+
pex: presentationExchange,
|
|
30
|
+
matchedTransactionData: transactionData?.map((entry) => ({
|
|
31
|
+
entry,
|
|
32
|
+
matchedCredentialIds: entry.transactionData.credential_ids.filter((credentialId) => availableCredentialIds.includes(credentialId))
|
|
33
|
+
}))
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
async handleDcqlRequest(agentContext, dcql, transactionData) {
|
|
37
|
+
const dcqlQuery = this.dcqlService.validateDcqlQuery(dcql);
|
|
38
|
+
const dcqlQueryResult = await this.dcqlService.getCredentialsForRequest(agentContext, dcqlQuery);
|
|
39
|
+
const matchedTransactionData = transactionData?.map((entry) => ({
|
|
40
|
+
entry,
|
|
41
|
+
matchedCredentialIds: entry.transactionData.credential_ids.filter((credentialId) => dcqlQueryResult.credential_matches[credentialId].success)
|
|
42
|
+
}));
|
|
43
|
+
return {
|
|
44
|
+
dcql: { queryResult: dcqlQueryResult },
|
|
45
|
+
matchedTransactionData
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
async resolveAuthorizationRequest(agentContext, authorizationRequest, options) {
|
|
49
|
+
const openid4vpClient = this.getOpenid4vpClient(agentContext, {
|
|
50
|
+
trustedCertificates: options?.trustedCertificates,
|
|
51
|
+
isVerifyOpenId4VpAuthorizationRequest: true
|
|
52
|
+
});
|
|
53
|
+
const { params } = openid4vpClient.parseOpenid4vpAuthorizationRequest({ authorizationRequest });
|
|
54
|
+
const verifiedAuthorizationRequest = await openid4vpClient.resolveOpenId4vpAuthorizationRequest({
|
|
55
|
+
authorizationRequestPayload: params,
|
|
56
|
+
origin: options?.origin
|
|
57
|
+
});
|
|
58
|
+
const { client, pex, transactionData, dcql } = verifiedAuthorizationRequest;
|
|
59
|
+
if (client.prefix !== "x509_san_dns" && client.prefix !== "x509_hash" && client.prefix !== "decentralized_identifier" && client.prefix !== "origin" && client.prefix !== "redirect_uri") throw new CredoError(`Client id prefix '${client.prefix}' is not supported`);
|
|
60
|
+
const returnValue = {
|
|
61
|
+
authorizationRequestPayload: verifiedAuthorizationRequest.authorizationRequestPayload,
|
|
62
|
+
origin: options?.origin,
|
|
63
|
+
signedAuthorizationRequest: verifiedAuthorizationRequest.jar ? {
|
|
64
|
+
signer: verifiedAuthorizationRequest.jar?.signer,
|
|
65
|
+
payload: verifiedAuthorizationRequest.jar.jwt.payload,
|
|
66
|
+
header: verifiedAuthorizationRequest.jar.jwt.header
|
|
67
|
+
} : void 0
|
|
68
|
+
};
|
|
69
|
+
const pexResult = pex?.presentation_definition ? await this.handlePresentationExchangeRequest(agentContext, pex.presentation_definition, transactionData) : void 0;
|
|
70
|
+
const dcqlResult = dcql?.query ? await this.handleDcqlRequest(agentContext, dcql.query, transactionData) : void 0;
|
|
71
|
+
agentContext.config.logger.debug("verified Authorization Request");
|
|
72
|
+
agentContext.config.logger.debug(`request '${authorizationRequest}'`);
|
|
73
|
+
return {
|
|
74
|
+
...returnValue,
|
|
75
|
+
verifier: {
|
|
76
|
+
clientIdPrefix: client.prefix,
|
|
77
|
+
effectiveClientId: client.effective
|
|
78
|
+
},
|
|
79
|
+
transactionData: pexResult?.matchedTransactionData ?? dcqlResult?.matchedTransactionData,
|
|
80
|
+
presentationExchange: pexResult?.pex,
|
|
81
|
+
dcql: dcqlResult?.dcql
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
extendCredentialsWithTransactionDataHashes(selectedCredentials, transactionData, selectedTransactionDataCredentials) {
|
|
85
|
+
if (!transactionData && !selectedTransactionDataCredentials) return selectedCredentials;
|
|
86
|
+
if (!selectedTransactionDataCredentials) throw new CredoError("Authorization request contains transaction data entries, but no credential ids to sign transaction data hashes provided in acceptAuthorizationRequest method.");
|
|
87
|
+
if (!transactionData) throw new CredoError("Authorization request does not contains transaction data entries, but credential ids were provided to sign transaction data hashes in acceptAuthorizationRequest method.");
|
|
88
|
+
if (transactionData.length !== selectedTransactionDataCredentials.length) throw new CredoError("Credential ids to sign transaction data hashes provided in acceptAuthorizationRequest method, but the length does not match the number of transaction data entries from the authorization request.");
|
|
89
|
+
const credentialsToTransactionData = {};
|
|
90
|
+
transactionData.forEach((transactionDataEntry, transactionDataIndex) => {
|
|
91
|
+
const { credentialId } = selectedTransactionDataCredentials[transactionDataIndex];
|
|
92
|
+
if (!transactionDataEntry.transactionData.credential_ids.includes(credentialId)) throw new CredoError(`Credential id '${credentialId}' selected to sign transaction data with index '${transactionDataIndex}' is not present in allowed credential ids for transaction. Allowed credential ids are ${transactionDataEntry.transactionData.credential_ids.join(", ")}`);
|
|
93
|
+
if (!selectedCredentials[credentialId]) throw new CredoError(`Credential id '${credentialId}' selected to sign transaction data with index '${transactionDataIndex}', but credential is not included in the credentials for the presentation.`);
|
|
94
|
+
const unsupportedFormats = selectedCredentials[credentialId].filter((c) => c.claimFormat !== ClaimFormat.SdJwtDc).map((c) => c.claimFormat);
|
|
95
|
+
if (unsupportedFormats.length > 0) throw new CredoError(`Credential id '${credentialId}' selected to sign transaction data with index '${transactionDataIndex}' unsupported format(s) ${unsupportedFormats.join(", ")}. Only '${ClaimFormat.SdJwtDc}' is supported for transaction data signing in Credo at the moment.`);
|
|
96
|
+
if (!credentialsToTransactionData[credentialId]) credentialsToTransactionData[credentialId] = [];
|
|
97
|
+
credentialsToTransactionData[credentialId].push(transactionDataEntry);
|
|
98
|
+
});
|
|
99
|
+
const updatedCredentials = { ...selectedCredentials };
|
|
100
|
+
for (const [credentialId, entries] of Object.entries(credentialsToTransactionData)) {
|
|
101
|
+
const allowedHashAlgs = entries.reduce((allowedHashValues, entry) => (entry.transactionData.transaction_data_hashes_alg ?? ["sha-256"]).filter((value) => !allowedHashValues || allowedHashValues.includes(value)), void 0);
|
|
102
|
+
if (!allowedHashAlgs || allowedHashAlgs.length === 0) throw new CredoError(`Unable to determine hash alg for credential with id '${credentialId}' and transaction data indexes ${entries.map((e) => e.transactionDataIndex).join(" ")}, no common 'transaction_data_hashes_alg' value found.`);
|
|
103
|
+
const supportedHashAlgs = ["sha-1", "sha-256"];
|
|
104
|
+
const supportedAllowedHashAlgs = supportedHashAlgs.filter((alg) => allowedHashAlgs.includes(alg));
|
|
105
|
+
if (supportedAllowedHashAlgs.length === 0) throw new CredoError(`Unable to create transaction data hash for credential with id '${credentialId}' and transaction data indexes ${entries.map((e) => e.transactionDataIndex).join(" ")}. None of the common allowed hash algorithms is supported by Credo: ${allowedHashAlgs.join(", ")}. Supported hash algs are ${supportedHashAlgs.join(", ")}.`);
|
|
106
|
+
const [transactionDataHahsesAlg] = supportedAllowedHashAlgs;
|
|
107
|
+
const transactionDataHashes = entries.map((entry) => TypedArrayEncoder.toBase64URL(Hasher.hash(entry.encoded, transactionDataHahsesAlg)));
|
|
108
|
+
updatedCredentials[credentialId] = updatedCredentials[credentialId].map((credential) => {
|
|
109
|
+
if (credential.claimFormat !== ClaimFormat.SdJwtDc) throw new CredoError(`Unexpected claim format '${credential.claimFormat}' for transaction data, expected '${ClaimFormat.SdJwtDc}'`);
|
|
110
|
+
return {
|
|
111
|
+
...credential,
|
|
112
|
+
additionalPayload: {
|
|
113
|
+
...credential.additionalPayload ?? {},
|
|
114
|
+
transaction_data_hashes: transactionDataHashes,
|
|
115
|
+
transaction_data_hashes_alg: transactionDataHahsesAlg
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
return updatedCredentials;
|
|
121
|
+
}
|
|
122
|
+
async acceptAuthorizationRequest(agentContext, options) {
|
|
123
|
+
const kms = agentContext.resolve(Kms.KeyManagementApi);
|
|
124
|
+
const { authorizationRequestPayload, presentationExchange, dcql, transactionData } = options;
|
|
125
|
+
const openid4vpClient = this.getOpenid4vpClient(agentContext);
|
|
126
|
+
const authorizationResponseNonce = TypedArrayEncoder.toBase64URL(kms.randomBytes({ length: 32 }));
|
|
127
|
+
const { nonce } = authorizationRequestPayload;
|
|
128
|
+
let openid4vpVersionNumber = parseAuthorizationRequestVersion(authorizationRequestPayload);
|
|
129
|
+
if (openid4vpVersionNumber >= 24 && openid4vpVersionNumber < 27 && (!authorizationRequestPayload.client_id || authorizationRequestPayload.client_id?.startsWith("x509_san_dns:"))) openid4vpVersionNumber = 24;
|
|
130
|
+
const openid4vpVersion = openid4vpVersionNumber > 24 ? "v1" : openid4vpVersionNumber <= 21 ? "v1.draft21" : "v1.draft24";
|
|
131
|
+
const clientId = getOpenid4vpClientId({
|
|
132
|
+
responseMode: authorizationRequestPayload.response_mode,
|
|
133
|
+
clientId: authorizationRequestPayload.client_id,
|
|
134
|
+
legacyClientIdScheme: authorizationRequestPayload.client_id_scheme,
|
|
135
|
+
origin: options.origin,
|
|
136
|
+
version: openid4vpVersionNumber
|
|
137
|
+
}).effectiveClientId;
|
|
138
|
+
const isDcApiRequest = isOpenid4vpAuthorizationRequestDcApi(authorizationRequestPayload);
|
|
139
|
+
const shouldEncryptResponse = authorizationRequestPayload.response_mode && isJarmResponseMode(authorizationRequestPayload.response_mode);
|
|
140
|
+
const audience = openid4vpVersion === "v1" && isDcApiRequest ? `origin:${options.origin}` : clientId;
|
|
141
|
+
let encryptionJwk;
|
|
142
|
+
if (shouldEncryptResponse) {
|
|
143
|
+
const clientMetadata = authorizationRequestPayload.client_metadata;
|
|
144
|
+
if (!clientMetadata) throw new CredoError("Authorization request payload does not contain 'client_metadata' needed to extract response encryption JWK.");
|
|
145
|
+
if (!clientMetadata.jwks) throw new CredoError("Authorization request payload 'client_metadata' does not contain 'jwks' needed to extract response encryption JWK.");
|
|
146
|
+
encryptionJwk = extractEncryptionJwkFromJwks(clientMetadata.jwks, { supportedAlgValues: ["ECDH-ES"] });
|
|
147
|
+
if (!encryptionJwk) throw new CredoError("Unable to extract encryption JWK from 'client_metadata' for supported alg 'ECDH-ES'");
|
|
148
|
+
}
|
|
149
|
+
let mdocSessionTranscript;
|
|
150
|
+
if (isOpenid4vpAuthorizationRequestDcApi(authorizationRequestPayload)) {
|
|
151
|
+
if (!options.origin) throw new CredoError("Missing required parameter `origin` parameter for accepting openid4vp dc api requests.");
|
|
152
|
+
if (openid4vpVersion === "v1") mdocSessionTranscript = {
|
|
153
|
+
type: "openId4VpDcApi",
|
|
154
|
+
origin: options.origin,
|
|
155
|
+
verifierGeneratedNonce: nonce,
|
|
156
|
+
encryptionJwk: encryptionJwk ? Kms.PublicJwk.fromUnknown(encryptionJwk) : void 0
|
|
157
|
+
};
|
|
158
|
+
else mdocSessionTranscript = {
|
|
159
|
+
type: "openId4VpDcApiDraft24",
|
|
160
|
+
clientId,
|
|
161
|
+
origin: options.origin,
|
|
162
|
+
verifierGeneratedNonce: nonce
|
|
163
|
+
};
|
|
164
|
+
} else {
|
|
165
|
+
const responseUri = authorizationRequestPayload.response_uri ?? authorizationRequestPayload.redirect_uri;
|
|
166
|
+
if (!responseUri) throw new CredoError("Missing required parameter `response_uri` or `redirect_uri` in the authorization request.");
|
|
167
|
+
if (openid4vpVersion === "v1") mdocSessionTranscript = {
|
|
168
|
+
type: "openId4Vp",
|
|
169
|
+
responseUri,
|
|
170
|
+
clientId,
|
|
171
|
+
verifierGeneratedNonce: nonce,
|
|
172
|
+
encryptionJwk: encryptionJwk ? Kms.PublicJwk.fromUnknown(encryptionJwk) : void 0
|
|
173
|
+
};
|
|
174
|
+
else mdocSessionTranscript = {
|
|
175
|
+
type: "openId4VpDraft18",
|
|
176
|
+
mdocGeneratedNonce: authorizationResponseNonce,
|
|
177
|
+
responseUri,
|
|
178
|
+
clientId,
|
|
179
|
+
verifierGeneratedNonce: nonce
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
let vpToken;
|
|
183
|
+
let presentationSubmission;
|
|
184
|
+
const parsedTransactionData = authorizationRequestPayload.transaction_data ? parseTransactionData({ transactionData: authorizationRequestPayload.transaction_data }) : void 0;
|
|
185
|
+
if (authorizationRequestPayload.presentation_definition || presentationExchange) {
|
|
186
|
+
if (!presentationExchange) throw new CredoError("Authorization request included presentation definition. `presentationExchange` MUST be supplied to accept authorization requests.");
|
|
187
|
+
if (!authorizationRequestPayload.presentation_definition) throw new CredoError("`presentationExchange` was supplied, but no presentation definition was found in the presentation request.");
|
|
188
|
+
const credentialsWithTransactionData = this.extendCredentialsWithTransactionDataHashes(presentationExchange.credentials, parsedTransactionData, transactionData);
|
|
189
|
+
const { presentationSubmission: _presentationSubmission, encodedVerifiablePresentations } = await this.presentationExchangeService.createPresentation(agentContext, {
|
|
190
|
+
credentialsForInputDescriptor: credentialsWithTransactionData,
|
|
191
|
+
presentationDefinition: authorizationRequestPayload.presentation_definition,
|
|
192
|
+
challenge: nonce,
|
|
193
|
+
domain: audience,
|
|
194
|
+
presentationSubmissionLocation: DifPresentationExchangeSubmissionLocation.EXTERNAL,
|
|
195
|
+
mdocSessionTranscript
|
|
196
|
+
});
|
|
197
|
+
vpToken = encodedVerifiablePresentations.length === 1 && _presentationSubmission?.descriptor_map[0]?.path === "$" ? encodedVerifiablePresentations[0] : encodedVerifiablePresentations;
|
|
198
|
+
presentationSubmission = _presentationSubmission;
|
|
199
|
+
} else if (authorizationRequestPayload.dcql_query || dcql) {
|
|
200
|
+
if (!authorizationRequestPayload.dcql_query) throw new CredoError(`'dcql' was supplied, but no dcql request was found in the presentation request.`);
|
|
201
|
+
if (!dcql) throw new CredoError(`Authorization request included dcql request. 'dcql' MUST be supplied to accept authorization requests.`);
|
|
202
|
+
const credentialsWithTransactionData = this.extendCredentialsWithTransactionDataHashes(dcql.credentials, parsedTransactionData, transactionData);
|
|
203
|
+
const { encodedDcqlPresentation } = await this.dcqlService.createPresentation(agentContext, {
|
|
204
|
+
credentialQueryToCredential: credentialsWithTransactionData,
|
|
205
|
+
challenge: nonce,
|
|
206
|
+
domain: audience,
|
|
207
|
+
mdocSessionTranscript
|
|
208
|
+
});
|
|
209
|
+
vpToken = encodedDcqlPresentation;
|
|
210
|
+
if (openid4vpVersion !== "v1") vpToken = Object.fromEntries(Object.entries(encodedDcqlPresentation).map(([credentialQueryId, presentations]) => {
|
|
211
|
+
if (presentations.length > 1) throw new CredoError(`Multiple presentations for a single dcql query credential are not supported when using OpenID4VP version '${openid4vpVersion}'.`);
|
|
212
|
+
return [credentialQueryId, presentations[0]];
|
|
213
|
+
}));
|
|
214
|
+
} else throw new CredoError("Either pex or dcql must be provided");
|
|
215
|
+
const response = await openid4vpClient.createOpenid4vpAuthorizationResponse({
|
|
216
|
+
authorizationRequestPayload,
|
|
217
|
+
origin: options.origin,
|
|
218
|
+
authorizationResponsePayload: {
|
|
219
|
+
vp_token: vpToken,
|
|
220
|
+
presentation_submission: presentationSubmission
|
|
221
|
+
},
|
|
222
|
+
jarm: encryptionJwk ? {
|
|
223
|
+
encryption: {
|
|
224
|
+
nonce: authorizationResponseNonce,
|
|
225
|
+
jwk: encryptionJwk
|
|
226
|
+
},
|
|
227
|
+
serverMetadata: {
|
|
228
|
+
authorization_signing_alg_values_supported: [],
|
|
229
|
+
authorization_encryption_alg_values_supported: ["ECDH-ES"],
|
|
230
|
+
authorization_encryption_enc_values_supported: [
|
|
231
|
+
"A128GCM",
|
|
232
|
+
"A256GCM",
|
|
233
|
+
"A128CBC-HS256"
|
|
234
|
+
]
|
|
235
|
+
}
|
|
236
|
+
} : void 0
|
|
237
|
+
});
|
|
238
|
+
const authorizationResponsePayload = response.authorizationResponsePayload;
|
|
239
|
+
const authorizationResponse = response.jarm?.responseJwt ? { response: response.jarm.responseJwt } : authorizationResponsePayload;
|
|
240
|
+
if (isOpenid4vpAuthorizationRequestDcApi(authorizationRequestPayload)) return {
|
|
241
|
+
ok: true,
|
|
242
|
+
authorizationResponse,
|
|
243
|
+
authorizationResponsePayload
|
|
244
|
+
};
|
|
245
|
+
const result = await openid4vpClient.submitOpenid4vpAuthorizationResponse({
|
|
246
|
+
authorizationRequestPayload,
|
|
247
|
+
authorizationResponsePayload: response.authorizationResponsePayload,
|
|
248
|
+
jarm: response.jarm ? { responseJwt: response.jarm.responseJwt } : void 0
|
|
249
|
+
});
|
|
250
|
+
const responseText = await result.response.clone().text().catch(() => null);
|
|
251
|
+
const responseJson = await result.response.clone().json().catch(() => null);
|
|
252
|
+
if (!result.response.ok) return {
|
|
253
|
+
ok: false,
|
|
254
|
+
serverResponse: {
|
|
255
|
+
status: result.response.status,
|
|
256
|
+
body: responseJson ?? responseText
|
|
257
|
+
},
|
|
258
|
+
authorizationResponse,
|
|
259
|
+
authorizationResponsePayload
|
|
260
|
+
};
|
|
261
|
+
return {
|
|
262
|
+
ok: true,
|
|
263
|
+
serverResponse: {
|
|
264
|
+
status: result.response.status,
|
|
265
|
+
body: responseJson ?? {}
|
|
266
|
+
},
|
|
267
|
+
authorizationResponse,
|
|
268
|
+
authorizationResponsePayload,
|
|
269
|
+
redirectUri: responseJson?.redirect_uri,
|
|
270
|
+
presentationDuringIssuanceSession: responseJson?.presentation_during_issuance_session
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
OpenId4VpHolderService = __decorate([injectable(), __decorateMetadata("design:paramtypes", [typeof (_ref = typeof DifPresentationExchangeService !== "undefined" && DifPresentationExchangeService) === "function" ? _ref : Object, typeof (_ref2 = typeof DcqlService !== "undefined" && DcqlService) === "function" ? _ref2 : Object])], OpenId4VpHolderService);
|
|
275
|
+
|
|
276
|
+
//#endregion
|
|
277
|
+
export { OpenId4VpHolderService };
|
|
278
|
+
//# sourceMappingURL=OpenId4vpHolderService.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenId4vpHolderService.mjs","names":["OpenId4VpHolderService","presentationExchangeService: DifPresentationExchangeService","dcqlService: DcqlService","credentialsToTransactionData: Record<string, ParsedTransactionDataEntry[]>","openid4vpVersion: OpenId4VpVersion","encryptionJwk: Jwk | undefined","mdocSessionTranscript: MdocSessionTranscriptOptions","vpToken: VpToken","presentationSubmission: DifPresentationExchangeSubmission | undefined"],"sources":["../../src/openid4vc-holder/OpenId4vpHolderService.ts"],"sourcesContent":["import type {\n AgentContext,\n DcqlCredentialsForRequest,\n DifPexInputDescriptorToCredentials,\n DifPresentationExchangeDefinition,\n DifPresentationExchangeSubmission,\n EncodedX509Certificate,\n HashName,\n MdocSessionTranscriptOptions,\n} from '@credo-ts/core'\nimport {\n ClaimFormat,\n CredoError,\n DcqlService,\n DifPresentationExchangeService,\n DifPresentationExchangeSubmissionLocation,\n Hasher,\n injectable,\n Kms,\n TypedArrayEncoder,\n} from '@credo-ts/core'\nimport type { Jwk } from '@openid4vc/oauth2'\nimport {\n extractEncryptionJwkFromJwks,\n getOpenid4vpClientId,\n isJarmResponseMode,\n isOpenid4vpAuthorizationRequestDcApi,\n type Openid4vpAuthorizationResponse,\n Openid4vpClient,\n parseAuthorizationRequestVersion,\n parseTransactionData,\n type VpToken,\n} from '@openid4vc/openid4vp'\nimport type { OpenId4VpVersion } from '../openid4vc-verifier'\nimport { getOid4vcCallbacks } from '../shared/callbacks'\nimport type {\n OpenId4VpAcceptAuthorizationRequestOptions,\n OpenId4VpResolvedAuthorizationRequest,\n ParsedTransactionDataEntry,\n ResolveOpenId4VpAuthorizationRequestOptions,\n} from './OpenId4vpHolderServiceOptions'\n\n@injectable()\nexport class OpenId4VpHolderService {\n public constructor(\n private presentationExchangeService: DifPresentationExchangeService,\n private dcqlService: DcqlService\n ) {}\n\n private getOpenid4vpClient(\n agentContext: AgentContext,\n options?: { trustedCertificates?: EncodedX509Certificate[]; isVerifyOpenId4VpAuthorizationRequest?: boolean }\n ) {\n const callbacks = getOid4vcCallbacks(agentContext, {\n trustedCertificates: options?.trustedCertificates,\n isVerifyOpenId4VpAuthorizationRequest: options?.isVerifyOpenId4VpAuthorizationRequest,\n })\n return new Openid4vpClient({ callbacks })\n }\n\n private async handlePresentationExchangeRequest(\n agentContext: AgentContext,\n _presentationDefinition: unknown,\n transactionData?: ParsedTransactionDataEntry[]\n ) {\n const presentationDefinition = _presentationDefinition as DifPresentationExchangeDefinition\n this.presentationExchangeService.validatePresentationDefinition(presentationDefinition)\n\n const presentationExchange = {\n definition: presentationDefinition,\n credentialsForRequest: await this.presentationExchangeService.getCredentialsForRequest(\n agentContext,\n presentationDefinition\n ),\n }\n\n const availableCredentialIds = presentationExchange.credentialsForRequest.requirements.flatMap((requirement) =>\n requirement.submissionEntry.map((entry) => entry.inputDescriptorId)\n )\n\n // for each transaction data entry, get all credentials that can be used to sign the respective transaction\n const matchedTransactionData = transactionData?.map((entry) => ({\n entry,\n matchedCredentialIds: entry.transactionData.credential_ids.filter((credentialId) =>\n availableCredentialIds.includes(credentialId)\n ),\n }))\n\n return { pex: presentationExchange, matchedTransactionData }\n }\n\n private async handleDcqlRequest(\n agentContext: AgentContext,\n dcql: unknown,\n transactionData?: ParsedTransactionDataEntry[]\n ) {\n const dcqlQuery = this.dcqlService.validateDcqlQuery(dcql)\n const dcqlQueryResult = await this.dcqlService.getCredentialsForRequest(agentContext, dcqlQuery)\n\n // for each transaction data entry, get all credentials that can fore used to sign the respective transaction\n const matchedTransactionData = transactionData?.map((entry) => ({\n entry,\n matchedCredentialIds: entry.transactionData.credential_ids.filter(\n (credentialId) => dcqlQueryResult.credential_matches[credentialId].success\n ),\n }))\n\n return { dcql: { queryResult: dcqlQueryResult }, matchedTransactionData }\n }\n\n public async resolveAuthorizationRequest(\n agentContext: AgentContext,\n /**\n * Can be:\n * - JWT\n * - URI containing request or request_uri param\n * - Request payload\n */\n authorizationRequest: string | Record<string, unknown>,\n options?: ResolveOpenId4VpAuthorizationRequestOptions\n ): Promise<OpenId4VpResolvedAuthorizationRequest> {\n const openid4vpClient = this.getOpenid4vpClient(agentContext, {\n trustedCertificates: options?.trustedCertificates,\n isVerifyOpenId4VpAuthorizationRequest: true,\n })\n const { params } = openid4vpClient.parseOpenid4vpAuthorizationRequest({ authorizationRequest })\n\n const verifiedAuthorizationRequest = await openid4vpClient.resolveOpenId4vpAuthorizationRequest({\n authorizationRequestPayload: params,\n origin: options?.origin,\n })\n\n const { client, pex, transactionData, dcql } = verifiedAuthorizationRequest\n\n // Prefix on client is normalized, so also includes did/web-orgin\n if (\n client.prefix !== 'x509_san_dns' &&\n client.prefix !== 'x509_hash' &&\n client.prefix !== 'decentralized_identifier' &&\n client.prefix !== 'origin' &&\n client.prefix !== 'redirect_uri'\n ) {\n throw new CredoError(`Client id prefix '${client.prefix}' is not supported`)\n }\n\n const returnValue = {\n authorizationRequestPayload: verifiedAuthorizationRequest.authorizationRequestPayload,\n origin: options?.origin,\n signedAuthorizationRequest: verifiedAuthorizationRequest.jar\n ? {\n signer: verifiedAuthorizationRequest.jar?.signer,\n payload: verifiedAuthorizationRequest.jar.jwt.payload,\n header: verifiedAuthorizationRequest.jar.jwt.header,\n }\n : undefined,\n }\n\n const pexResult = pex?.presentation_definition\n ? await this.handlePresentationExchangeRequest(agentContext, pex.presentation_definition, transactionData)\n : undefined\n\n const dcqlResult = dcql?.query ? await this.handleDcqlRequest(agentContext, dcql.query, transactionData) : undefined\n\n agentContext.config.logger.debug('verified Authorization Request')\n agentContext.config.logger.debug(`request '${authorizationRequest}'`)\n\n return {\n ...returnValue,\n verifier: {\n clientIdPrefix: client.prefix,\n effectiveClientId: client.effective,\n },\n transactionData: pexResult?.matchedTransactionData ?? dcqlResult?.matchedTransactionData,\n presentationExchange: pexResult?.pex,\n dcql: dcqlResult?.dcql,\n }\n }\n\n private extendCredentialsWithTransactionDataHashes<\n T extends DifPexInputDescriptorToCredentials | DcqlCredentialsForRequest,\n >(\n // Either PEX or DCQL\n selectedCredentials: T,\n transactionData?: ParsedTransactionDataEntry[],\n selectedTransactionDataCredentials?: Array<{ credentialId: string }>\n ): T {\n // TODO: it would make sense for oid4vc to also handle this validation logic, but it would require\n // knowledge of PEX / DCQL...\n if (!transactionData && !selectedTransactionDataCredentials) return selectedCredentials\n\n if (!selectedTransactionDataCredentials) {\n throw new CredoError(\n 'Authorization request contains transaction data entries, but no credential ids to sign transaction data hashes provided in acceptAuthorizationRequest method.'\n )\n }\n\n if (!transactionData) {\n throw new CredoError(\n 'Authorization request does not contains transaction data entries, but credential ids were provided to sign transaction data hashes in acceptAuthorizationRequest method.'\n )\n }\n\n if (transactionData.length !== selectedTransactionDataCredentials.length) {\n throw new CredoError(\n 'Credential ids to sign transaction data hashes provided in acceptAuthorizationRequest method, but the length does not match the number of transaction data entries from the authorization request.'\n )\n }\n\n const credentialsToTransactionData: Record<string, ParsedTransactionDataEntry[]> = {}\n\n transactionData.forEach((transactionDataEntry, transactionDataIndex) => {\n const { credentialId } = selectedTransactionDataCredentials[transactionDataIndex]\n\n if (!transactionDataEntry.transactionData.credential_ids.includes(credentialId)) {\n throw new CredoError(\n `Credential id '${credentialId}' selected to sign transaction data with index '${transactionDataIndex}' is not present in allowed credential ids for transaction. Allowed credential ids are ${transactionDataEntry.transactionData.credential_ids.join(', ')}`\n )\n }\n\n if (!selectedCredentials[credentialId]) {\n throw new CredoError(\n `Credential id '${credentialId}' selected to sign transaction data with index '${transactionDataIndex}', but credential is not included in the credentials for the presentation.`\n )\n }\n\n const unsupportedFormats = selectedCredentials[credentialId]\n .filter((c) => c.claimFormat !== ClaimFormat.SdJwtDc)\n .map((c) => c.claimFormat)\n\n if (unsupportedFormats.length > 0) {\n throw new CredoError(\n `Credential id '${credentialId}' selected to sign transaction data with index '${transactionDataIndex}' unsupported format(s) ${unsupportedFormats.join(', ')}. Only '${ClaimFormat.SdJwtDc}' is supported for transaction data signing in Credo at the moment.`\n )\n }\n\n if (!credentialsToTransactionData[credentialId]) {\n credentialsToTransactionData[credentialId] = []\n }\n credentialsToTransactionData[credentialId].push(transactionDataEntry)\n })\n\n const updatedCredentials = {\n ...selectedCredentials,\n }\n for (const [credentialId, entries] of Object.entries(credentialsToTransactionData)) {\n const allowedHashAlgs = entries.reduce<string[] | undefined>(\n (allowedHashValues, entry) =>\n (entry.transactionData.transaction_data_hashes_alg ?? ['sha-256']).filter(\n (value) => !allowedHashValues || allowedHashValues.includes(value)\n ),\n undefined\n )\n\n if (!allowedHashAlgs || allowedHashAlgs.length === 0) {\n throw new CredoError(\n `Unable to determine hash alg for credential with id '${credentialId}' and transaction data indexes ${entries.map((e) => e.transactionDataIndex).join(' ')}, no common 'transaction_data_hashes_alg' value found.`\n )\n }\n\n const supportedHashAlgs = ['sha-1', 'sha-256'] satisfies HashName[]\n const supportedAllowedHashAlgs = supportedHashAlgs.filter((alg) => allowedHashAlgs.includes(alg))\n if (supportedAllowedHashAlgs.length === 0) {\n throw new CredoError(\n `Unable to create transaction data hash for credential with id '${credentialId}' and transaction data indexes ${entries.map((e) => e.transactionDataIndex).join(' ')}. None of the common allowed hash algorithms is supported by Credo: ${allowedHashAlgs.join(', ')}. Supported hash algs are ${supportedHashAlgs.join(', ')}.`\n )\n }\n\n // Not required, but we include it by default as otherwise we need to look at all entries to\n // see if any specified an alg array\n const [transactionDataHahsesAlg] = supportedAllowedHashAlgs\n const transactionDataHashes = entries.map((entry) =>\n TypedArrayEncoder.toBase64URL(Hasher.hash(entry.encoded, transactionDataHahsesAlg))\n )\n\n updatedCredentials[credentialId] = updatedCredentials[credentialId].map((credential) => {\n if (credential.claimFormat !== ClaimFormat.SdJwtDc) {\n // We already verified this above\n throw new CredoError(\n `Unexpected claim format '${credential.claimFormat}' for transaction data, expected '${ClaimFormat.SdJwtDc}'`\n )\n }\n\n return {\n ...credential,\n additionalPayload: {\n ...(credential.additionalPayload ?? {}),\n transaction_data_hashes: transactionDataHashes,\n transaction_data_hashes_alg: transactionDataHahsesAlg,\n },\n }\n })\n }\n\n return updatedCredentials\n }\n\n public async acceptAuthorizationRequest(\n agentContext: AgentContext,\n options: OpenId4VpAcceptAuthorizationRequestOptions\n ) {\n const kms = agentContext.resolve(Kms.KeyManagementApi)\n const { authorizationRequestPayload, presentationExchange, dcql, transactionData } = options\n\n const openid4vpClient = this.getOpenid4vpClient(agentContext)\n const authorizationResponseNonce = TypedArrayEncoder.toBase64URL(kms.randomBytes({ length: 32 }))\n const { nonce } = authorizationRequestPayload\n\n let openid4vpVersionNumber = parseAuthorizationRequestVersion(authorizationRequestPayload)\n\n // It's hard to detect draft 24 for x509_san_dns/unsigned dc-api. In draft 27 a new vp_formats structure was introduced\n // so if the client id prefix is 'x509_san_dns' or there's no client_id and still uses the old vp_formats structure, we parse it\n // as draft 24 (to at least ensure compatibility with credo)\n if (\n openid4vpVersionNumber >= 24 &&\n openid4vpVersionNumber < 27 &&\n (!authorizationRequestPayload.client_id || authorizationRequestPayload.client_id?.startsWith('x509_san_dns:'))\n ) {\n openid4vpVersionNumber = 24\n }\n\n // We mainly support draft 21/24 and 1.0, but we try to parse in-between versions\n // as one of the supported versions, to not throw errors even before trying.\n const openid4vpVersion: OpenId4VpVersion =\n openid4vpVersionNumber > 24 ? 'v1' : openid4vpVersionNumber <= 21 ? 'v1.draft21' : 'v1.draft24'\n\n const parsedClientId = getOpenid4vpClientId({\n responseMode: authorizationRequestPayload.response_mode,\n clientId: authorizationRequestPayload.client_id,\n legacyClientIdScheme: authorizationRequestPayload.client_id_scheme,\n origin: options.origin,\n version: openid4vpVersionNumber,\n })\n\n const clientId = parsedClientId.effectiveClientId\n const isDcApiRequest = isOpenid4vpAuthorizationRequestDcApi(authorizationRequestPayload)\n\n const shouldEncryptResponse =\n authorizationRequestPayload.response_mode && isJarmResponseMode(authorizationRequestPayload.response_mode)\n\n // TODO: we should return the effectiveAudience in the returned value of openid4vp lib\n // Since it differs based on the version of openid4vp used\n // NOTE: in v1 DC API request the audience is always origin: (not the client id)\n const audience = openid4vpVersion === 'v1' && isDcApiRequest ? `origin:${options.origin}` : clientId\n\n let encryptionJwk: Jwk | undefined\n if (shouldEncryptResponse) {\n // NOTE: Once we add support for federation we need to require the clientMetadata as input to the accept method.\n const clientMetadata = authorizationRequestPayload.client_metadata\n\n if (!clientMetadata) {\n throw new CredoError(\n \"Authorization request payload does not contain 'client_metadata' needed to extract response encryption JWK.\"\n )\n }\n if (!clientMetadata.jwks) {\n throw new CredoError(\n \"Authorization request payload 'client_metadata' does not contain 'jwks' needed to extract response encryption JWK.\"\n )\n }\n\n encryptionJwk = extractEncryptionJwkFromJwks(clientMetadata.jwks, {\n supportedAlgValues: ['ECDH-ES'],\n })\n\n if (!encryptionJwk) {\n throw new CredoError(\"Unable to extract encryption JWK from 'client_metadata' for supported alg 'ECDH-ES'\")\n }\n }\n\n let mdocSessionTranscript: MdocSessionTranscriptOptions\n if (isOpenid4vpAuthorizationRequestDcApi(authorizationRequestPayload)) {\n if (!options.origin) {\n throw new CredoError('Missing required parameter `origin` parameter for accepting openid4vp dc api requests.')\n }\n\n if (openid4vpVersion === 'v1') {\n mdocSessionTranscript = {\n type: 'openId4VpDcApi',\n origin: options.origin,\n verifierGeneratedNonce: nonce,\n encryptionJwk: encryptionJwk ? Kms.PublicJwk.fromUnknown(encryptionJwk) : undefined,\n }\n } else {\n mdocSessionTranscript = {\n type: 'openId4VpDcApiDraft24',\n clientId,\n origin: options.origin,\n verifierGeneratedNonce: nonce,\n }\n }\n } else {\n const responseUri = authorizationRequestPayload.response_uri ?? authorizationRequestPayload.redirect_uri\n if (!responseUri) {\n throw new CredoError(\n 'Missing required parameter `response_uri` or `redirect_uri` in the authorization request.'\n )\n }\n\n if (openid4vpVersion === 'v1') {\n mdocSessionTranscript = {\n type: 'openId4Vp',\n responseUri,\n clientId,\n verifierGeneratedNonce: nonce,\n encryptionJwk: encryptionJwk ? Kms.PublicJwk.fromUnknown(encryptionJwk) : undefined,\n }\n } else {\n mdocSessionTranscript = {\n type: 'openId4VpDraft18',\n mdocGeneratedNonce: authorizationResponseNonce,\n responseUri,\n clientId,\n verifierGeneratedNonce: nonce,\n }\n }\n }\n\n let vpToken: VpToken\n let presentationSubmission: DifPresentationExchangeSubmission | undefined\n\n const parsedTransactionData = authorizationRequestPayload.transaction_data\n ? parseTransactionData({\n transactionData: authorizationRequestPayload.transaction_data,\n })\n : undefined\n\n // Handle presentation exchange part\n if (authorizationRequestPayload.presentation_definition || presentationExchange) {\n if (!presentationExchange) {\n throw new CredoError(\n 'Authorization request included presentation definition. `presentationExchange` MUST be supplied to accept authorization requests.'\n )\n }\n if (!authorizationRequestPayload.presentation_definition) {\n throw new CredoError(\n '`presentationExchange` was supplied, but no presentation definition was found in the presentation request.'\n )\n }\n\n const credentialsWithTransactionData = this.extendCredentialsWithTransactionDataHashes(\n presentationExchange.credentials,\n parsedTransactionData,\n transactionData\n )\n\n const { presentationSubmission: _presentationSubmission, encodedVerifiablePresentations } =\n await this.presentationExchangeService.createPresentation(agentContext, {\n credentialsForInputDescriptor: credentialsWithTransactionData,\n presentationDefinition:\n authorizationRequestPayload.presentation_definition as unknown as DifPresentationExchangeDefinition,\n challenge: nonce,\n domain: audience,\n presentationSubmissionLocation: DifPresentationExchangeSubmissionLocation.EXTERNAL,\n mdocSessionTranscript: mdocSessionTranscript,\n })\n\n vpToken =\n encodedVerifiablePresentations.length === 1 && _presentationSubmission?.descriptor_map[0]?.path === '$'\n ? encodedVerifiablePresentations[0]\n : encodedVerifiablePresentations\n presentationSubmission = _presentationSubmission\n } else if (authorizationRequestPayload.dcql_query || dcql) {\n if (!authorizationRequestPayload.dcql_query) {\n throw new CredoError(`'dcql' was supplied, but no dcql request was found in the presentation request.`)\n }\n if (!dcql) {\n throw new CredoError(\n `Authorization request included dcql request. 'dcql' MUST be supplied to accept authorization requests.`\n )\n }\n\n const credentialsWithTransactionData = this.extendCredentialsWithTransactionDataHashes(\n dcql.credentials,\n parsedTransactionData,\n transactionData\n )\n\n const { encodedDcqlPresentation } = await this.dcqlService.createPresentation(agentContext, {\n credentialQueryToCredential: credentialsWithTransactionData,\n challenge: nonce,\n domain: audience,\n mdocSessionTranscript: mdocSessionTranscript,\n })\n\n vpToken = encodedDcqlPresentation\n\n // Pre 1.0 the vp_token directly maps from query id to presentation instead of array\n if (openid4vpVersion !== 'v1') {\n vpToken = Object.fromEntries(\n Object.entries(encodedDcqlPresentation).map(([credentialQueryId, presentations]) => {\n if (presentations.length > 1) {\n throw new CredoError(\n `Multiple presentations for a single dcql query credential are not supported when using OpenID4VP version '${openid4vpVersion}'.`\n )\n }\n\n return [credentialQueryId, presentations[0]]\n })\n )\n }\n } else {\n throw new CredoError('Either pex or dcql must be provided')\n }\n\n const response = await openid4vpClient.createOpenid4vpAuthorizationResponse({\n authorizationRequestPayload,\n origin: options.origin,\n authorizationResponsePayload: {\n vp_token: vpToken,\n presentation_submission: presentationSubmission,\n },\n jarm: encryptionJwk\n ? {\n encryption: { nonce: authorizationResponseNonce, jwk: encryptionJwk },\n serverMetadata: {\n authorization_signing_alg_values_supported: [],\n authorization_encryption_alg_values_supported: ['ECDH-ES'],\n authorization_encryption_enc_values_supported: ['A128GCM', 'A256GCM', 'A128CBC-HS256'],\n },\n }\n : undefined,\n })\n\n const authorizationResponsePayload = response.authorizationResponsePayload as Openid4vpAuthorizationResponse & {\n presentation_submission?: DifPresentationExchangeSubmission\n }\n const authorizationResponse = response.jarm?.responseJwt\n ? { response: response.jarm.responseJwt }\n : authorizationResponsePayload\n\n // TODO: we should include more typing here that the user\n // still needs to submit the response. or as we discussed, split\n // this method up in create and submit\n if (isOpenid4vpAuthorizationRequestDcApi(authorizationRequestPayload)) {\n return {\n ok: true,\n authorizationResponse,\n authorizationResponsePayload,\n } as const\n }\n\n // TODO: parse response in openi4vp library so we can have typed error\n // as well as typed response (with redirect_uri/presentation_during_issuance_session)\n const result = await openid4vpClient.submitOpenid4vpAuthorizationResponse({\n authorizationRequestPayload,\n authorizationResponsePayload: response.authorizationResponsePayload,\n jarm: response.jarm ? { responseJwt: response.jarm.responseJwt } : undefined,\n })\n\n const responseText = await result.response\n .clone()\n .text()\n .catch(() => null)\n\n const responseJson = (await result.response\n .clone()\n .json()\n .catch(() => null)) as null | Record<string, unknown>\n\n if (!result.response.ok) {\n return {\n ok: false,\n serverResponse: {\n status: result.response.status,\n body: responseJson ?? responseText,\n },\n authorizationResponse,\n authorizationResponsePayload,\n } as const\n }\n\n return {\n ok: true,\n serverResponse: {\n status: result.response.status,\n body: responseJson ?? {},\n },\n authorizationResponse,\n authorizationResponsePayload,\n redirectUri: responseJson?.redirect_uri as string | undefined,\n presentationDuringIssuanceSession: responseJson?.presentation_during_issuance_session as string | undefined,\n } as const\n }\n}\n"],"mappings":";;;;;;;;AA2CO,mCAAMA,yBAAuB;CAClC,AAAO,YACL,AAAQC,6BACR,AAAQC,aACR;EAFQ;EACA;;CAGV,AAAQ,mBACN,cACA,SACA;AAKA,SAAO,IAAI,gBAAgB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M,gBAAgB,qCAAqC;GACxE;GACA,8BAA8B,SAAS;GACvC,MAAM,SAAS,OAAO,EAAE,aAAa,SAAS,KAAK,aAAa,GAAG;GACpE,CAAC;EAEF,MAAM,eAAe,MAAM,OAAO,SAC/B,OAAO,CACP,MAAM,CACN,YAAY,KAAK;EAEpB,MAAM,eAAgB,MAAM,OAAO,SAChC,OAAO,CACP,MAAM,CACN,YAAY,KAAK;AAEpB,MAAI,CAAC,OAAO,SAAS,GACnB,QAAO;GACL,IAAI;GACJ,gBAAgB;IACd,QAAQ,OAAO,SAAS;IACxB,MAAM,gBAAgB;IACvB;GACD;GACA;GACD;AAGH,SAAO;GACL,IAAI;GACJ,gBAAgB;IACd,QAAQ,OAAO,SAAS;IACxB,MAAM,gBAAgB,EAAE;IACzB;GACD;GACA;GACA,aAAa,cAAc;GAC3B,mCAAmC,cAAc;GAClD;;;qCA3hBJ,YAAY"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { OpenId4VpAuthorizationRequestPayload } from "../shared/models/index.mjs";
|
|
2
|
+
import "../shared/index.mjs";
|
|
3
|
+
import { DcqlCredentialsForRequest, DcqlQueryResult, DifPexCredentialsForRequest, DifPexInputDescriptorToCredentials, DifPresentationExchangeDefinition, EncodedX509Certificate } from "@credo-ts/core";
|
|
4
|
+
import { ResolvedOpenid4vpAuthorizationRequest } from "@openid4vc/openid4vp";
|
|
5
|
+
|
|
6
|
+
//#region src/openid4vc-holder/OpenId4vpHolderServiceOptions.d.ts
|
|
7
|
+
type ParsedTransactionDataEntry = NonNullable<ResolvedOpenid4vpAuthorizationRequest['transactionData']>[number];
|
|
8
|
+
interface ResolveOpenId4VpAuthorizationRequestOptions {
|
|
9
|
+
trustedCertificates?: EncodedX509Certificate[];
|
|
10
|
+
origin?: string;
|
|
11
|
+
}
|
|
12
|
+
type VerifiedJarRequest = NonNullable<ResolvedOpenid4vpAuthorizationRequest['jar']>;
|
|
13
|
+
interface OpenId4VpResolvedAuthorizationRequest {
|
|
14
|
+
/**
|
|
15
|
+
* Parameters related to DIF Presentation Exchange. Only defined when
|
|
16
|
+
* the request included a presentation definition.
|
|
17
|
+
*/
|
|
18
|
+
presentationExchange?: {
|
|
19
|
+
definition: DifPresentationExchangeDefinition;
|
|
20
|
+
credentialsForRequest: DifPexCredentialsForRequest;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Parameters related to DCQL. Only defined when
|
|
24
|
+
* the request included a dcql query.
|
|
25
|
+
*/
|
|
26
|
+
dcql?: {
|
|
27
|
+
queryResult: DcqlQueryResult;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* The transaction data entries, with the matched credential ids.
|
|
31
|
+
* - For Presentation Exchange the id refers to the presentation exchange id
|
|
32
|
+
* - For DCQL the id refers to the credential query id
|
|
33
|
+
*
|
|
34
|
+
* If no matches were found the `matchedCredentialIds` will be empty and means
|
|
35
|
+
* the presetnation cannot be satisfied.
|
|
36
|
+
*
|
|
37
|
+
* The entries have the same order as the transaction data entries from the request
|
|
38
|
+
*/
|
|
39
|
+
transactionData?: Array<{
|
|
40
|
+
entry: ParsedTransactionDataEntry;
|
|
41
|
+
matchedCredentialIds: string[];
|
|
42
|
+
}>;
|
|
43
|
+
/**
|
|
44
|
+
* The authorization request payload
|
|
45
|
+
*/
|
|
46
|
+
authorizationRequestPayload: OpenId4VpAuthorizationRequestPayload;
|
|
47
|
+
/**
|
|
48
|
+
* Metadata about the signed authorization request.
|
|
49
|
+
*
|
|
50
|
+
* Only present if the authorization request was signed
|
|
51
|
+
*/
|
|
52
|
+
signedAuthorizationRequest?: {
|
|
53
|
+
signer: VerifiedJarRequest['signer'];
|
|
54
|
+
payload: VerifiedJarRequest['jwt']['payload'];
|
|
55
|
+
header: VerifiedJarRequest['jwt']['header'];
|
|
56
|
+
};
|
|
57
|
+
verifier: {
|
|
58
|
+
/**
|
|
59
|
+
* The client id prefix in normalized form (so e.g. 'did' is returned as 'decentralized_identifier')
|
|
60
|
+
*/
|
|
61
|
+
clientIdPrefix: ResolvedOpenid4vpAuthorizationRequest['client']['prefix'];
|
|
62
|
+
/**
|
|
63
|
+
* The effective client id, taking into account default values and different draft versions.
|
|
64
|
+
*/
|
|
65
|
+
effectiveClientId: ResolvedOpenid4vpAuthorizationRequest['client']['effective'];
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Origin of the request, to be used with Digital Credentials API
|
|
69
|
+
*/
|
|
70
|
+
origin?: string;
|
|
71
|
+
}
|
|
72
|
+
interface OpenId4VpAcceptAuthorizationRequestOptions {
|
|
73
|
+
/**
|
|
74
|
+
* Parameters related to DIF Presentation Exchange. MUST be present when the resolved
|
|
75
|
+
* authorization request included a `presentationExchange` parameter.
|
|
76
|
+
*/
|
|
77
|
+
presentationExchange?: {
|
|
78
|
+
credentials: DifPexInputDescriptorToCredentials;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Parameters related to Dcql. MUST be present when the resolved
|
|
82
|
+
* authorization request included a `dcql` parameter.
|
|
83
|
+
*/
|
|
84
|
+
dcql?: {
|
|
85
|
+
credentials: DcqlCredentialsForRequest;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* The credentials to use for the transaction data hashes in the presentation. The length
|
|
89
|
+
* of the array MUST be the same length as the transaction data entries in the authorization
|
|
90
|
+
* request, and follow the same order (meaning the first entry in this array matches the first
|
|
91
|
+
* entry in the transaction data from the request).
|
|
92
|
+
*
|
|
93
|
+
* - For Presentation Exchange the id refers to the presentation exchange id
|
|
94
|
+
* - For DCQL the id refers to the credential query id
|
|
95
|
+
*
|
|
96
|
+
*/
|
|
97
|
+
transactionData?: Array<{
|
|
98
|
+
credentialId: string;
|
|
99
|
+
}>;
|
|
100
|
+
/**
|
|
101
|
+
* The authorization request payload
|
|
102
|
+
*/
|
|
103
|
+
authorizationRequestPayload: OpenId4VpAuthorizationRequestPayload;
|
|
104
|
+
/**
|
|
105
|
+
* The origin of the verifier that is making the request.
|
|
106
|
+
* Required in combination with the DC Api
|
|
107
|
+
*/
|
|
108
|
+
origin?: string;
|
|
109
|
+
}
|
|
110
|
+
//#endregion
|
|
111
|
+
export { OpenId4VpAcceptAuthorizationRequestOptions, OpenId4VpResolvedAuthorizationRequest, ParsedTransactionDataEntry, ResolveOpenId4VpAuthorizationRequestOptions };
|
|
112
|
+
//# sourceMappingURL=OpenId4vpHolderServiceOptions.d.mts.map
|