@credo-ts/openid4vc 0.6.1-pr-2091-20241119140918 → 0.6.2-alpha-20251210145840
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
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import type { OpenId4VciAuthorizationServerConfig, OpenId4VciCredentialConfigurationsSupportedWithFormats, OpenId4VciCredentialIssuerMetadataDisplay } from '../../shared';
|
|
2
|
-
import type { OpenId4VciBatchCredentialIssuanceOptions } from '../OpenId4VcIssuerServiceOptions';
|
|
3
|
-
import type { JwaSignatureAlgorithm, RecordTags, TagsBase } from '@credo-ts/core';
|
|
4
|
-
import { BaseRecord } from '@credo-ts/core';
|
|
5
|
-
export type OpenId4VcIssuerRecordTags = RecordTags<OpenId4VcIssuerRecord>;
|
|
6
|
-
export type DefaultOpenId4VcIssuerRecordTags = {
|
|
7
|
-
issuerId: string;
|
|
8
|
-
};
|
|
9
|
-
export type OpenId4VcIssuerRecordProps = {
|
|
10
|
-
id?: string;
|
|
11
|
-
createdAt?: Date;
|
|
12
|
-
tags?: TagsBase;
|
|
13
|
-
issuerId: string;
|
|
14
|
-
/**
|
|
15
|
-
* The fingerprint (multibase encoded) of the public key used to sign access tokens for
|
|
16
|
-
* this issuer.
|
|
17
|
-
*/
|
|
18
|
-
accessTokenPublicKeyFingerprint: string;
|
|
19
|
-
/**
|
|
20
|
-
* The DPoP signing algorithms supported by this issuer.
|
|
21
|
-
* If not provided, dPoP is considered unsupported.
|
|
22
|
-
*/
|
|
23
|
-
dpopSigningAlgValuesSupported?: [JwaSignatureAlgorithm, ...JwaSignatureAlgorithm[]];
|
|
24
|
-
display?: OpenId4VciCredentialIssuerMetadataDisplay[];
|
|
25
|
-
authorizationServerConfigs?: OpenId4VciAuthorizationServerConfig[];
|
|
26
|
-
credentialConfigurationsSupported: OpenId4VciCredentialConfigurationsSupportedWithFormats;
|
|
27
|
-
/**
|
|
28
|
-
* Indicate support for batch issuane of credentials
|
|
29
|
-
*/
|
|
30
|
-
batchCredentialIssuance?: OpenId4VciBatchCredentialIssuanceOptions;
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* For OID4VC you need to expose metadata files. Each issuer needs to host this metadata. This is not the case for DIDComm where we can just have one /didcomm endpoint.
|
|
34
|
-
* So we create a record per openid issuer/verifier that you want, and each tenant can create multiple issuers/verifiers which have different endpoints
|
|
35
|
-
* and metadata files
|
|
36
|
-
* */
|
|
37
|
-
export declare class OpenId4VcIssuerRecord extends BaseRecord<DefaultOpenId4VcIssuerRecordTags> {
|
|
38
|
-
static readonly type = "OpenId4VcIssuerRecord";
|
|
39
|
-
readonly type = "OpenId4VcIssuerRecord";
|
|
40
|
-
issuerId: string;
|
|
41
|
-
accessTokenPublicKeyFingerprint: string;
|
|
42
|
-
/**
|
|
43
|
-
* Only here for class transformation. If credentialsSupported is set we transform
|
|
44
|
-
* it to the new credentialConfigurationsSupported format
|
|
45
|
-
*/
|
|
46
|
-
private set credentialsSupported(value);
|
|
47
|
-
credentialConfigurationsSupported: OpenId4VciCredentialConfigurationsSupportedWithFormats;
|
|
48
|
-
display?: OpenId4VciCredentialIssuerMetadataDisplay[];
|
|
49
|
-
authorizationServerConfigs?: OpenId4VciAuthorizationServerConfig[];
|
|
50
|
-
dpopSigningAlgValuesSupported?: [JwaSignatureAlgorithm, ...JwaSignatureAlgorithm[]];
|
|
51
|
-
batchCredentialIssuance?: OpenId4VciBatchCredentialIssuanceOptions;
|
|
52
|
-
constructor(props: OpenId4VcIssuerRecordProps);
|
|
53
|
-
getTags(): {
|
|
54
|
-
issuerId: string;
|
|
55
|
-
};
|
|
56
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
-
var t = {};
|
|
13
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
-
t[p] = s[p];
|
|
15
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
-
t[p[i]] = s[p[i]];
|
|
19
|
-
}
|
|
20
|
-
return t;
|
|
21
|
-
};
|
|
22
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.OpenId4VcIssuerRecord = void 0;
|
|
24
|
-
const oid4vci_1 = require("@animo-id/oid4vci");
|
|
25
|
-
const core_1 = require("@credo-ts/core");
|
|
26
|
-
const class_transformer_1 = require("class-transformer");
|
|
27
|
-
/**
|
|
28
|
-
* For OID4VC you need to expose metadata files. Each issuer needs to host this metadata. This is not the case for DIDComm where we can just have one /didcomm endpoint.
|
|
29
|
-
* So we create a record per openid issuer/verifier that you want, and each tenant can create multiple issuers/verifiers which have different endpoints
|
|
30
|
-
* and metadata files
|
|
31
|
-
* */
|
|
32
|
-
class OpenId4VcIssuerRecord extends core_1.BaseRecord {
|
|
33
|
-
/**
|
|
34
|
-
* Only here for class transformation. If credentialsSupported is set we transform
|
|
35
|
-
* it to the new credentialConfigurationsSupported format
|
|
36
|
-
*/
|
|
37
|
-
set credentialsSupported(credentialsSupported) {
|
|
38
|
-
if (this.credentialConfigurationsSupported)
|
|
39
|
-
return;
|
|
40
|
-
this.credentialConfigurationsSupported =
|
|
41
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
42
|
-
(0, oid4vci_1.credentialsSupportedToCredentialConfigurationsSupported)(credentialsSupported);
|
|
43
|
-
}
|
|
44
|
-
constructor(props) {
|
|
45
|
-
var _a, _b, _c;
|
|
46
|
-
super();
|
|
47
|
-
this.type = OpenId4VcIssuerRecord.type;
|
|
48
|
-
if (props) {
|
|
49
|
-
this.id = (_a = props.id) !== null && _a !== void 0 ? _a : core_1.utils.uuid();
|
|
50
|
-
this.createdAt = (_b = props.createdAt) !== null && _b !== void 0 ? _b : new Date();
|
|
51
|
-
this._tags = (_c = props.tags) !== null && _c !== void 0 ? _c : {};
|
|
52
|
-
this.issuerId = props.issuerId;
|
|
53
|
-
this.accessTokenPublicKeyFingerprint = props.accessTokenPublicKeyFingerprint;
|
|
54
|
-
this.credentialConfigurationsSupported = props.credentialConfigurationsSupported;
|
|
55
|
-
this.dpopSigningAlgValuesSupported = props.dpopSigningAlgValuesSupported;
|
|
56
|
-
this.display = props.display;
|
|
57
|
-
this.authorizationServerConfigs = props.authorizationServerConfigs;
|
|
58
|
-
this.batchCredentialIssuance = props.batchCredentialIssuance;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
getTags() {
|
|
62
|
-
return Object.assign(Object.assign({}, this._tags), { issuerId: this.issuerId });
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
exports.OpenId4VcIssuerRecord = OpenId4VcIssuerRecord;
|
|
66
|
-
OpenId4VcIssuerRecord.type = 'OpenId4VcIssuerRecord';
|
|
67
|
-
__decorate([
|
|
68
|
-
(0, class_transformer_1.Transform)(({ type, value }) => {
|
|
69
|
-
if (type === class_transformer_1.TransformationType.PLAIN_TO_CLASS && Array.isArray(value)) {
|
|
70
|
-
return value.map((display) => {
|
|
71
|
-
var _a, _b;
|
|
72
|
-
if ((_a = display.logo) === null || _a === void 0 ? void 0 : _a.uri)
|
|
73
|
-
return display;
|
|
74
|
-
const _c = (_b = display.logo) !== null && _b !== void 0 ? _b : {}, { url } = _c, logoRest = __rest(_c, ["url"]);
|
|
75
|
-
return Object.assign(Object.assign({}, display), { logo: url
|
|
76
|
-
? Object.assign(Object.assign({}, logoRest), { uri: url }) : undefined });
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
return value;
|
|
80
|
-
}),
|
|
81
|
-
__metadata("design:type", Array)
|
|
82
|
-
], OpenId4VcIssuerRecord.prototype, "display", void 0);
|
|
83
|
-
//# sourceMappingURL=OpenId4VcIssuerRecord.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OpenId4VcIssuerRecord.js","sourceRoot":"","sources":["../../../src/openid4vc-issuer/repository/OpenId4VcIssuerRecord.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAQA,+CAA2F;AAC3F,yCAAkD;AAClD,yDAAiE;AAsCjE;;;;KAIK;AACL,MAAa,qBAAsB,SAAQ,iBAA4C;IAOrF;;;OAGG;IACH,IAAY,oBAAoB,CAAC,oBAAoC;QACnE,IAAI,IAAI,CAAC,iCAAiC;YAAE,OAAM;QAElD,IAAI,CAAC,iCAAiC;YACpC,8DAA8D;YAC9D,IAAA,iEAAuD,EAAC,oBAA2B,CAAQ,CAAA;IAC/F,CAAC;IA8BD,YAAmB,KAAiC;;QAClD,KAAK,EAAE,CAAA;QA9CO,SAAI,GAAG,qBAAqB,CAAC,IAAI,CAAA;QAgD/C,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,CAAC,EAAE,GAAG,MAAA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B,OAAoB,CAAqB,CAAA;gBAC/C,uCACK,OAAO,KACV,IAAI,EAAE,GAAG;wBACP,CAAC,iCACM,QAAQ,KACX,GAAG,EAAE,GAAG,IAEZ,CAAC,CAAC,SAAS,IACd;YACH,CAAC,CAAC,CAAA;QACJ,CAAC;QAED,OAAO,KAAK,CAAA;IACd,CAAC,CAAC;;sDAC0D"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { AgentContext } from '@credo-ts/core';
|
|
2
|
-
import { Repository, StorageService, EventEmitter } from '@credo-ts/core';
|
|
3
|
-
import { OpenId4VcIssuerRecord } from './OpenId4VcIssuerRecord';
|
|
4
|
-
export declare class OpenId4VcIssuerRepository extends Repository<OpenId4VcIssuerRecord> {
|
|
5
|
-
constructor(storageService: StorageService<OpenId4VcIssuerRecord>, eventEmitter: EventEmitter);
|
|
6
|
-
findByIssuerId(agentContext: AgentContext, issuerId: string): Promise<OpenId4VcIssuerRecord | null>;
|
|
7
|
-
getByIssuerId(agentContext: AgentContext, issuerId: string): Promise<OpenId4VcIssuerRecord>;
|
|
8
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.OpenId4VcIssuerRepository = void 0;
|
|
16
|
-
const core_1 = require("@credo-ts/core");
|
|
17
|
-
const OpenId4VcIssuerRecord_1 = require("./OpenId4VcIssuerRecord");
|
|
18
|
-
let OpenId4VcIssuerRepository = class OpenId4VcIssuerRepository extends core_1.Repository {
|
|
19
|
-
constructor(storageService, eventEmitter) {
|
|
20
|
-
super(OpenId4VcIssuerRecord_1.OpenId4VcIssuerRecord, storageService, eventEmitter);
|
|
21
|
-
}
|
|
22
|
-
findByIssuerId(agentContext, issuerId) {
|
|
23
|
-
return this.findSingleByQuery(agentContext, { issuerId });
|
|
24
|
-
}
|
|
25
|
-
getByIssuerId(agentContext, issuerId) {
|
|
26
|
-
return this.getSingleByQuery(agentContext, { issuerId });
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
exports.OpenId4VcIssuerRepository = OpenId4VcIssuerRepository;
|
|
30
|
-
exports.OpenId4VcIssuerRepository = OpenId4VcIssuerRepository = __decorate([
|
|
31
|
-
(0, core_1.injectable)(),
|
|
32
|
-
__param(0, (0, core_1.inject)(core_1.InjectionSymbols.StorageService)),
|
|
33
|
-
__metadata("design:paramtypes", [Object, core_1.EventEmitter])
|
|
34
|
-
], OpenId4VcIssuerRepository);
|
|
35
|
-
//# sourceMappingURL=OpenId4VcIssuerRepository.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OpenId4VcIssuerRepository.js","sourceRoot":"","sources":["../../../src/openid4vc-issuer/repository/OpenId4VcIssuerRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,yCAA+G;AAE/G,mEAA+D;AAGxD,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,iBAAiC;IAC9E,YAC2C,cAAqD,EAC9F,YAA0B;QAE1B,KAAK,CAAC,6CAAqB,EAAE,cAAc,EAAE,YAAY,CAAC,CAAA;IAC5D,CAAC;IAEM,cAAc,CAAC,YAA0B,EAAE,QAAgB;QAChE,OAAO,IAAI,CAAC,iBAAiB,CAAC,YAAY,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAA;IAC3D,CAAC;IAEM,aAAa,CAAC,YAA0B,EAAE,QAAgB;QAC/D,OAAO,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAA;IAC1D,CAAC;CACF,CAAA;AAfY,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,iBAAU,GAAE;IAGR,WAAA,IAAA,aAAM,EAAC,uBAAgB,CAAC,cAAc,CAAC,CAAA;6CAC1B,mBAAY;GAHjB,yBAAyB,CAerC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./OpenId4VcIssuerRecord"), exports);
|
|
18
|
-
__exportStar(require("./OpenId4VcIssuerRepository"), exports);
|
|
19
|
-
__exportStar(require("./OpenId4VcIssuanceSessionRecord"), exports);
|
|
20
|
-
__exportStar(require("./OpenId4VcIssuanceSessionRepository"), exports);
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/openid4vc-issuer/repository/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAuC;AACvC,8DAA2C;AAC3C,mEAAgD;AAChD,uEAAoD"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { OpenId4VcIssuanceRequest } from './requestContext';
|
|
2
|
-
import type { OpenId4VcIssuerModuleConfig } from '../OpenId4VcIssuerModuleConfig';
|
|
3
|
-
import type { NextFunction, Response, Router } from 'express';
|
|
4
|
-
export declare function configureAccessTokenEndpoint(router: Router, config: OpenId4VcIssuerModuleConfig): void;
|
|
5
|
-
export declare function handleTokenRequest(config: OpenId4VcIssuerModuleConfig): (request: OpenId4VcIssuanceRequest, response: Response, next: NextFunction) => Promise<void>;
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.configureAccessTokenEndpoint = configureAccessTokenEndpoint;
|
|
4
|
-
exports.handleTokenRequest = handleTokenRequest;
|
|
5
|
-
const oauth2_1 = require("@animo-id/oauth2");
|
|
6
|
-
const core_1 = require("@credo-ts/core");
|
|
7
|
-
const router_1 = require("../../shared/router");
|
|
8
|
-
const utils_1 = require("../../shared/utils");
|
|
9
|
-
const OpenId4VcIssuanceSessionState_1 = require("../OpenId4VcIssuanceSessionState");
|
|
10
|
-
const OpenId4VcIssuerService_1 = require("../OpenId4VcIssuerService");
|
|
11
|
-
const repository_1 = require("../repository");
|
|
12
|
-
function configureAccessTokenEndpoint(router, config) {
|
|
13
|
-
router.post(config.accessTokenEndpointPath, handleTokenRequest(config));
|
|
14
|
-
}
|
|
15
|
-
function handleTokenRequest(config) {
|
|
16
|
-
return async (request, response, next) => {
|
|
17
|
-
var _a, _b, _c, _d;
|
|
18
|
-
response.set({ 'Cache-Control': 'no-store', Pragma: 'no-cache' });
|
|
19
|
-
const requestContext = (0, router_1.getRequestContext)(request);
|
|
20
|
-
const { agentContext, issuer } = requestContext;
|
|
21
|
-
const openId4VcIssuerService = agentContext.dependencyManager.resolve(OpenId4VcIssuerService_1.OpenId4VcIssuerService);
|
|
22
|
-
const issuanceSessionRepository = agentContext.dependencyManager.resolve(repository_1.OpenId4VcIssuanceSessionRepository);
|
|
23
|
-
const issuerMetadata = await openId4VcIssuerService.getIssuerMetadata(agentContext, issuer);
|
|
24
|
-
const accessTokenSigningKey = core_1.Key.fromFingerprint(issuer.accessTokenPublicKeyFingerprint);
|
|
25
|
-
const oauth2AuthorizationServer = openId4VcIssuerService.getOauth2AuthorizationServer(agentContext);
|
|
26
|
-
const fullRequestUrl = (0, core_1.joinUriParts)(issuerMetadata.credentialIssuer.credential_issuer, [
|
|
27
|
-
config.accessTokenEndpointPath,
|
|
28
|
-
]);
|
|
29
|
-
const requestLike = {
|
|
30
|
-
headers: new Headers(request.headers),
|
|
31
|
-
method: request.method,
|
|
32
|
-
url: fullRequestUrl,
|
|
33
|
-
};
|
|
34
|
-
const { accessTokenRequest, grant, dpopJwt, pkceCodeVerifier } = oauth2AuthorizationServer.parseAccessTokenRequest({
|
|
35
|
-
accessTokenRequest: request.body,
|
|
36
|
-
request: requestLike,
|
|
37
|
-
});
|
|
38
|
-
const issuanceSession = await issuanceSessionRepository.findSingleByQuery(agentContext, {
|
|
39
|
-
preAuthorizedCode: grant.grantType === oauth2_1.preAuthorizedCodeGrantIdentifier ? grant.preAuthorizedCode : undefined,
|
|
40
|
-
authorizationCode: grant.grantType === oauth2_1.authorizationCodeGrantIdentifier ? grant.code : undefined,
|
|
41
|
-
});
|
|
42
|
-
const allowedStates = grant.grantType === oauth2_1.preAuthorizedCodeGrantIdentifier
|
|
43
|
-
? [OpenId4VcIssuanceSessionState_1.OpenId4VcIssuanceSessionState.OfferCreated, OpenId4VcIssuanceSessionState_1.OpenId4VcIssuanceSessionState.OfferUriRetrieved]
|
|
44
|
-
: [OpenId4VcIssuanceSessionState_1.OpenId4VcIssuanceSessionState.AuthorizationGranted];
|
|
45
|
-
if (!issuanceSession || !allowedStates.includes(issuanceSession.state)) {
|
|
46
|
-
throw new oauth2_1.Oauth2ServerErrorResponseError({
|
|
47
|
-
error: oauth2_1.Oauth2ErrorCodes.InvalidGrant,
|
|
48
|
-
error_description: 'Invalid authorization code',
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
if (Date.now() >
|
|
52
|
-
(0, utils_1.addSecondsToDate)(issuanceSession.createdAt, config.statefullCredentialOfferExpirationInSeconds).getTime()) {
|
|
53
|
-
issuanceSession.errorMessage = 'Credential offer has expired';
|
|
54
|
-
await openId4VcIssuerService.updateState(agentContext, issuanceSession, OpenId4VcIssuanceSessionState_1.OpenId4VcIssuanceSessionState.Error);
|
|
55
|
-
throw new oauth2_1.Oauth2ServerErrorResponseError({
|
|
56
|
-
// What is the best error here?
|
|
57
|
-
error: oauth2_1.Oauth2ErrorCodes.InvalidGrant,
|
|
58
|
-
error_description: 'Session expired',
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
let verificationResult;
|
|
62
|
-
try {
|
|
63
|
-
if (grant.grantType === oauth2_1.preAuthorizedCodeGrantIdentifier) {
|
|
64
|
-
if (!issuanceSession.preAuthorizedCode) {
|
|
65
|
-
throw new oauth2_1.Oauth2ServerErrorResponseError({
|
|
66
|
-
error: oauth2_1.Oauth2ErrorCodes.InvalidGrant,
|
|
67
|
-
error_description: 'Invalid authorization code',
|
|
68
|
-
}, {
|
|
69
|
-
internalMessage: 'Found issuance session without preAuthorizedCode. This should not happen as the issuance session is fetched based on the pre authorized code',
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
verificationResult = await oauth2AuthorizationServer.verifyPreAuthorizedCodeAccessTokenRequest({
|
|
73
|
-
accessTokenRequest,
|
|
74
|
-
expectedPreAuthorizedCode: issuanceSession.preAuthorizedCode,
|
|
75
|
-
grant,
|
|
76
|
-
request: requestLike,
|
|
77
|
-
dpop: {
|
|
78
|
-
jwt: dpopJwt,
|
|
79
|
-
// This will only have effect when DPoP is not present.
|
|
80
|
-
// If it is present it will always be verified
|
|
81
|
-
required: config.dpopRequired,
|
|
82
|
-
},
|
|
83
|
-
expectedTxCode: issuanceSession.userPin,
|
|
84
|
-
preAuthorizedCodeExpiresAt: (0, utils_1.addSecondsToDate)(issuanceSession.createdAt, config.statefullCredentialOfferExpirationInSeconds),
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
else if (grant.grantType === oauth2_1.authorizationCodeGrantIdentifier) {
|
|
88
|
-
if (!((_a = issuanceSession.authorization) === null || _a === void 0 ? void 0 : _a.code) || !((_b = issuanceSession.authorization) === null || _b === void 0 ? void 0 : _b.codeExpiresAt)) {
|
|
89
|
-
throw new oauth2_1.Oauth2ServerErrorResponseError({
|
|
90
|
-
error: oauth2_1.Oauth2ErrorCodes.InvalidGrant,
|
|
91
|
-
error_description: 'Invalid authorization code',
|
|
92
|
-
}, {
|
|
93
|
-
internalMessage: 'Found issuance session without authorization.code or authorization.codeExpiresAt. This should not happen as the issuance session is fetched based on the authorization code',
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
verificationResult = await oauth2AuthorizationServer.verifyAuthorizationCodeAccessTokenRequest({
|
|
97
|
-
accessTokenRequest,
|
|
98
|
-
expectedCode: issuanceSession.authorization.code,
|
|
99
|
-
codeExpiresAt: issuanceSession.authorization.codeExpiresAt,
|
|
100
|
-
grant,
|
|
101
|
-
request: requestLike,
|
|
102
|
-
dpop: {
|
|
103
|
-
jwt: dpopJwt,
|
|
104
|
-
// This will only have effect when DPoP is not present.
|
|
105
|
-
// If it is present it will always be verified
|
|
106
|
-
required: config.dpopRequired,
|
|
107
|
-
},
|
|
108
|
-
pkce: issuanceSession.pkce
|
|
109
|
-
? {
|
|
110
|
-
codeChallenge: issuanceSession.pkce.codeChallenge,
|
|
111
|
-
codeChallengeMethod: issuanceSession.pkce.codeChallengeMethod,
|
|
112
|
-
codeVerifier: pkceCodeVerifier,
|
|
113
|
-
}
|
|
114
|
-
: undefined,
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
throw new oauth2_1.Oauth2ServerErrorResponseError({
|
|
119
|
-
error: oauth2_1.Oauth2ErrorCodes.UnsupportedGrantType,
|
|
120
|
-
error_description: 'Unsupported grant type',
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
await openId4VcIssuerService.updateState(agentContext, issuanceSession, OpenId4VcIssuanceSessionState_1.OpenId4VcIssuanceSessionState.AccessTokenRequested);
|
|
124
|
-
const { cNonce, cNonceExpiresInSeconds } = await openId4VcIssuerService.createNonce(agentContext, issuer);
|
|
125
|
-
// for authorization code flow we take the authorization scopes. For pre-auth we don't use scopes (we just
|
|
126
|
-
// use the offered credential configuration ids so a scope is not required)
|
|
127
|
-
const scopes = grant.grantType === oauth2_1.authorizationCodeGrantIdentifier ? (_c = issuanceSession.authorization) === null || _c === void 0 ? void 0 : _c.scopes : undefined;
|
|
128
|
-
const subject = `credo:${core_1.utils.uuid()}`;
|
|
129
|
-
const signerJwk = (0, core_1.getJwkFromKey)(accessTokenSigningKey);
|
|
130
|
-
const accessTokenResponse = await oauth2AuthorizationServer.createAccessTokenResponse({
|
|
131
|
-
audience: issuerMetadata.credentialIssuer.credential_issuer,
|
|
132
|
-
authorizationServer: issuerMetadata.credentialIssuer.credential_issuer,
|
|
133
|
-
expiresInSeconds: config.accessTokenExpiresInSeconds,
|
|
134
|
-
signer: {
|
|
135
|
-
method: 'jwk',
|
|
136
|
-
alg: signerJwk.supportedSignatureAlgorithms[0],
|
|
137
|
-
publicJwk: signerJwk.toJson(),
|
|
138
|
-
},
|
|
139
|
-
dpopJwk: verificationResult.dpopJwk,
|
|
140
|
-
scope: scopes === null || scopes === void 0 ? void 0 : scopes.join(' '),
|
|
141
|
-
clientId: issuanceSession.clientId,
|
|
142
|
-
additionalAccessTokenPayload: {
|
|
143
|
-
'pre-authorized_code': grant.grantType === oauth2_1.preAuthorizedCodeGrantIdentifier ? grant.preAuthorizedCode : undefined,
|
|
144
|
-
issuer_state: (_d = issuanceSession.authorization) === null || _d === void 0 ? void 0 : _d.issuerState,
|
|
145
|
-
},
|
|
146
|
-
// We generate a random subject for each access token and bind the issuance session to this.
|
|
147
|
-
subject,
|
|
148
|
-
// NOTE: these have been removed in newer drafts. Keeping them in for now
|
|
149
|
-
cNonce,
|
|
150
|
-
cNonceExpiresIn: cNonceExpiresInSeconds,
|
|
151
|
-
});
|
|
152
|
-
issuanceSession.authorization = Object.assign(Object.assign({}, issuanceSession.authorization), { subject });
|
|
153
|
-
await openId4VcIssuerService.updateState(agentContext, issuanceSession, OpenId4VcIssuanceSessionState_1.OpenId4VcIssuanceSessionState.AccessTokenCreated);
|
|
154
|
-
return (0, router_1.sendJsonResponse)(response, next, accessTokenResponse);
|
|
155
|
-
}
|
|
156
|
-
catch (error) {
|
|
157
|
-
if (error instanceof oauth2_1.Oauth2ServerErrorResponseError) {
|
|
158
|
-
return (0, router_1.sendOauth2ErrorResponse)(response, next, agentContext.config.logger, error);
|
|
159
|
-
}
|
|
160
|
-
return (0, router_1.sendUnknownServerErrorResponse)(response, next, agentContext.config.logger, error);
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
//# sourceMappingURL=accessTokenEndpoint.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"accessTokenEndpoint.js","sourceRoot":"","sources":["../../../src/openid4vc-issuer/router/accessTokenEndpoint.ts"],"names":[],"mappings":";;AAwBA,oEAEC;AAED,gDA0LC;AAjND,6CAKyB;AACzB,yCAAwE;AAExE,gDAK4B;AAC5B,8CAAqD;AACrD,oFAAgF;AAChF,sEAAkE;AAClE,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AAY,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;YACnF,CAAC;YAED,OAAO,IAAA,uCAA8B,EAAC,QAAQ,EAAE,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;QAC1F,CAAC;IACH,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.configureAuthorizationChallengeEndpoint = configureAuthorizationChallengeEndpoint;
|
|
4
|
-
const oauth2_1 = require("@animo-id/oauth2");
|
|
5
|
-
const core_1 = require("@credo-ts/core");
|
|
6
|
-
const openid4vc_verifier_1 = require("../../openid4vc-verifier");
|
|
7
|
-
const shared_1 = require("../../shared");
|
|
8
|
-
const router_1 = require("../../shared/router");
|
|
9
|
-
const utils_1 = require("../../shared/utils");
|
|
10
|
-
const OpenId4VcIssuanceSessionState_1 = require("../OpenId4VcIssuanceSessionState");
|
|
11
|
-
const OpenId4VcIssuerModuleConfig_1 = require("../OpenId4VcIssuerModuleConfig");
|
|
12
|
-
const OpenId4VcIssuerService_1 = require("../OpenId4VcIssuerService");
|
|
13
|
-
function configureAuthorizationChallengeEndpoint(router, config) {
|
|
14
|
-
router.post(config.authorizationChallengeEndpointPath, async (request, response, next) => {
|
|
15
|
-
const requestContext = (0, router_1.getRequestContext)(request);
|
|
16
|
-
const { agentContext, issuer } = requestContext;
|
|
17
|
-
try {
|
|
18
|
-
const openId4VcIssuerService = agentContext.dependencyManager.resolve(OpenId4VcIssuerService_1.OpenId4VcIssuerService);
|
|
19
|
-
const authorizationServer = openId4VcIssuerService.getOauth2AuthorizationServer(agentContext);
|
|
20
|
-
const { authorizationChallengeRequest } = authorizationServer.parseAuthorizationChallengeRequest({
|
|
21
|
-
authorizationChallengeRequest: request.body,
|
|
22
|
-
});
|
|
23
|
-
if (authorizationChallengeRequest.auth_session) {
|
|
24
|
-
await handleAuthorizationChallengeWithAuthSession({
|
|
25
|
-
response,
|
|
26
|
-
next,
|
|
27
|
-
authorizationChallengeRequest: Object.assign(Object.assign({}, authorizationChallengeRequest), { auth_session: authorizationChallengeRequest.auth_session }),
|
|
28
|
-
agentContext,
|
|
29
|
-
issuer,
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
// First call, no auth_sesion yet
|
|
34
|
-
await handleAuthorizationChallengeNoAuthSession({
|
|
35
|
-
authorizationChallengeRequest,
|
|
36
|
-
agentContext,
|
|
37
|
-
issuer,
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
if (error instanceof oauth2_1.Oauth2ServerErrorResponseError) {
|
|
43
|
-
return (0, router_1.sendOauth2ErrorResponse)(response, next, agentContext.config.logger, error);
|
|
44
|
-
}
|
|
45
|
-
return (0, router_1.sendUnknownServerErrorResponse)(response, next, agentContext.config.logger, error);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
async function handleAuthorizationChallengeNoAuthSession(options) {
|
|
50
|
-
const { agentContext, issuer, authorizationChallengeRequest } = options;
|
|
51
|
-
// First call, no auth_sesion yet
|
|
52
|
-
const openId4VcIssuerService = agentContext.dependencyManager.resolve(OpenId4VcIssuerService_1.OpenId4VcIssuerService);
|
|
53
|
-
const config = agentContext.dependencyManager.resolve(OpenId4VcIssuerModuleConfig_1.OpenId4VcIssuerModuleConfig);
|
|
54
|
-
const issuerMetadata = await openId4VcIssuerService.getIssuerMetadata(agentContext, issuer);
|
|
55
|
-
const authorizationServer = openId4VcIssuerService.getOauth2AuthorizationServer(agentContext);
|
|
56
|
-
if (!config.getVerificationSessionForIssuanceSessionAuthorization) {
|
|
57
|
-
throw new oauth2_1.Oauth2ServerErrorResponseError({
|
|
58
|
-
error: oauth2_1.Oauth2ErrorCodes.ServerError,
|
|
59
|
-
}, {
|
|
60
|
-
internalMessage: `Missing required 'getVerificationSessionForIssuanceSessionAuthorization' callback in openid4vc issuer module config. This callback is required for presentation during issuance flows.`,
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
if (!authorizationChallengeRequest.scope) {
|
|
64
|
-
throw new oauth2_1.Oauth2ServerErrorResponseError({
|
|
65
|
-
error: oauth2_1.Oauth2ErrorCodes.InvalidScope,
|
|
66
|
-
error_description: `Missing required 'scope' parameter`,
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
if (!authorizationChallengeRequest.issuer_state) {
|
|
70
|
-
throw new oauth2_1.Oauth2ServerErrorResponseError({
|
|
71
|
-
error: oauth2_1.Oauth2ErrorCodes.InvalidRequest,
|
|
72
|
-
error_description: `Missing required 'issuer_state' parameter. Only requests initiated by a credential offer are supported for authorization challenge.`,
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
// FIXME: we need to authenticate the client. Could be either using client_id/client_secret
|
|
76
|
-
// but that doesn't make sense for wallets. So for now we just allow any client_id and we will
|
|
77
|
-
// need OAuth2 Attestation Based Client Auth and dynamically allow client_ids based on wallet providers
|
|
78
|
-
// we trust. Will add this in a follow up PR (basically we do no client authentication at the moment)
|
|
79
|
-
// if (!authorizationChallengeRequest.client_id) {
|
|
80
|
-
// throw new Oauth2ServerErrorResponseError({
|
|
81
|
-
// error: Oauth2ErrorCodes.InvalidRequest,
|
|
82
|
-
// error_description: `Missing required 'client_id' parameter..`,
|
|
83
|
-
// })
|
|
84
|
-
// }
|
|
85
|
-
const issuanceSession = await openId4VcIssuerService.findSingleIssuancSessionByQuery(agentContext, {
|
|
86
|
-
issuerId: issuer.issuerId,
|
|
87
|
-
issuerState: authorizationChallengeRequest.issuer_state,
|
|
88
|
-
});
|
|
89
|
-
const allowedStates = [OpenId4VcIssuanceSessionState_1.OpenId4VcIssuanceSessionState.OfferCreated, OpenId4VcIssuanceSessionState_1.OpenId4VcIssuanceSessionState.OfferUriRetrieved];
|
|
90
|
-
if (!issuanceSession || !allowedStates.includes(issuanceSession.state)) {
|
|
91
|
-
throw new oauth2_1.Oauth2ServerErrorResponseError({
|
|
92
|
-
error: oauth2_1.Oauth2ErrorCodes.InvalidRequest,
|
|
93
|
-
error_description: `Invalid 'issuer_state' parameter`,
|
|
94
|
-
}, {
|
|
95
|
-
internalMessage: !issuanceSession
|
|
96
|
-
? `Issuance session not found for 'issuer_state' parameter '${authorizationChallengeRequest.issuer_state}'`
|
|
97
|
-
: `Issuance session '${issuanceSession.id}' has state '${issuanceSession.state}' but expected one of ${allowedStates.join(', ')}`,
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
const offeredCredentialConfigurations = (0, shared_1.getOfferedCredentials)(issuanceSession.credentialOfferPayload.credential_configuration_ids, issuerMetadata.credentialIssuer.credential_configurations_supported);
|
|
101
|
-
const allowedScopes = (0, shared_1.getScopesFromCredentialConfigurationsSupported)(offeredCredentialConfigurations);
|
|
102
|
-
const requestedScopes = (0, shared_1.getAllowedAndRequestedScopeValues)({
|
|
103
|
-
allowedScopes,
|
|
104
|
-
requestedScope: authorizationChallengeRequest.scope,
|
|
105
|
-
});
|
|
106
|
-
const requestedCredentialConfigurations = (0, shared_1.getCredentialConfigurationsSupportedForScopes)(offeredCredentialConfigurations, requestedScopes);
|
|
107
|
-
if (requestedScopes.length === 0 || Object.keys(requestedCredentialConfigurations).length === 0) {
|
|
108
|
-
throw new oauth2_1.Oauth2ServerErrorResponseError({
|
|
109
|
-
error: oauth2_1.Oauth2ErrorCodes.InvalidScope,
|
|
110
|
-
error_description: `No requested 'scope' values match with offered credential configurations.`,
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
const { authorizationRequest, verificationSession, scopes: presentationScopes, } = await config.getVerificationSessionForIssuanceSessionAuthorization({
|
|
114
|
-
agentContext,
|
|
115
|
-
issuanceSession,
|
|
116
|
-
requestedCredentialConfigurations,
|
|
117
|
-
scopes: requestedScopes,
|
|
118
|
-
});
|
|
119
|
-
// Store presentation during issuance session on the record
|
|
120
|
-
verificationSession.presentationDuringIssuanceSession = core_1.TypedArrayEncoder.toBase64URL(agentContext.wallet.getRandomValues(32));
|
|
121
|
-
await agentContext.dependencyManager
|
|
122
|
-
.resolve(openid4vc_verifier_1.OpenId4VcVerificationSessionRepository)
|
|
123
|
-
.update(agentContext, verificationSession);
|
|
124
|
-
const authSession = core_1.TypedArrayEncoder.toBase64URL(agentContext.wallet.getRandomValues(32));
|
|
125
|
-
issuanceSession.authorization = Object.assign(Object.assign({}, issuanceSession.authorization), { scopes: presentationScopes });
|
|
126
|
-
issuanceSession.presentation = {
|
|
127
|
-
required: true,
|
|
128
|
-
authSession,
|
|
129
|
-
openId4VcVerificationSessionId: verificationSession.id,
|
|
130
|
-
};
|
|
131
|
-
// NOTE: should only allow authenticated clients in the future.
|
|
132
|
-
issuanceSession.clientId = authorizationChallengeRequest.client_id;
|
|
133
|
-
await openId4VcIssuerService.updateState(agentContext, issuanceSession, OpenId4VcIssuanceSessionState_1.OpenId4VcIssuanceSessionState.AuthorizationInitiated);
|
|
134
|
-
const authorizationChallengeErrorResponse = authorizationServer.createAuthorizationChallengePresentationErrorResponse({
|
|
135
|
-
authSession,
|
|
136
|
-
presentation: authorizationRequest,
|
|
137
|
-
errorDescription: 'Presentation required before issuance',
|
|
138
|
-
});
|
|
139
|
-
throw new oauth2_1.Oauth2ServerErrorResponseError(authorizationChallengeErrorResponse);
|
|
140
|
-
}
|
|
141
|
-
async function handleAuthorizationChallengeWithAuthSession(options) {
|
|
142
|
-
const { agentContext, issuer, authorizationChallengeRequest, response, next } = options;
|
|
143
|
-
const openId4VcIssuerService = agentContext.dependencyManager.resolve(OpenId4VcIssuerService_1.OpenId4VcIssuerService);
|
|
144
|
-
const config = agentContext.dependencyManager.resolve(OpenId4VcIssuerModuleConfig_1.OpenId4VcIssuerModuleConfig);
|
|
145
|
-
const authorizationServer = openId4VcIssuerService.getOauth2AuthorizationServer(agentContext);
|
|
146
|
-
const verifierApi = agentContext.dependencyManager.resolve(openid4vc_verifier_1.OpenId4VcVerifierApi);
|
|
147
|
-
// NOTE: we ignore scope, issuer_state etc.. parameters if auth_session is present
|
|
148
|
-
// should we validate that these are not in the request? I'm not sure what best practive would be here
|
|
149
|
-
const issuanceSession = await openId4VcIssuerService.findSingleIssuancSessionByQuery(agentContext, {
|
|
150
|
-
issuerId: issuer.issuerId,
|
|
151
|
-
presentationAuthSession: authorizationChallengeRequest.auth_session,
|
|
152
|
-
});
|
|
153
|
-
const allowedStates = [OpenId4VcIssuanceSessionState_1.OpenId4VcIssuanceSessionState.AuthorizationInitiated];
|
|
154
|
-
if (!(issuanceSession === null || issuanceSession === void 0 ? void 0 : issuanceSession.presentation) ||
|
|
155
|
-
!issuanceSession.presentation.openId4VcVerificationSessionId ||
|
|
156
|
-
!issuanceSession.presentation.authSession ||
|
|
157
|
-
!allowedStates.includes(issuanceSession.state)) {
|
|
158
|
-
throw new oauth2_1.Oauth2ServerErrorResponseError({
|
|
159
|
-
error: oauth2_1.Oauth2ErrorCodes.InvalidSession,
|
|
160
|
-
error_description: `Invalid 'auth_session'`,
|
|
161
|
-
}, {
|
|
162
|
-
internalMessage: !issuanceSession
|
|
163
|
-
? `Issuance session not found for 'auth_session' parameter '${authorizationChallengeRequest.auth_session}'`
|
|
164
|
-
: !(issuanceSession === null || issuanceSession === void 0 ? void 0 : issuanceSession.presentation)
|
|
165
|
-
? `Issuance session '${issuanceSession.id}' has no 'presentation'. This should not happen and means state is corrupted`
|
|
166
|
-
: `Issuance session '${issuanceSession.id}' has state '${issuanceSession.state}' but expected one of ${allowedStates.join(', ')}`,
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
const { openId4VcVerificationSessionId } = issuanceSession.presentation;
|
|
170
|
-
await verifierApi
|
|
171
|
-
.getVerificationSessionById(openId4VcVerificationSessionId)
|
|
172
|
-
.catch(async () => {
|
|
173
|
-
// Issuance session is corrupted
|
|
174
|
-
issuanceSession.errorMessage = `Associated openId4VcVeificationSessionRecord with id '${openId4VcVerificationSessionId}' does not exist`;
|
|
175
|
-
await openId4VcIssuerService.updateState(agentContext, issuanceSession, OpenId4VcIssuanceSessionState_1.OpenId4VcIssuanceSessionState.Error);
|
|
176
|
-
throw new oauth2_1.Oauth2ServerErrorResponseError({
|
|
177
|
-
error: oauth2_1.Oauth2ErrorCodes.InvalidSession,
|
|
178
|
-
error_description: `Invalid 'auth_session'`,
|
|
179
|
-
}, {
|
|
180
|
-
internalMessage: `Openid4vc verification session with id '${openId4VcVerificationSessionId}' not found during issuance session with id '${issuanceSession.id}'`,
|
|
181
|
-
});
|
|
182
|
-
})
|
|
183
|
-
.then(async (verificationSession) => {
|
|
184
|
-
// Issuance session cannot be used anymore
|
|
185
|
-
if (verificationSession.state === openid4vc_verifier_1.OpenId4VcVerificationSessionState.Error) {
|
|
186
|
-
issuanceSession.errorMessage = `Associated openId4VcVerificationSessionRecord with id '${openId4VcVerificationSessionId}' has error state`;
|
|
187
|
-
await openId4VcIssuerService.updateState(agentContext, issuanceSession, OpenId4VcIssuanceSessionState_1.OpenId4VcIssuanceSessionState.Error);
|
|
188
|
-
}
|
|
189
|
-
if (verificationSession.state !== openid4vc_verifier_1.OpenId4VcVerificationSessionState.ResponseVerified ||
|
|
190
|
-
authorizationChallengeRequest.presentation_during_issuance_session !==
|
|
191
|
-
verificationSession.presentationDuringIssuanceSession) {
|
|
192
|
-
throw new oauth2_1.Oauth2ServerErrorResponseError({
|
|
193
|
-
error: oauth2_1.Oauth2ErrorCodes.InvalidSession,
|
|
194
|
-
error_description: `Invalid presentation for 'auth_session'`,
|
|
195
|
-
}, {
|
|
196
|
-
internalMessage: verificationSession.state !== openid4vc_verifier_1.OpenId4VcVerificationSessionState.ResponseVerified
|
|
197
|
-
? `Openid4vc verification session with id '${openId4VcVerificationSessionId}' has state '${verificationSession.state}', while '${openid4vc_verifier_1.OpenId4VcVerificationSessionState.ResponseVerified}' was expected.`
|
|
198
|
-
: `Openid4vc verification session with id '${openId4VcVerificationSessionId}' has 'presentation_during_issuance_session' '${verificationSession.presentationDuringIssuanceSession}', but authorization challenge request provided value '${authorizationChallengeRequest.presentation_during_issuance_session}'.`,
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
// Grant authorization
|
|
203
|
-
const authorizationCode = core_1.TypedArrayEncoder.toBase64URL(agentContext.wallet.getRandomValues(32));
|
|
204
|
-
const authorizationCodeExpiresAt = (0, utils_1.addSecondsToDate)(new Date(), config.authorizationCodeExpiresInSeconds);
|
|
205
|
-
issuanceSession.authorization = Object.assign(Object.assign({}, issuanceSession.authorization), { code: authorizationCode, codeExpiresAt: authorizationCodeExpiresAt });
|
|
206
|
-
// TODO: we need to start using locks so we can't get corrupted state
|
|
207
|
-
await openId4VcIssuerService.updateState(agentContext, issuanceSession, OpenId4VcIssuanceSessionState_1.OpenId4VcIssuanceSessionState.AuthorizationGranted);
|
|
208
|
-
const { authorizationChallengeResponse } = authorizationServer.createAuthorizationChallengeResponse({
|
|
209
|
-
authorizationCode,
|
|
210
|
-
});
|
|
211
|
-
return (0, router_1.sendJsonResponse)(response, next, authorizationChallengeResponse);
|
|
212
|
-
}
|
|
213
|
-
//# sourceMappingURL=authorizationChallengeEndpoint.js.map
|