@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":"OpenId4VcIssuerService.mjs","names":["OpenId4VcIssuerService","verification: OpenId4VciCredentialRequestToCredentialMapperOptions['verification']","credentialResponse: CredentialResponse","deferredCredentialResponse: DeferredCredentialResponse","firstNonce: string | undefined","proofSigners: Array<(JwtSignerWithJwk & { method: 'did' }) | JwtSignerJwk>","extraAuthorizationServers: AuthorizationServerMetadata[]","jwkThumbprint: string | undefined","grants: Parameters<Openid4vciIssuer['createCredentialOffer']>[0]['grants']","credentialConfigurationId","credentialConfiguration"],"sources":["../../src/openid4vc-issuer/OpenId4VcIssuerService.ts"],"sourcesContent":["import {\n AgentContext,\n ClaimFormat,\n CredoError,\n EventEmitter,\n injectable,\n JwsService,\n Jwt,\n JwtPayload,\n joinUriParts,\n Kms,\n MdocApi,\n type Query,\n type QueryOptions,\n SdJwtVcApi,\n TypedArrayEncoder,\n utils,\n W3cCredentialService,\n W3cV2CredentialService,\n} from '@credo-ts/core'\nimport {\n type AuthorizationServerMetadata,\n authorizationCodeGrantIdentifier,\n calculateJwkThumbprint,\n HashAlgorithm,\n type Jwk,\n type JwtSignerJwk,\n type JwtSignerWithJwk,\n Oauth2AuthorizationServer,\n Oauth2Client,\n Oauth2ErrorCodes,\n Oauth2ResourceServer,\n Oauth2ServerErrorResponseError,\n PkceCodeChallengeMethod,\n preAuthorizedCodeGrantIdentifier,\n} from '@openid4vc/oauth2'\nimport {\n type CredentialConfigurationSupportedWithFormats,\n type CredentialConfigurationsSupportedWithFormats,\n type CredentialIssuerMetadata,\n type CredentialRequestFormatSpecific,\n type CredentialResponse,\n type DeferredCredentialResponse,\n extractScopesForCredentialConfigurationIds,\n getCredentialConfigurationsMatchingRequestFormat,\n Openid4vciDraftVersion,\n Openid4vciIssuer,\n type ParseCredentialRequestReturn,\n} from '@openid4vc/openid4vci'\nimport { OpenId4VcVerifierApi } from '../openid4vc-verifier'\nimport type {\n OpenId4VciCredentialConfigurationSupportedWithFormats,\n OpenId4VciCredentialIssuerMetadata,\n OpenId4VciCredentialOfferPayload,\n OpenId4VciMetadata,\n OpenId4VcJwtIssuer,\n VerifiedOpenId4VcCredentialHolderBinding,\n} from '../shared'\nimport { OpenId4VciCredentialFormatProfile } from '../shared'\nimport { dynamicOid4vciClientAuthentication, getOid4vcCallbacks } from '../shared/callbacks'\nimport { getCredentialConfigurationsSupportedForScopes, getOfferedCredentials } from '../shared/issuerMetadataUtils'\nimport { storeActorIdForContextCorrelationId } from '../shared/router'\nimport {\n credoJwtIssuerToOpenId4VcJwtIssuer,\n decodeJwtIssuer,\n encodeJwtIssuer,\n getProofTypeFromPublicJwk,\n getPublicJwkFromDid,\n getSupportedJwaSignatureAlgorithms,\n} from '../shared/utils'\nimport { OpenId4VcIssuanceSessionState } from './OpenId4VcIssuanceSessionState'\nimport { type OpenId4VcIssuanceSessionStateChangedEvent, OpenId4VcIssuerEvents } from './OpenId4VcIssuerEvents'\nimport { OpenId4VcIssuerModuleConfig } from './OpenId4VcIssuerModuleConfig'\nimport type {\n OpenId4VciAuthorizationCodeFlowConfig,\n OpenId4VciCreateCredentialOfferOptions,\n OpenId4VciCreateCredentialResponseOptions,\n OpenId4VciCreateDeferredCredentialResponseOptions,\n OpenId4VciCreateIssuerOptions,\n OpenId4VciCreateStatelessCredentialOfferOptions,\n OpenId4VciCredentialRequestAuthorization,\n OpenId4VciCredentialRequestToCredentialMapperOptions,\n OpenId4VciPreAuthorizedCodeFlowConfig,\n OpenId4VciSignCredentials,\n OpenId4VciSignW3cCredentials,\n} from './OpenId4VcIssuerServiceOptions'\nimport {\n OpenId4VcIssuanceSessionRecord,\n OpenId4VcIssuanceSessionRepository,\n OpenId4VcIssuerRecord,\n OpenId4VcIssuerRepository,\n} from './repository'\nimport { generateTxCode } from './util/txCode'\n\n/**\n * @internal\n */\n@injectable()\nexport class OpenId4VcIssuerService {\n private w3cCredentialService: W3cCredentialService\n private w3cV2CredentialService: W3cV2CredentialService\n private openId4VcIssuerConfig: OpenId4VcIssuerModuleConfig\n private openId4VcIssuerRepository: OpenId4VcIssuerRepository\n private openId4VcIssuanceSessionRepository: OpenId4VcIssuanceSessionRepository\n\n public constructor(\n w3cCredentialService: W3cCredentialService,\n w3cV2CredentialService: W3cV2CredentialService,\n openId4VcIssuerConfig: OpenId4VcIssuerModuleConfig,\n openId4VcIssuerRepository: OpenId4VcIssuerRepository,\n openId4VcIssuanceSessionRepository: OpenId4VcIssuanceSessionRepository\n ) {\n this.w3cCredentialService = w3cCredentialService\n this.w3cV2CredentialService = w3cV2CredentialService\n this.openId4VcIssuerConfig = openId4VcIssuerConfig\n this.openId4VcIssuerRepository = openId4VcIssuerRepository\n this.openId4VcIssuanceSessionRepository = openId4VcIssuanceSessionRepository\n }\n\n public async createStatelessCredentialOffer(\n agentContext: AgentContext,\n options: OpenId4VciCreateStatelessCredentialOfferOptions & { issuer: OpenId4VcIssuerRecord }\n ): Promise<{ credentialOffer: string; credentialOfferObject: OpenId4VciCredentialOfferPayload }> {\n const { authorizationCodeFlowConfig, issuer, credentialConfigurationIds } = options\n const vcIssuer = this.getIssuer(agentContext)\n const issuerMetadata = await this.getIssuerMetadata(agentContext, issuer)\n\n const uniqueOfferedCredentials = Array.from(new Set(options.credentialConfigurationIds))\n if (uniqueOfferedCredentials.length !== credentialConfigurationIds.length) {\n throw new CredoError('All offered credentials must have unique ids.')\n }\n\n // Check if all the offered credential configuration ids have a scope value. If not, it won't be possible to actually request\n // issuance of the credential later on\n extractScopesForCredentialConfigurationIds({\n credentialConfigurationIds: options.credentialConfigurationIds,\n issuerMetadata,\n throwOnConfigurationWithoutScope: true,\n })\n\n if (authorizationCodeFlowConfig.authorizationServerUrl === issuerMetadata.credentialIssuer.credential_issuer) {\n throw new CredoError(\n 'Stateless offers can only be created for external authorization servers. Make sure to configure an external authorization server on the issuer record, and provide the authoriation server url.'\n )\n }\n\n const { credentialOffer, credentialOfferObject } = await vcIssuer.createCredentialOffer({\n credentialConfigurationIds: options.credentialConfigurationIds,\n grants: {\n authorization_code: {\n authorization_server: authorizationCodeFlowConfig.authorizationServerUrl,\n },\n },\n credentialOfferScheme: options.baseUri,\n issuerMetadata,\n })\n\n return {\n credentialOffer,\n credentialOfferObject,\n }\n }\n\n public async createCredentialOffer(\n agentContext: AgentContext,\n options: OpenId4VciCreateCredentialOfferOptions & { issuer: OpenId4VcIssuerRecord }\n ) {\n const {\n preAuthorizedCodeFlowConfig,\n authorizationCodeFlowConfig,\n issuer,\n credentialConfigurationIds,\n version = 'v1.draft15',\n authorization,\n } = options\n if (!preAuthorizedCodeFlowConfig && !authorizationCodeFlowConfig) {\n throw new CredoError('Authorization Config or Pre-Authorized Config must be provided.')\n }\n\n const vcIssuer = this.getIssuer(agentContext)\n const issuerMetadata = await this.getIssuerMetadata(agentContext, issuer)\n\n const uniqueOfferedCredentials = Array.from(new Set(options.credentialConfigurationIds))\n if (uniqueOfferedCredentials.length !== credentialConfigurationIds.length) {\n throw new CredoError('All offered credentials must have unique ids.')\n }\n\n if (uniqueOfferedCredentials.length === 0) {\n throw new CredoError('You need to offer at least one credential.')\n }\n\n // We always use shortened URIs currently\n const credentialOfferId = utils.uuid()\n const hostedCredentialOfferUri = joinUriParts(issuerMetadata.credentialIssuer.credential_issuer, [\n this.openId4VcIssuerConfig.credentialOfferEndpointPath,\n credentialOfferId,\n ])\n\n // Check if all the offered credential configuration ids have a scope value. If not, it won't be possible to actually request\n // issuance of the credential later on. For pre-auth it's not needed to add a scope.\n if (options.authorizationCodeFlowConfig) {\n extractScopesForCredentialConfigurationIds({\n credentialConfigurationIds: options.credentialConfigurationIds,\n issuerMetadata,\n throwOnConfigurationWithoutScope: true,\n })\n }\n\n const grants = await this.getGrantsFromConfig(agentContext, {\n issuer,\n issuerMetadata,\n preAuthorizedCodeFlowConfig,\n authorizationCodeFlowConfig,\n })\n\n const { credentialOffer, credentialOfferObject } = await vcIssuer.createCredentialOffer({\n credentialConfigurationIds: options.credentialConfigurationIds,\n grants,\n credentialOfferUri: hostedCredentialOfferUri,\n credentialOfferScheme: options.baseUri,\n issuerMetadata: {\n ...issuerMetadata,\n originalDraftVersion:\n version === 'v1.draft11-14' ? Openid4vciDraftVersion.Draft11 : Openid4vciDraftVersion.Draft15,\n },\n })\n\n const createdAt = new Date()\n const expiresAt = utils.addSecondsToDate(\n createdAt,\n this.openId4VcIssuerConfig.statefulCredentialOfferExpirationInSeconds\n )\n\n const chainedAuthorizationServerConfig = issuer.chainedAuthorizationServerConfigs?.find(\n (config) => config.issuer === authorizationCodeFlowConfig?.authorizationServerUrl\n )\n\n const issuanceSessionRepository = this.openId4VcIssuanceSessionRepository\n const issuanceSession = new OpenId4VcIssuanceSessionRecord({\n createdAt,\n expiresAt,\n credentialOfferPayload: credentialOfferObject,\n credentialOfferUri: hostedCredentialOfferUri,\n credentialOfferId,\n issuerId: issuer.issuerId,\n state: OpenId4VcIssuanceSessionState.OfferCreated,\n authorization: credentialOfferObject.grants?.authorization_code?.issuer_state\n ? {\n issuerState: credentialOfferObject.grants?.authorization_code?.issuer_state,\n }\n : undefined,\n presentation: authorizationCodeFlowConfig?.requirePresentationDuringIssuance\n ? {\n required: true,\n }\n : undefined,\n dpop: authorization?.requireDpop\n ? {\n required: true,\n }\n : undefined,\n walletAttestation: authorization?.requireWalletAttestation\n ? {\n required: true,\n }\n : undefined,\n chainedIdentity: chainedAuthorizationServerConfig\n ? {\n externalAuthorizationServerUrl: chainedAuthorizationServerConfig.issuer,\n }\n : undefined,\n // TODO: how to mix pre-auth and auth? Need to do state checks\n preAuthorizedCode: credentialOfferObject.grants?.[preAuthorizedCodeGrantIdentifier]?.['pre-authorized_code'],\n userPin: preAuthorizedCodeFlowConfig?.txCode\n ? generateTxCode(agentContext, preAuthorizedCodeFlowConfig.txCode)\n : undefined,\n generateRefreshTokens: options.generateRefreshTokens,\n issuanceMetadata: options.issuanceMetadata,\n openId4VciVersion: version,\n })\n await issuanceSessionRepository.save(agentContext, issuanceSession)\n this.emitStateChangedEvent(agentContext, issuanceSession, null)\n\n return {\n issuanceSession,\n credentialOffer,\n }\n }\n\n public async createCredentialResponse(\n agentContext: AgentContext,\n options: OpenId4VciCreateCredentialResponseOptions & { issuanceSession: OpenId4VcIssuanceSessionRecord }\n ): Promise<{ issuanceSession: OpenId4VcIssuanceSessionRecord; credentialResponse: CredentialResponse }> {\n options.issuanceSession.assertState([\n // OfferUriRetrieved is valid when doing auth flow (we should add a check)\n OpenId4VcIssuanceSessionState.OfferUriRetrieved,\n OpenId4VcIssuanceSessionState.AccessTokenCreated,\n OpenId4VcIssuanceSessionState.CredentialRequestReceived,\n // It is possible to issue multiple credentials in one session\n OpenId4VcIssuanceSessionState.CredentialsPartiallyIssued,\n ])\n const { issuanceSession } = options\n const issuer = await this.getIssuerByIssuerId(agentContext, options.issuanceSession.issuerId)\n const vcIssuer = this.getIssuer(agentContext, { issuanceSessionId: issuanceSession.id })\n const issuerMetadata = await this.getIssuerMetadata(agentContext, issuer)\n\n const parsedCredentialRequest = vcIssuer.parseCredentialRequest({\n issuerMetadata,\n credentialRequest: options.credentialRequest,\n })\n const {\n credentialRequest,\n credentialIdentifier,\n\n format,\n } = parsedCredentialRequest\n\n if (credentialIdentifier) {\n throw new Oauth2ServerErrorResponseError({\n error: Oauth2ErrorCodes.InvalidCredentialRequest,\n error_description: `Using unsupported 'credential_identifier'`,\n })\n }\n\n if (credentialRequest.format && !format && !parsedCredentialRequest.credentialConfigurationId) {\n throw new Oauth2ServerErrorResponseError({\n error: Oauth2ErrorCodes.UnsupportedCredentialFormat,\n error_description: `Unsupported credential request based on format '${credentialRequest.format}'`,\n })\n }\n\n if (parsedCredentialRequest.credentialConfigurationId && !parsedCredentialRequest.credentialConfiguration) {\n throw new Oauth2ServerErrorResponseError({\n error: Oauth2ErrorCodes.UnsupportedCredentialFormat,\n error_description: `Unsupported credential request based on credential configuration id ${credentialRequest.credential_configuration_id}`,\n })\n }\n\n const { credentialConfiguration, credentialConfigurationId } = this.getCredentialConfigurationsForRequest({\n issuanceSession,\n issuerMetadata,\n requestFormat: format,\n credentialConfigurations:\n parsedCredentialRequest.credentialConfiguration && parsedCredentialRequest.credentialConfigurationId\n ? {\n [parsedCredentialRequest.credentialConfigurationId]: parsedCredentialRequest.credentialConfiguration,\n }\n : undefined,\n authorization: options.authorization,\n })\n\n const verifiedCredentialRequestProofs = await this.verifyCredentialRequestProofs(agentContext, {\n issuanceSession,\n issuer,\n parsedCredentialRequest,\n credentialConfiguration,\n credentialConfigurationId,\n })\n\n const mapper =\n options.credentialRequestToCredentialMapper ?? this.openId4VcIssuerConfig.credentialRequestToCredentialMapper\n\n let verification: OpenId4VciCredentialRequestToCredentialMapperOptions['verification']\n\n // NOTE: this will throw an error if the verifier module is not registered and there is a\n // verification session. But you can't get here without the verifier module anyway\n if (issuanceSession.presentation?.openId4VcVerificationSessionId) {\n const verifierApi = agentContext.dependencyManager.resolve(OpenId4VcVerifierApi)\n const session = await verifierApi.getVerificationSessionById(\n issuanceSession.presentation.openId4VcVerificationSessionId\n )\n\n const response = await verifierApi.getVerifiedAuthorizationResponse(\n issuanceSession.presentation.openId4VcVerificationSessionId\n )\n\n if (response.presentationExchange) {\n verification = {\n session,\n presentationExchange: response.presentationExchange,\n }\n } else if (response.dcql) {\n verification = {\n session,\n dcql: response.dcql,\n }\n } else {\n throw new CredoError(\n `Verified authorization response for verification session with id '${session.id}' does not have presentationExchange or dcql defined.`\n )\n }\n }\n\n const signOptionsOrDeferral = await mapper({\n agentContext,\n issuanceSession,\n holderBinding: verifiedCredentialRequestProofs,\n credentialOffer: issuanceSession.credentialOfferPayload,\n\n verification,\n\n credentialRequest: options.credentialRequest,\n credentialRequestFormat: format,\n\n // Matching credential configuration\n credentialConfiguration,\n credentialConfigurationId,\n\n // Authorization\n authorization: options.authorization,\n })\n\n let credentialResponse: CredentialResponse\n\n // NOTE: nonce in credential response is deprecated in newer drafts, but for now we keep it in\n const { cNonce, cNonceExpiresInSeconds } = await this.createNonce(agentContext, issuer)\n\n if (signOptionsOrDeferral.type === 'deferral') {\n credentialResponse = vcIssuer.createCredentialResponse({\n transactionId: signOptionsOrDeferral.transactionId,\n interval: signOptionsOrDeferral.interval,\n cNonce,\n cNonceExpiresInSeconds,\n credentialRequest: parsedCredentialRequest,\n })\n\n // Save transaction data for deferred issuance\n issuanceSession.transactions.push({\n transactionId: signOptionsOrDeferral.transactionId,\n numberOfCredentials: verifiedCredentialRequestProofs.keys.length,\n credentialConfigurationId,\n })\n\n // Determine new state\n const newState =\n issuanceSession.state === OpenId4VcIssuanceSessionState.CredentialsPartiallyIssued\n ? OpenId4VcIssuanceSessionState.CredentialsPartiallyIssued\n : OpenId4VcIssuanceSessionState.CredentialRequestReceived\n\n // Update expiry time to allow for re-check\n await this.updateExpiresAt(agentContext, issuanceSession, signOptionsOrDeferral.interval)\n\n // Update state\n await this.updateState(agentContext, issuanceSession, newState)\n } else {\n const credentials = await this.getSignedCredentials(agentContext, signOptionsOrDeferral, {\n issuanceSession,\n credentialConfiguration,\n expectedLength: verifiedCredentialRequestProofs.keys.length,\n })\n\n credentialResponse = vcIssuer.createCredentialResponse({\n credential: credentialRequest.proof ? credentials.credentials[0] : undefined,\n credentials: credentialRequest.proofs\n ? issuanceSession.openId4VciVersion === 'v1' || issuanceSession.openId4VciVersion === 'v1.draft15'\n ? credentials.credentials.map((c) => ({ credential: c }))\n : credentials.credentials\n : undefined,\n cNonce,\n cNonceExpiresInSeconds,\n credentialRequest: parsedCredentialRequest,\n })\n\n issuanceSession.issuedCredentials.push(credentialConfigurationId)\n const newState =\n issuanceSession.issuedCredentials.length >=\n issuanceSession.credentialOfferPayload.credential_configuration_ids.length\n ? OpenId4VcIssuanceSessionState.Completed\n : OpenId4VcIssuanceSessionState.CredentialsPartiallyIssued\n await this.updateState(agentContext, issuanceSession, newState)\n }\n\n return {\n credentialResponse,\n issuanceSession,\n }\n }\n\n public async createDeferredCredentialResponse(\n agentContext: AgentContext,\n options: OpenId4VciCreateDeferredCredentialResponseOptions & { issuanceSession: OpenId4VcIssuanceSessionRecord }\n ): Promise<{\n issuanceSession: OpenId4VcIssuanceSessionRecord\n deferredCredentialResponse: DeferredCredentialResponse\n }> {\n options.issuanceSession.assertState([\n OpenId4VcIssuanceSessionState.CredentialRequestReceived,\n OpenId4VcIssuanceSessionState.CredentialsPartiallyIssued,\n ])\n const transaction = options.issuanceSession.transactions.find(\n (tx) => tx.transactionId === options.deferredCredentialRequest.transaction_id\n )\n if (!transaction) {\n throw new CredoError('OpenId4VcIssuanceSessionRecord does not contain transaction with given transaction_id.')\n }\n\n const { issuanceSession } = options\n const issuer = await this.getIssuerByIssuerId(agentContext, options.issuanceSession.issuerId)\n const vcIssuer = this.getIssuer(agentContext, { issuanceSessionId: issuanceSession.id })\n\n const credentialConfigurationId = transaction.credentialConfigurationId\n const credentialConfiguration = issuer.credentialConfigurationsSupported[transaction.credentialConfigurationId]\n if (!credentialConfiguration) {\n throw new CredoError(\n 'Issuer does not contain credential configuration for the given credential configuration id.'\n )\n }\n\n const mapper =\n options.deferredCredentialRequestToCredentialMapper ??\n this.openId4VcIssuerConfig.deferredCredentialRequestToCredentialMapper\n if (!mapper) {\n throw new CredoError(\n 'OpenId4VcIssuerService does not have a defined deferredCredentialRequestToCredentialMapper.'\n )\n }\n\n const signOptionsOrDeferral = await mapper({\n agentContext,\n issuanceSession,\n deferredCredentialRequest: options.deferredCredentialRequest,\n authorization: options.authorization,\n })\n\n let deferredCredentialResponse: DeferredCredentialResponse\n if (signOptionsOrDeferral.type === 'deferral') {\n deferredCredentialResponse = vcIssuer.createDeferredCredentialResponse({\n interval: signOptionsOrDeferral.interval,\n transactionId: signOptionsOrDeferral.transactionId,\n })\n\n // Update expiry time to allow for re-check\n await this.updateExpiresAt(agentContext, issuanceSession, signOptionsOrDeferral.interval)\n } else {\n const credentials = await this.getSignedCredentials(agentContext, signOptionsOrDeferral, {\n issuanceSession,\n credentialConfiguration,\n expectedLength: transaction.numberOfCredentials,\n })\n\n deferredCredentialResponse = vcIssuer.createDeferredCredentialResponse({\n credentials: credentials.credentials.map((c) => ({ credential: c })),\n })\n\n issuanceSession.issuedCredentials.push(credentialConfigurationId)\n\n // Remove the transaction from the session, as it is now completed\n issuanceSession.transactions = issuanceSession.transactions?.filter(\n (tx) => tx.transactionId !== transaction.transactionId\n )\n\n // Determine new state\n const newState =\n issuanceSession.issuedCredentials.length >=\n issuanceSession.credentialOfferPayload.credential_configuration_ids.length\n ? OpenId4VcIssuanceSessionState.Completed\n : OpenId4VcIssuanceSessionState.CredentialsPartiallyIssued\n\n await this.updateState(agentContext, issuanceSession, newState)\n }\n\n return {\n deferredCredentialResponse,\n issuanceSession,\n }\n }\n\n private async verifyCredentialRequestProofs(\n agentContext: AgentContext,\n options: {\n parsedCredentialRequest: ParseCredentialRequestReturn\n issuer: OpenId4VcIssuerRecord\n issuanceSession: OpenId4VcIssuanceSessionRecord\n credentialConfigurationId: string\n credentialConfiguration: CredentialConfigurationSupportedWithFormats\n }\n ): Promise<VerifiedOpenId4VcCredentialHolderBinding> {\n const { parsedCredentialRequest, issuer, issuanceSession, credentialConfiguration, credentialConfigurationId } =\n options\n const { proofs } = parsedCredentialRequest\n\n const vcIssuer = this.getIssuer(agentContext, { issuanceSessionId: issuanceSession.id })\n const issuerMetadata = await this.getIssuerMetadata(agentContext, issuer)\n\n const allowedProofTypes = credentialConfiguration.proof_types_supported ?? {\n jwt: { proof_signing_alg_values_supported: getSupportedJwaSignatureAlgorithms(agentContext) },\n }\n\n const [proofType, proofValue] = (Object.entries(proofs ?? {})[0] as [string, string[]] | undefined) ?? []\n if (!proofType || !proofValue || proofValue.length === 0) {\n const { cNonce, cNonceExpiresInSeconds } = await this.createNonce(agentContext, issuer)\n throw new Oauth2ServerErrorResponseError({\n error: Oauth2ErrorCodes.InvalidProof,\n error_description: 'Missing required proof(s) in credential request',\n c_nonce: cNonce,\n c_nonce_expires_in: cNonceExpiresInSeconds,\n })\n }\n\n if (proofType !== 'jwt' && proofType !== 'attestation') {\n throw new Oauth2ServerErrorResponseError({\n error: Oauth2ErrorCodes.InvalidProof,\n error_description: `Proof type '${proofType}' is not supported `,\n })\n }\n\n const supportedProofType = allowedProofTypes[proofType]\n if (!supportedProofType) {\n throw new Oauth2ServerErrorResponseError({\n error: Oauth2ErrorCodes.InvalidProof,\n error_description: `Proof type '${proofType}' is not supported for credential configuration '${credentialConfigurationId}'`,\n })\n }\n\n if (proofType === 'attestation' && proofValue.length !== 1) {\n throw new Oauth2ServerErrorResponseError({\n error: Oauth2ErrorCodes.InvalidProof,\n error_description: \"Only a single proofs entry is supported for proof type 'attestation'\",\n })\n }\n\n await this.updateState(agentContext, issuanceSession, OpenId4VcIssuanceSessionState.CredentialRequestReceived)\n\n if (proofType === 'attestation') {\n const keyAttestationJwt = proofValue[0]\n const keyAttestation = await vcIssuer.verifyCredentialRequestAttestationProof({\n issuerMetadata,\n keyAttestationJwt,\n })\n\n if (!supportedProofType.proof_signing_alg_values_supported.includes(keyAttestation.header.alg)) {\n throw new Oauth2ServerErrorResponseError({\n error: Oauth2ErrorCodes.InvalidProof,\n error_description: `Proof signing alg value '${keyAttestation.header.alg}' is not supported for proof type 'attestation' in credential configuration '${credentialConfigurationId}'`,\n })\n }\n\n if (!keyAttestation.payload.nonce) {\n const { cNonce, cNonceExpiresInSeconds } = await this.createNonce(agentContext, issuer)\n throw new Oauth2ServerErrorResponseError({\n error: Oauth2ErrorCodes.InvalidProof,\n error_description:\n 'Missing nonce in attestation proof in credential request. If no nonce is present in the attestation, use the jwt proof type instead',\n c_nonce: cNonce,\n c_nonce_expires_in: cNonceExpiresInSeconds,\n })\n }\n\n if (supportedProofType.key_attestations_required && keyAttestation) {\n const expectedKeyStorage = supportedProofType.key_attestations_required.key_storage\n const expectedUserAuthentication = supportedProofType.key_attestations_required.user_authentication\n\n if (\n expectedKeyStorage &&\n !expectedKeyStorage.some((keyStorage) => keyAttestation.payload.key_storage?.includes(keyStorage))\n ) {\n throw new Oauth2ServerErrorResponseError({\n error: Oauth2ErrorCodes.InvalidProof,\n error_description: `Insufficient key_storage for key attestation. Proof type 'attestation' for credential configuration '${credentialConfigurationId}', expects one of key_storage values ${expectedKeyStorage.join(', ')}`,\n })\n }\n\n if (\n expectedUserAuthentication &&\n !expectedUserAuthentication.some((userAuthentication) =>\n keyAttestation.payload.user_authentication?.includes(userAuthentication)\n )\n ) {\n throw new Oauth2ServerErrorResponseError({\n error: Oauth2ErrorCodes.InvalidProof,\n error_description: `Insufficient user_authentication for key attestation. Proof type 'attestation' for credential configuration '${credentialConfigurationId}', expects one of user_authentication values ${expectedUserAuthentication.join(', ')}`,\n })\n }\n }\n\n await this.verifyNonce(agentContext, issuer, keyAttestation.payload.nonce).catch(async (error) => {\n const { cNonce, cNonceExpiresInSeconds } = await this.createNonce(agentContext, issuer)\n throw new Oauth2ServerErrorResponseError(\n {\n error: Oauth2ErrorCodes.InvalidNonce,\n error_description: 'Invalid nonce in credential request',\n c_nonce: cNonce,\n c_nonce_expires_in: cNonceExpiresInSeconds,\n },\n {\n cause: error,\n }\n )\n })\n\n return {\n bindingMethod: 'jwk',\n keys: keyAttestation.payload.attested_keys.map((attestedKey) => {\n return {\n method: 'jwk',\n jwk: Kms.PublicJwk.fromUnknown(attestedKey),\n }\n }),\n proofType: 'attestation',\n\n // It's up to the credential request mapper to ensure we trust the key attestation signer\n // For x5c it's kinda covered already.\n keyAttestation,\n }\n }\n\n if (proofType === 'jwt') {\n let firstNonce: string | undefined\n const proofSigners: Array<(JwtSignerWithJwk & { method: 'did' }) | JwtSignerJwk> = []\n\n for (const jwt of proofValue) {\n const { signer, payload, header, keyAttestation } = await vcIssuer.verifyCredentialRequestJwtProof({\n issuerMetadata,\n jwt,\n clientId: options.issuanceSession.clientId,\n })\n\n // TODO: we should probably do this check before signature verification, but we then we\n // first need to decode the jwt\n if (!supportedProofType.proof_signing_alg_values_supported.includes(header.alg)) {\n throw new Oauth2ServerErrorResponseError({\n error: Oauth2ErrorCodes.InvalidProof,\n error_description: `Proof signing alg value '${header.alg}' is not supported for proof type 'jwt' in credential configuration '${credentialConfigurationId}'`,\n })\n }\n\n if (signer.method !== 'jwk' && signer.method !== 'did') {\n throw new Oauth2ServerErrorResponseError({\n error: Oauth2ErrorCodes.InvalidProof,\n error_description: \"Only 'jwk' and 'did' binding methods supported for jwt proof\",\n })\n }\n\n if (proofSigners[0] && signer.method !== proofSigners[0].method) {\n throw new Oauth2ServerErrorResponseError({\n error: Oauth2ErrorCodes.InvalidProof,\n error_description:\n \"All proofs must be signed using the same binding method. Found a mix of 'did' and 'jwk'\",\n })\n }\n\n if (proofSigners[0] && signer.alg !== proofSigners[0].alg) {\n throw new Oauth2ServerErrorResponseError({\n error: Oauth2ErrorCodes.InvalidProof,\n error_description:\n \"All proofs must be signed using the same alg value. Found a mix of different 'alg' values.\",\n })\n }\n\n if (keyAttestation && signer.method === 'did') {\n throw new Oauth2ServerErrorResponseError({\n error: Oauth2ErrorCodes.InvalidProof,\n error_description: \"Binding method 'did' is not supported when a key attestation is provided.\",\n })\n }\n\n if (supportedProofType.key_attestations_required && !keyAttestation) {\n throw new Oauth2ServerErrorResponseError({\n error: Oauth2ErrorCodes.InvalidProof,\n error_description: `Missing required key attestation. Key attestations are required for proof type 'jwt' in credential configuration '${credentialConfigurationId}'`,\n })\n }\n\n if (supportedProofType.key_attestations_required && keyAttestation) {\n const expectedKeyStorage = supportedProofType.key_attestations_required.key_storage\n const expectedUserAuthentication = supportedProofType.key_attestations_required.user_authentication\n\n if (\n expectedKeyStorage &&\n !expectedKeyStorage.some((keyStorage) => keyAttestation.payload.key_storage?.includes(keyStorage))\n ) {\n throw new Oauth2ServerErrorResponseError({\n error: Oauth2ErrorCodes.InvalidProof,\n error_description: `Insufficient key_storage for key attestation. Proof type 'jwt' for credential configuration '${credentialConfigurationId}', expects one of key_storage values ${expectedKeyStorage.join(', ')}`,\n })\n }\n\n if (\n expectedUserAuthentication &&\n !expectedUserAuthentication.some((userAuthentication) =>\n keyAttestation.payload.user_authentication?.includes(userAuthentication)\n )\n ) {\n throw new Oauth2ServerErrorResponseError({\n error: Oauth2ErrorCodes.InvalidProof,\n error_description: `Insufficient user_authentication for key attestation. Proof type 'jwt' for credential configuration '${credentialConfigurationId}', expects one of user_authentication values ${expectedUserAuthentication.join(', ')}`,\n })\n }\n }\n\n if (keyAttestation && proofValue.length > 1) {\n throw new Oauth2ServerErrorResponseError({\n error: Oauth2ErrorCodes.InvalidProof,\n error_description:\n \"Only a single proofs entry is supported when jwt proof header contains 'key_attestation'\",\n })\n }\n\n if (!payload.nonce) {\n const { cNonce, cNonceExpiresInSeconds } = await this.createNonce(agentContext, issuer)\n throw new Oauth2ServerErrorResponseError({\n error: Oauth2ErrorCodes.InvalidProof,\n error_description: 'Missing nonce in proof(s) in credential request',\n c_nonce: cNonce,\n c_nonce_expires_in: cNonceExpiresInSeconds,\n })\n }\n\n // Set previous nonce if not yet set (first iteration)\n if (!firstNonce) firstNonce = payload.nonce\n if (firstNonce !== payload.nonce) {\n const { cNonce, cNonceExpiresInSeconds } = await this.createNonce(agentContext, issuer)\n throw new Oauth2ServerErrorResponseError({\n error: Oauth2ErrorCodes.InvalidProof,\n error_description: 'Not all nonce values in proofs are equal',\n c_nonce: cNonce,\n c_nonce_expires_in: cNonceExpiresInSeconds,\n })\n }\n\n // IF nonce is provided in the key attestation (not required with jwt proof) then\n // it MUST match with the nonce of the JWT proof\n if (keyAttestation?.payload.nonce && keyAttestation.payload.nonce !== payload.nonce) {\n throw new Oauth2ServerErrorResponseError({\n error: Oauth2ErrorCodes.InvalidProof,\n error_description:\n 'If a nonce is present in the key attestation, the nonce in the proof jwt must be equal to the nonce in the key attestation',\n })\n }\n\n // Verify the nonce\n await this.verifyNonce(agentContext, issuer, payload.nonce).catch(async (error) => {\n const { cNonce, cNonceExpiresInSeconds } = await this.createNonce(agentContext, issuer)\n throw new Oauth2ServerErrorResponseError(\n {\n error: Oauth2ErrorCodes.InvalidNonce,\n error_description: 'Invalid nonce in credential request',\n c_nonce: cNonce,\n c_nonce_expires_in: cNonceExpiresInSeconds,\n },\n {\n cause: error,\n }\n )\n })\n\n if (keyAttestation) {\n return {\n proofType: 'jwt',\n bindingMethod: 'jwk',\n keys: keyAttestation.payload.attested_keys.map((attestedKey) => {\n return {\n method: 'jwk',\n jwk: Kms.PublicJwk.fromUnknown(attestedKey),\n }\n }),\n keyAttestation,\n }\n }\n proofSigners.push(signer)\n }\n\n if (proofSigners[0].method === 'did') {\n const signers = proofSigners as Array<JwtSignerWithJwk & { method: 'did' }>\n return {\n proofType: 'jwt',\n bindingMethod: 'did',\n keys: signers.map((signer) => ({\n didUrl: signer.didUrl,\n method: 'did',\n jwk: Kms.PublicJwk.fromUnknown(signer.publicJwk),\n })),\n }\n }\n\n return {\n proofType: 'jwt',\n bindingMethod: 'jwk',\n keys: (proofSigners as JwtSignerJwk[]).map((signer) => {\n return {\n method: 'jwk',\n jwk: Kms.PublicJwk.fromUnknown(signer.publicJwk),\n }\n }),\n }\n }\n\n // This will not happen, but to make TS happy\n throw new Oauth2ServerErrorResponseError({\n error: Oauth2ErrorCodes.InvalidProof,\n error_description: 'Missing required proof(s) in credential request',\n })\n }\n\n public async findIssuanceSessionsByQuery(\n agentContext: AgentContext,\n query: Query<OpenId4VcIssuanceSessionRecord>,\n queryOptions?: QueryOptions\n ) {\n return this.openId4VcIssuanceSessionRepository.findByQuery(agentContext, query, queryOptions)\n }\n\n public async findSingleIssuanceSessionByQuery(\n agentContext: AgentContext,\n query: Query<OpenId4VcIssuanceSessionRecord>\n ) {\n return this.openId4VcIssuanceSessionRepository.findSingleByQuery(agentContext, query)\n }\n\n public async getIssuanceSessionById(agentContext: AgentContext, issuanceSessionId: string) {\n return this.openId4VcIssuanceSessionRepository.getById(agentContext, issuanceSessionId)\n }\n\n public async getAllIssuers(agentContext: AgentContext) {\n return this.openId4VcIssuerRepository.getAll(agentContext)\n }\n\n public async getIssuerByIssuerId(agentContext: AgentContext, issuerId: string) {\n return this.openId4VcIssuerRepository.getByIssuerId(agentContext, issuerId)\n }\n\n public async updateIssuer(agentContext: AgentContext, issuer: OpenId4VcIssuerRecord) {\n if (issuer.signedMetadata) {\n const issuerMetadata = await this.getIssuerMetadata(agentContext, issuer, false)\n issuer.signedMetadata = await this.createSignedMetadata(\n agentContext,\n issuerMetadata.credentialIssuer,\n decodeJwtIssuer(issuer.signedMetadata.signer)\n )\n }\n\n await this.openId4VcIssuerRepository.update(agentContext, issuer)\n }\n\n public async createIssuer(agentContext: AgentContext, options: OpenId4VciCreateIssuerOptions) {\n const kms = agentContext.resolve(Kms.KeyManagementApi)\n\n // TODO: ideally we can store additional data with a key, such as:\n // - createdAt\n // - purpose\n const accessTokenSignerKey = await kms.createKey({\n type: options.accessTokenSignerKeyType ?? { kty: 'OKP', crv: 'Ed25519' },\n })\n\n const openId4VcIssuer = new OpenId4VcIssuerRecord({\n issuerId: options.issuerId ?? utils.uuid(),\n display: options.display,\n dpopSigningAlgValuesSupported: options.dpopSigningAlgValuesSupported,\n accessTokenPublicJwk: accessTokenSignerKey.publicJwk,\n authorizationServerConfigs: options.authorizationServerConfigs,\n credentialConfigurationsSupported: options.credentialConfigurationsSupported,\n batchCredentialIssuance: options.batchCredentialIssuance,\n })\n\n if (options.metadataSigner) {\n const issuerMetadata = await this.getIssuerMetadata(agentContext, openId4VcIssuer, false)\n openId4VcIssuer.signedMetadata = await this.createSignedMetadata(\n agentContext,\n issuerMetadata.credentialIssuer,\n options.metadataSigner\n )\n }\n\n await this.openId4VcIssuerRepository.save(agentContext, openId4VcIssuer)\n await storeActorIdForContextCorrelationId(agentContext, openId4VcIssuer.issuerId)\n return openId4VcIssuer\n }\n\n private async createSignedMetadata(\n agentContext: AgentContext,\n credentialIssuerMetadata: OpenId4VciCredentialIssuerMetadata,\n metadataSigner: OpenId4VcJwtIssuer\n ) {\n const issuer = this.getIssuer(agentContext)\n const credentialIssuerMetadataJwt = await issuer.createSignedCredentialIssuerMetadataJwt({\n credentialIssuerMetadata,\n signer: await credoJwtIssuerToOpenId4VcJwtIssuer(agentContext, metadataSigner),\n })\n\n return {\n jwt: credentialIssuerMetadataJwt,\n signer: encodeJwtIssuer(metadataSigner),\n }\n }\n\n public async rotateAccessTokenSigningKey(\n agentContext: AgentContext,\n issuer: OpenId4VcIssuerRecord,\n options?: Pick<OpenId4VciCreateIssuerOptions, 'accessTokenSignerKeyType'>\n ) {\n const kms = agentContext.resolve(Kms.KeyManagementApi)\n\n const previousKey = issuer.resolvedAccessTokenPublicJwk\n const accessTokenSignerKey = await kms.createKey({\n type: options?.accessTokenSignerKeyType ?? { kty: 'OKP', crv: 'Ed25519' },\n })\n\n issuer.accessTokenPublicJwk = accessTokenSignerKey.publicJwk\n await this.openId4VcIssuerRepository.update(agentContext, issuer)\n\n // Remove previous key\n await kms.deleteKey({\n keyId: previousKey.keyId,\n })\n }\n\n /**\n * @param fetchExternalAuthorizationServerMetadata defaults to false\n */\n public async getIssuerMetadata(\n agentContext: AgentContext,\n issuerRecord: OpenId4VcIssuerRecord,\n fetchExternalAuthorizationServerMetadata = false\n ) {\n const config = agentContext.dependencyManager.resolve(OpenId4VcIssuerModuleConfig)\n const issuerUrl = joinUriParts(config.baseUrl, [issuerRecord.issuerId])\n const oauth2Client = this.getOauth2Client(agentContext)\n const directAuthorizationServerConfigs = issuerRecord.directAuthorizationServerConfigs\n\n const extraAuthorizationServers: AuthorizationServerMetadata[] =\n fetchExternalAuthorizationServerMetadata && directAuthorizationServerConfigs\n ? await Promise.all(\n directAuthorizationServerConfigs.map(async (server) => {\n const metadata = await oauth2Client.fetchAuthorizationServerMetadata(server.issuer)\n if (!metadata)\n throw new CredoError(`Authorization server metadata not found for issuer '${server.issuer}'`)\n return metadata\n })\n )\n : []\n\n const authorizationServers =\n directAuthorizationServerConfigs && directAuthorizationServerConfigs.length > 0\n ? [\n ...directAuthorizationServerConfigs.map((authorizationServer) => authorizationServer.issuer),\n // Our issuer is also a valid authorization server (for pre-auth and chained auth)\n issuerUrl,\n ]\n : undefined\n\n const credentialIssuerMetadata = {\n credential_issuer: issuerUrl,\n credential_endpoint: joinUriParts(issuerUrl, [config.credentialEndpointPath]),\n deferred_credential_endpoint: joinUriParts(issuerUrl, [config.deferredCredentialEndpointPath]),\n credential_configurations_supported: issuerRecord.credentialConfigurationsSupported ?? {},\n authorization_servers: authorizationServers,\n display: issuerRecord.display,\n nonce_endpoint: joinUriParts(issuerUrl, [config.nonceEndpointPath]),\n batch_credential_issuance: issuerRecord.batchCredentialIssuance\n ? {\n batch_size: issuerRecord.batchCredentialIssuance.batchSize,\n }\n : undefined,\n } satisfies CredentialIssuerMetadata\n\n const issuerAuthorizationServer = {\n issuer: issuerUrl,\n token_endpoint: joinUriParts(issuerUrl, [config.accessTokenEndpointPath]),\n 'pre-authorized_grant_anonymous_access_supported': true,\n\n jwks_uri: joinUriParts(issuerUrl, [config.jwksEndpointPath]),\n\n grant_types_supported: [authorizationCodeGrantIdentifier, preAuthorizedCodeGrantIdentifier],\n\n authorization_challenge_endpoint: joinUriParts(issuerUrl, [config.authorizationChallengeEndpointPath]),\n authorization_endpoint: joinUriParts(issuerUrl, [config.authorizationEndpoint]),\n\n pushed_authorization_request_endpoint: joinUriParts(issuerUrl, [config.pushedAuthorizationRequestEndpoint]),\n require_pushed_authorization_requests: true,\n\n code_challenge_methods_supported: [PkceCodeChallengeMethod.S256],\n dpop_signing_alg_values_supported: issuerRecord.dpopSigningAlgValuesSupported,\n } satisfies AuthorizationServerMetadata\n\n return {\n originalDraftVersion: Openid4vciDraftVersion.V1,\n credentialIssuer: credentialIssuerMetadata,\n authorizationServers: [issuerAuthorizationServer, ...extraAuthorizationServers],\n knownCredentialConfigurations: credentialIssuerMetadata.credential_configurations_supported,\n\n signedMetadataJwt: issuerRecord.signedMetadata?.jwt,\n }\n }\n\n public async createNonce(agentContext: AgentContext, issuer: OpenId4VcIssuerRecord) {\n const issuerMetadata = await this.getIssuerMetadata(agentContext, issuer)\n const jwsService = agentContext.dependencyManager.resolve(JwsService)\n\n const cNonceExpiresInSeconds = this.openId4VcIssuerConfig.cNonceExpiresInSeconds\n const cNonceExpiresAt = utils.addSecondsToDate(new Date(), cNonceExpiresInSeconds)\n\n const key = issuer.resolvedAccessTokenPublicJwk\n const cNonce = await jwsService.createJwsCompact(agentContext, {\n keyId: key.keyId,\n payload: JwtPayload.fromJson({\n iss: issuerMetadata.credentialIssuer.credential_issuer,\n exp: utils.dateToSeconds(cNonceExpiresAt),\n }),\n protectedHeaderOptions: {\n typ: 'credo+cnonce',\n kid: key.keyId,\n alg: key.signatureAlgorithm,\n },\n })\n\n return {\n cNonce,\n cNonceExpiresAt,\n cNonceExpiresInSeconds,\n }\n }\n\n /**\n * @todo nonces are very short lived (1 min), but it might be nice to also cache the nonces\n * in the cache if we have 'seen' them. They will only be in the cache for a short time\n * and it will prevent replay\n */\n private async verifyNonce(agentContext: AgentContext, issuer: OpenId4VcIssuerRecord, cNonce: string) {\n const issuerMetadata = await this.getIssuerMetadata(agentContext, issuer)\n const jwsService = agentContext.dependencyManager.resolve(JwsService)\n\n const key = issuer.resolvedAccessTokenPublicJwk\n const jwt = Jwt.fromSerializedJwt(cNonce)\n jwt.payload.validate()\n\n if (jwt.payload.iss !== issuerMetadata.credentialIssuer.credential_issuer) {\n throw new CredoError(`Invalid 'iss' claim in cNonce jwt`)\n }\n if (jwt.header.typ !== 'credo+cnonce') {\n throw new CredoError(`Invalid 'typ' claim in cNonce jwt header`)\n }\n\n const verification = await jwsService.verifyJws(agentContext, {\n jws: cNonce,\n jwsSigner: {\n method: 'jwk',\n jwk: key,\n },\n })\n\n if (!verification.isValid) {\n throw new CredoError('Invalid nonce')\n }\n }\n\n public async createRefreshToken(\n agentContext: AgentContext,\n issuer: OpenId4VcIssuerRecord,\n options: {\n issuerState?: string\n preAuthorizedCode?: string\n dpop?: {\n jwk: Jwk\n }\n }\n ) {\n const issuerMetadata = await this.getIssuerMetadata(agentContext, issuer)\n const jwsService = agentContext.dependencyManager.resolve(JwsService)\n\n const expiresInSeconds = this.openId4VcIssuerConfig.refreshTokenExpiresInSeconds\n const expiresAt = utils.addSecondsToDate(new Date(), expiresInSeconds)\n\n const key = issuer.resolvedAccessTokenPublicJwk\n const refreshToken = await jwsService.createJwsCompact(agentContext, {\n keyId: key.keyId,\n payload: JwtPayload.fromJson({\n iss: issuerMetadata.credentialIssuer.credential_issuer,\n aud: issuerMetadata.credentialIssuer.credential_issuer,\n exp: utils.dateToSeconds(expiresAt),\n issuer_state: options.issuerState,\n 'pre-authorized_code': options.preAuthorizedCode,\n cnf: options.dpop\n ? {\n jkt: await calculateJwkThumbprint({\n hashAlgorithm: HashAlgorithm.Sha256,\n hashCallback: getOid4vcCallbacks(agentContext).hash,\n jwk: options.dpop.jwk,\n }),\n }\n : undefined,\n }),\n protectedHeaderOptions: {\n typ: 'credo+refresh_token',\n kid: key.keyId,\n alg: key.signatureAlgorithm,\n },\n })\n\n return refreshToken\n }\n\n public parseRefreshToken(token: string) {\n const jwt = Jwt.fromSerializedJwt(token)\n jwt.payload.validate()\n\n if (!jwt.payload.exp) {\n throw new CredoError(`Missing 'exp' claim in refresh token jwt`)\n }\n if (jwt.header.typ !== 'credo+refresh_token') {\n throw new CredoError(`Invalid 'typ' claim in refresh token jwt header`)\n }\n\n const { 'pre-authorized_code': preAuthorizedCode, issuer_state: issuerState, cnf } = jwt.payload.additionalClaims\n\n if (preAuthorizedCode && typeof preAuthorizedCode !== 'string') {\n throw new CredoError(`Invalid 'pre-authorized_code' claim in refresh token jwt payload`)\n }\n\n if (issuerState && typeof issuerState !== 'string') {\n throw new CredoError(`Invalid 'issuer_state' claim in refresh token jwt payload`)\n }\n\n if (!preAuthorizedCode && !issuerState) {\n throw new CredoError(`Missing 'issuer_state' or 'pre-authorized_code' claim in refresh token jwt payload`)\n }\n\n let jwkThumbprint: string | undefined\n if (cnf) {\n if (typeof cnf !== 'object' || !('jkt' in cnf) || typeof cnf.jkt !== 'string') {\n throw new CredoError(`Invalid 'cnf' claim in refresh token jwt payload`)\n }\n\n jwkThumbprint = cnf.jkt\n }\n\n return {\n jwt,\n expiresAt: new Date(jwt.payload.exp * 1000),\n issuerState: issuerState as string | undefined,\n preAuthorizedCode: preAuthorizedCode as string | undefined,\n dpop: jwkThumbprint\n ? {\n jwkThumbprint,\n }\n : undefined,\n }\n }\n\n public async verifyRefreshToken(\n agentContext: AgentContext,\n issuer: OpenId4VcIssuerRecord,\n parsedRefreshToken: ReturnType<OpenId4VcIssuerService['parseRefreshToken']>,\n options: {\n dpop?: {\n jwkThumbprint?: string\n }\n } = {}\n ) {\n const issuerMetadata = await this.getIssuerMetadata(agentContext, issuer)\n const jwsService = agentContext.dependencyManager.resolve(JwsService)\n\n const key = issuer.resolvedAccessTokenPublicJwk\n\n if (parsedRefreshToken.jwt.payload.iss !== issuerMetadata.credentialIssuer.credential_issuer) {\n throw new CredoError(`Invalid 'iss' claim in refresh token jwt`)\n }\n if (parsedRefreshToken.jwt.payload.aud !== issuerMetadata.credentialIssuer.credential_issuer) {\n throw new CredoError(`Invalid 'aud' claim in refresh token jwt`)\n }\n\n const verification = await jwsService.verifyJws(agentContext, {\n jws: parsedRefreshToken.jwt.serializedJwt,\n jwsSigner: {\n method: 'jwk',\n jwk: key,\n },\n })\n\n if (!verification.isValid) {\n throw new CredoError('Invalid refresh token')\n }\n\n if (options.dpop?.jwkThumbprint) {\n if (parsedRefreshToken.dpop?.jwkThumbprint !== options.dpop.jwkThumbprint) {\n throw new CredoError(`Invalid 'cnf.jkt' claim in refresh token jwt payload`)\n }\n }\n }\n\n public getIssuer(agentContext: AgentContext, options: { issuanceSessionId?: string } = {}) {\n return new Openid4vciIssuer({\n callbacks: getOid4vcCallbacks(agentContext, options),\n })\n }\n\n public getOauth2Client(agentContext: AgentContext, issuerRecord?: OpenId4VcIssuerRecord) {\n return new Oauth2Client({\n callbacks: {\n ...getOid4vcCallbacks(agentContext),\n ...(issuerRecord\n ? { clientAuthentication: dynamicOid4vciClientAuthentication(agentContext, issuerRecord) }\n : {}),\n },\n })\n }\n\n public getOauth2AuthorizationServer(agentContext: AgentContext, options: { issuanceSessionId?: string } = {}) {\n return new Oauth2AuthorizationServer({\n callbacks: getOid4vcCallbacks(agentContext, options),\n })\n }\n\n public getResourceServer(agentContext: AgentContext, issuerRecord: OpenId4VcIssuerRecord) {\n return new Oauth2ResourceServer({\n callbacks: {\n ...getOid4vcCallbacks(agentContext),\n clientAuthentication: dynamicOid4vciClientAuthentication(agentContext, issuerRecord),\n },\n })\n }\n\n /**\n * Update the expiresAt field of the issuance session to ensure it remains\n * valid during the deferral process. We set it to the maximum between the\n * current expiresAt and the current time plus the configured expiration\n * time or the interval multiplied by 2. This accounts for the chance of multiple\n * deferrals happening, with longer intervals.\n */\n private async updateExpiresAt(\n agentContext: AgentContext,\n issuanceSession: OpenId4VcIssuanceSessionRecord,\n interval: number\n ) {\n const expiresAt =\n issuanceSession.expiresAt ??\n utils.addSecondsToDate(\n issuanceSession.createdAt,\n this.openId4VcIssuerConfig.statefulCredentialOfferExpirationInSeconds\n )\n\n issuanceSession.expiresAt = new Date(\n Math.max(\n expiresAt.getTime(),\n utils\n .addSecondsToDate(\n new Date(),\n Math.max(this.openId4VcIssuerConfig.statefulCredentialOfferExpirationInSeconds, interval * 2)\n )\n .getTime()\n )\n )\n\n await this.openId4VcIssuanceSessionRepository.update(agentContext, issuanceSession)\n }\n\n /**\n * Update the record to a new state and emit an state changed event. Also updates the record\n * in storage.\n */\n public async updateState(\n agentContext: AgentContext,\n issuanceSession: OpenId4VcIssuanceSessionRecord,\n newState: OpenId4VcIssuanceSessionState\n ) {\n agentContext.config.logger.debug(\n `Updating openid4vc issuance session record ${issuanceSession.id} to state ${newState} (previous=${issuanceSession.state})`\n )\n\n const previousState = issuanceSession.state\n issuanceSession.state = newState\n await this.openId4VcIssuanceSessionRepository.update(agentContext, issuanceSession)\n\n this.emitStateChangedEvent(agentContext, issuanceSession, previousState)\n }\n\n public emitStateChangedEvent(\n agentContext: AgentContext,\n issuanceSession: OpenId4VcIssuanceSessionRecord,\n previousState: OpenId4VcIssuanceSessionState | null\n ) {\n const eventEmitter = agentContext.dependencyManager.resolve(EventEmitter)\n\n eventEmitter.emit<OpenId4VcIssuanceSessionStateChangedEvent>(agentContext, {\n type: OpenId4VcIssuerEvents.IssuanceSessionStateChanged,\n payload: {\n issuanceSession: issuanceSession.clone(),\n previousState: previousState,\n },\n })\n }\n\n private async getGrantsFromConfig(\n agentContext: AgentContext,\n config: {\n issuer: OpenId4VcIssuerRecord\n issuerMetadata: OpenId4VciMetadata\n preAuthorizedCodeFlowConfig?: OpenId4VciPreAuthorizedCodeFlowConfig\n authorizationCodeFlowConfig?: OpenId4VciAuthorizationCodeFlowConfig\n }\n ) {\n const kms = agentContext.resolve(Kms.KeyManagementApi)\n const { preAuthorizedCodeFlowConfig, authorizationCodeFlowConfig, issuer, issuerMetadata } = config\n\n // TODO: export type\n const grants: Parameters<Openid4vciIssuer['createCredentialOffer']>[0]['grants'] = {}\n\n // Pre auth\n if (preAuthorizedCodeFlowConfig) {\n const { txCode, authorizationServerUrl, preAuthorizedCode } = preAuthorizedCodeFlowConfig\n\n grants[preAuthorizedCodeGrantIdentifier] = {\n 'pre-authorized_code': preAuthorizedCode ?? TypedArrayEncoder.toBase64URL(kms.randomBytes({ length: 32 })),\n tx_code: txCode,\n authorization_server: config.issuerMetadata.credentialIssuer.authorization_servers\n ? authorizationServerUrl\n : undefined,\n }\n }\n\n // Auth\n if (authorizationCodeFlowConfig) {\n const { requirePresentationDuringIssuance } = authorizationCodeFlowConfig\n let authorizationServerUrl = authorizationCodeFlowConfig.authorizationServerUrl\n\n if (requirePresentationDuringIssuance) {\n if (authorizationServerUrl && authorizationServerUrl !== issuerMetadata.credentialIssuer.credential_issuer) {\n throw new CredoError(\n `When 'requirePresentationDuringIssuance' is set, 'authorizationServerUrl' must be undefined or match the credential issuer identifier`\n )\n }\n\n authorizationServerUrl = issuerMetadata.credentialIssuer.credential_issuer\n }\n\n const authorizationServerConfig = issuer.authorizationServerConfigs?.find(\n (server) => server.issuer === authorizationServerUrl\n )\n if (authorizationServerConfig?.type === 'chained') {\n authorizationServerUrl = issuerMetadata.credentialIssuer.credential_issuer\n }\n\n grants.authorization_code = {\n issuer_state:\n // TODO: the issuer_state should not be guessable, so it's best if we generate it and now allow the user to provide it?\n // but same is true for the pre-auth code and users of credo can also provide that value. We can't easily do unique constraint with askat\n authorizationCodeFlowConfig.issuerState ?? TypedArrayEncoder.toBase64URL(kms.randomBytes({ length: 32 })),\n authorization_server: config.issuerMetadata.credentialIssuer.authorization_servers\n ? authorizationServerUrl\n : undefined,\n }\n }\n\n return grants\n }\n\n private getCredentialConfigurationsForRequest(options: {\n issuerMetadata: OpenId4VciMetadata\n issuanceSession: OpenId4VcIssuanceSessionRecord\n authorization: OpenId4VciCredentialRequestAuthorization\n requestFormat?: CredentialRequestFormatSpecific\n credentialConfigurations?: CredentialConfigurationsSupportedWithFormats\n }): { credentialConfigurationId: string; credentialConfiguration: CredentialConfigurationSupportedWithFormats } {\n const { requestFormat, issuanceSession, issuerMetadata, authorization, credentialConfigurations } = options\n\n // Check against all credential configurations\n const configurationsMatchingRequest = credentialConfigurations\n ? credentialConfigurations\n : requestFormat\n ? getCredentialConfigurationsMatchingRequestFormat({\n requestFormat,\n issuerMetadata,\n })\n : undefined\n\n if (!configurationsMatchingRequest) {\n throw new Oauth2ServerErrorResponseError({\n error: Oauth2ErrorCodes.InvalidCredentialRequest,\n error_description: `Either 'credential_configuration_id' or 'format' needs to be defined'`,\n })\n }\n\n if (Object.keys(configurationsMatchingRequest).length === 0) {\n throw new Oauth2ServerErrorResponseError({\n error: Oauth2ErrorCodes.InvalidCredentialRequest,\n error_description: 'Credential request does not match any credential configuration',\n })\n }\n\n // Limit to offered configurations\n const configurationsMatchingRequestAndOffer = getOfferedCredentials(\n issuanceSession.credentialOfferPayload.credential_configuration_ids,\n configurationsMatchingRequest,\n { ignoreNotFoundIds: true }\n )\n if (Object.keys(configurationsMatchingRequestAndOffer).length === 0) {\n throw new Oauth2ServerErrorResponseError({\n error: Oauth2ErrorCodes.InvalidCredentialRequest,\n error_description: 'Credential request does not match any credential configurations from credential offer',\n })\n }\n\n // Limit to not-issued and not-deferred configurations\n const deferredCredentialConfigurationIds = issuanceSession.transactions.map((tx) => tx.credentialConfigurationId)\n const configurationsMatchingRequestAndOfferNotIssued = getOfferedCredentials(\n issuanceSession.credentialOfferPayload.credential_configuration_ids.filter(\n (id) => !issuanceSession.issuedCredentials.includes(id) && !deferredCredentialConfigurationIds.includes(id)\n ),\n configurationsMatchingRequestAndOffer,\n { ignoreNotFoundIds: true }\n )\n if (Object.keys(configurationsMatchingRequestAndOfferNotIssued).length === 0) {\n throw new Oauth2ServerErrorResponseError({\n error: Oauth2ErrorCodes.InvalidCredentialRequest,\n error_description:\n 'Credential request does not match any credential configurations from credential offer that have not been issued yet',\n })\n }\n\n // For pre-auth we allow all ids from the offer\n if (authorization.accessToken.payload['pre-authorized_code']) {\n // We return the first one that matches all checks. Pre draft 15 it could be multiple entries, but only if you offer\n // multiple credentials of the same type. We need to do checks on this, so we pick the first one\n const [credentialConfigurationId, credentialConfiguration] = Object.entries(\n configurationsMatchingRequestAndOfferNotIssued\n )[0]\n return {\n credentialConfigurationId,\n credentialConfiguration,\n }\n }\n\n // Limit to scopes from the token\n // We only do this for auth flow, so it's not required to add a scope for every configuration.\n const configurationsMatchingRequestOfferScope = getCredentialConfigurationsSupportedForScopes(\n configurationsMatchingRequestAndOfferNotIssued,\n authorization.accessToken.payload.scope?.split(' ') ?? []\n )\n if (Object.keys(configurationsMatchingRequestOfferScope).length === 0) {\n throw new Oauth2ServerErrorResponseError(\n {\n error: Oauth2ErrorCodes.InsufficientScope,\n error_description:\n 'Scope does not grant issuance for any requested credential configurations from credential offer',\n },\n {\n status: 403,\n }\n )\n }\n\n // We return the first one that matches all checks. Pre draft 15 it could be multiple entries, but only if you offer\n // multiple credentials of the same type. We need to do checks on this, so we pick the first one\n const [credentialConfigurationId, credentialConfiguration] = Object.entries(\n configurationsMatchingRequestOfferScope\n )[0]\n return {\n credentialConfigurationId,\n credentialConfiguration: credentialConfiguration as CredentialConfigurationSupportedWithFormats,\n }\n }\n\n private async getSignedCredentials(\n agentContext: AgentContext,\n signOptions: OpenId4VciSignCredentials,\n options: {\n issuanceSession: OpenId4VcIssuanceSessionRecord\n credentialConfiguration: OpenId4VciCredentialConfigurationSupportedWithFormats\n expectedLength: number\n }\n ): Promise<{\n credentials: string[] | Record<string, unknown>[]\n format: `${OpenId4VciCredentialFormatProfile}`\n }> {\n const { credentialConfiguration, expectedLength } = options\n\n // NOTE: we may want to allow a mismatch between this (as there is a match batch length), but for now it needs to match\n if (signOptions.credentials.length !== expectedLength) {\n throw new CredoError(\n `Credential request to credential mapper returned '${signOptions.credentials.length}' to be signed, while '${expectedLength}' holder binding entries were provided. Make sure to return one credential for each holder binding entry`\n )\n }\n\n if (signOptions.format === ClaimFormat.JwtVc || signOptions.format === ClaimFormat.LdpVc) {\n const oid4vciFormatMap: Record<string, ClaimFormat.JwtVc | ClaimFormat.LdpVc> = {\n [OpenId4VciCredentialFormatProfile.JwtVcJson]: ClaimFormat.JwtVc,\n [OpenId4VciCredentialFormatProfile.JwtVcJsonLd]: ClaimFormat.JwtVc,\n [OpenId4VciCredentialFormatProfile.LdpVc]: ClaimFormat.LdpVc,\n }\n\n const expectedClaimFormat = oid4vciFormatMap[credentialConfiguration.format]\n if (signOptions.format !== expectedClaimFormat) {\n throw new CredoError(\n `Invalid credential format returned by sign options. Expected '${expectedClaimFormat}', received '${signOptions.format}'.`\n )\n }\n\n return {\n format: credentialConfiguration.format,\n credentials: (await Promise.all(\n signOptions.credentials.map((credential) =>\n this.signW3cCredential(agentContext, signOptions.format, credential).then((signed) => signed.encoded)\n )\n )) as string[] | Record<string, unknown>[],\n }\n }\n if (signOptions.format === ClaimFormat.SdJwtDc) {\n if (\n credentialConfiguration.format !== OpenId4VciCredentialFormatProfile.SdJwtVc &&\n credentialConfiguration.format !== OpenId4VciCredentialFormatProfile.SdJwtDc\n ) {\n throw new CredoError(\n `Invalid credential format returned by sign options. Expected '${ClaimFormat.SdJwtDc}', received '${signOptions.format}'.`\n )\n }\n\n if (!signOptions.credentials.every((c) => c.payload.vct === credentialConfiguration.vct)) {\n throw new CredoError(\n `One or more vct values of the offered credential(s) do not match the vct of the requested credential. Offered ${Array.from(\n new Set(signOptions.credentials.map((c) => `'${c.payload.vct}'`))\n ).join(', ')} Requested '${credentialConfiguration.vct}'.`\n )\n }\n\n const sdJwtVcApi = agentContext.dependencyManager.resolve(SdJwtVcApi)\n return {\n format: credentialConfiguration.format,\n credentials: await Promise.all(\n signOptions.credentials.map((credential) =>\n sdJwtVcApi\n .sign({\n ...credential,\n // Set header type based on the oid4vci format\n headerType: credentialConfiguration.format,\n })\n .then((signed) => signed.compact)\n )\n ),\n }\n }\n if (signOptions.format === ClaimFormat.MsoMdoc) {\n if (signOptions.format !== credentialConfiguration.format) {\n throw new CredoError(\n `Invalid credential format returned by sign options. Expected '${credentialConfiguration.format}', received '${signOptions.format}'.`\n )\n }\n if (!signOptions.credentials.every((c) => c.docType === credentialConfiguration.doctype)) {\n throw new CredoError(\n `One or more doctype values of the offered credential(s) do not match the doctype of the requested credential. Offered ${Array.from(\n new Set(signOptions.credentials.map((c) => `'${c.docType}'`))\n ).join(', ')} Requested '${credentialConfiguration.doctype}'.`\n )\n }\n\n const mdocApi = agentContext.dependencyManager.resolve(MdocApi)\n return {\n format: OpenId4VciCredentialFormatProfile.MsoMdoc,\n credentials: await Promise.all(\n signOptions.credentials.map((credential) => mdocApi.sign(credential).then((signed) => signed.base64Url))\n ),\n }\n }\n if (signOptions.format === ClaimFormat.SdJwtW3cVc) {\n return {\n format: credentialConfiguration.format,\n credentials: (await Promise.all(\n signOptions.credentials.map((credential) =>\n this.w3cV2CredentialService\n .signCredential(agentContext, {\n format: ClaimFormat.SdJwtW3cVc,\n ...credential,\n })\n .then((signed) => signed.encoded)\n )\n )) as string[] | Record<string, unknown>[],\n }\n }\n throw new CredoError(`Unsupported credential format ${signOptions.format}`)\n }\n\n private async signW3cCredential(\n agentContext: AgentContext,\n format: `${ClaimFormat.JwtVc}` | `${ClaimFormat.LdpVc}`,\n options: OpenId4VciSignW3cCredentials['credentials'][number]\n ) {\n const publicJwk = await getPublicJwkFromDid(agentContext, options.verificationMethod)\n if (format === ClaimFormat.JwtVc) {\n return await this.w3cCredentialService.signCredential(agentContext, {\n format: ClaimFormat.JwtVc,\n credential: options.credential,\n verificationMethod: options.verificationMethod,\n alg: publicJwk.signatureAlgorithm,\n })\n }\n\n const proofType = getProofTypeFromPublicJwk(agentContext, publicJwk)\n return await this.w3cCredentialService.signCredential(agentContext, {\n format: ClaimFormat.LdpVc,\n credential: options.credential,\n verificationMethod: options.verificationMethod,\n proofType: proofType,\n })\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAkGO,mCAAMA,yBAAuB;CAOlC,AAAO,YACL,sBACA,wBACA,uBACA,2BACA,oCACA;AACA,OAAK,uBAAuB;AAC5B,OAAK,yBAAyB;AAC9B,OAAK,wBAAwB;AAC7B,OAAK,4BAA4B;AACjC,OAAK,qCAAqC;;CAG5C,MAAa,+BACX,cACA,SAC+F;EAC/F,MAAM,EAAE,6BAA6B,QAAQ,+BAA+B;EAC5E,MAAM,WAAW,KAAK,UAAU,aAAa;EAC7C,MAAM,iBAAiB,MAAM,KAAK,kBAAkB,cAAc,OAAO;AAGzE,MADiC,MAAM,KAAK,IAAI,IAAI,QAAQ,2BAA2B,CAAC,CAC3D,WAAW,2BAA2B,OACjE,OAAM,IAAI,WAAW,gDAAgD;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AK,MAAM,IAAI,EAAE,QAAQ,GAAG,CAAC,CAC9D,CAAC,KAAK,KAAK,CAAC,cAAc,wBAAwB,QAAQ,IAC5D;GAGH,MAAM,UAAU,aAAa,kBAAkB,QAAQ,QAAQ;AAC/D,UAAO;IACL,QAAQ,kCAAkC;IAC1C,aAAa,MAAM,QAAQ,IACzB,YAAY,YAAY,KAAK,eAAe,QAAQ,KAAK,WAAW,CAAC,MAAM,WAAW,OAAO,UAAU,CAAC,CACzG;IACF;;AAEH,MAAI,YAAY,WAAW,YAAY,WACrC,QAAO;GACL,QAAQ,wBAAwB;GAChC,aAAc,MAAM,QAAQ,IAC1B,YAAY,YAAY,KAAK,eAC3B,KAAK,uBACF,eAAe,cAAc;IAC5B,QAAQ,YAAY;IACpB,GAAG;IACJ,CAAC,CACD,MAAM,WAAW,OAAO,QAAQ,CACpC,CACF;GACF;AAEH,QAAM,IAAI,WAAW,iCAAiC,YAAY,SAAS;;CAG7E,MAAc,kBACZ,cACA,QACA,SACA;EACA,MAAM,YAAY,MAAM,oBAAoB,cAAc,QAAQ,mBAAmB;AACrF,MAAI,WAAW,YAAY,MACzB,QAAO,MAAM,KAAK,qBAAqB,eAAe,cAAc;GAClE,QAAQ,YAAY;GACpB,YAAY,QAAQ;GACpB,oBAAoB,QAAQ;GAC5B,KAAK,UAAU;GAChB,CAAC;EAGJ,MAAM,YAAY,0BAA0B,cAAc,UAAU;AACpE,SAAO,MAAM,KAAK,qBAAqB,eAAe,cAAc;GAClE,QAAQ,YAAY;GACpB,YAAY,QAAQ;GACpB,oBAAoB,QAAQ;GACjB;GACZ,CAAC;;;qCAzjDL,YAAY"}
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import { VerifiedOpenId4VcCredentialHolderBinding } from "../shared/models/CredentialHolderBinding.mjs";
|
|
2
|
+
import { OpenId4VciAuthorizationServerConfig } from "../shared/models/OpenId4VciAuthorizationServerConfig.mjs";
|
|
3
|
+
import { OpenId4VcJwtIssuer } from "../shared/models/OpenId4VcJwtIssuer.mjs";
|
|
4
|
+
import { OpenId4VciCredentialConfigurationSupportedWithFormats, OpenId4VciCredentialConfigurationsSupportedWithFormats, OpenId4VciCredentialIssuerMetadataDisplay, OpenId4VciCredentialOfferPayload, OpenId4VciCredentialRequest, OpenId4VciCredentialRequestFormatSpecific, OpenId4VciDeferredCredentialRequest, OpenId4VciTxCode } from "../shared/models/index.mjs";
|
|
5
|
+
import { OpenId4VcIssuanceSessionRecord } from "./repository/OpenId4VcIssuanceSessionRecord.mjs";
|
|
6
|
+
import { OpenId4VcIssuerRecordProps } from "./repository/OpenId4VcIssuerRecord.mjs";
|
|
7
|
+
import "./repository/index.mjs";
|
|
8
|
+
import "../shared/index.mjs";
|
|
9
|
+
import { OpenId4VpCreateAuthorizationRequestReturn, OpenId4VpVerifiedAuthorizationResponseDcql, OpenId4VpVerifiedAuthorizationResponsePresentationExchange } from "../openid4vc-verifier/OpenId4VpVerifierServiceOptions.mjs";
|
|
10
|
+
import { OpenId4VcVerificationSessionRecord } from "../openid4vc-verifier/repository/OpenId4VcVerificationSessionRecord.mjs";
|
|
11
|
+
import "../openid4vc-verifier/index.mjs";
|
|
12
|
+
import { AgentContext, CanBePromise, ClaimFormat, Kms, MdocSignOptions, SdJwtVcSignOptions, W3cCredential, W3cV2SignCredentialOptions } from "@credo-ts/core";
|
|
13
|
+
import { AccessTokenProfileJwtPayload, TokenIntrospectionResponse } from "@openid4vc/oauth2";
|
|
14
|
+
|
|
15
|
+
//#region src/openid4vc-issuer/OpenId4VcIssuerServiceOptions.d.ts
|
|
16
|
+
interface OpenId4VciCredentialRequestAuthorization {
|
|
17
|
+
authorizationServer: string;
|
|
18
|
+
accessToken: {
|
|
19
|
+
payload: AccessTokenProfileJwtPayload | TokenIntrospectionResponse;
|
|
20
|
+
value: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
type OpenId4VciVersion = 'v1.draft11-14' | 'v1.draft15' | 'v1';
|
|
24
|
+
interface OpenId4VciPreAuthorizedCodeFlowConfig {
|
|
25
|
+
preAuthorizedCode?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The user pin required flag indicates whether the user needs to enter a pin to authorize the transaction.
|
|
28
|
+
*/
|
|
29
|
+
txCode?: OpenId4VciTxCode;
|
|
30
|
+
authorizationServerUrl?: string;
|
|
31
|
+
}
|
|
32
|
+
interface OpenId4VciAuthorizationCodeFlowConfig {
|
|
33
|
+
/**
|
|
34
|
+
* OPTIONAL. String value created by the Credential Issuer and opaque to the Wallet
|
|
35
|
+
* that is used to bind the subsequent Authorization Request with the Credential Issuer
|
|
36
|
+
* to a context set up during previous steps.
|
|
37
|
+
* If not provided, a value will be generated.
|
|
38
|
+
*/
|
|
39
|
+
issuerState?: string;
|
|
40
|
+
/**
|
|
41
|
+
* OPTIONAL. String value that the wallet can use to identify the authorization server to use with
|
|
42
|
+
* this grant type when multiple authorization servers have been configured in the Credential Issuer
|
|
43
|
+
* metadata.
|
|
44
|
+
*
|
|
45
|
+
* When using a chained authorization server, this option is mutually exclusive with `requirePresentationDuringIssuance`.
|
|
46
|
+
*/
|
|
47
|
+
authorizationServerUrl?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Whether presentation using OpenID4VP is required as part of the authorization flow. The presentation
|
|
50
|
+
* request will be created dynamically when the wallet initiates the authorization flow using the
|
|
51
|
+
* `getVerificationSessionForIssuanceSessionAuthorization` callback in the issuer module config.
|
|
52
|
+
*
|
|
53
|
+
* You can dynamically create the verification session based on the provided issuance session, or you
|
|
54
|
+
* can have a more generic implementation based on credential configurations and scopes that are being
|
|
55
|
+
* requested.
|
|
56
|
+
*
|
|
57
|
+
* In case this parameter is set to true, `authorizationServerUrl` MUST be undefined or match the
|
|
58
|
+
* `credential_issuer` value, as only Credo can handle this flow.
|
|
59
|
+
*
|
|
60
|
+
* In case this parameter is set to true, and `getVerificationSessionForIssuanceSessionAuthorization` is
|
|
61
|
+
* not configured on the issuer module an error will be thrown.
|
|
62
|
+
*
|
|
63
|
+
* @default false
|
|
64
|
+
*/
|
|
65
|
+
requirePresentationDuringIssuance?: boolean;
|
|
66
|
+
}
|
|
67
|
+
interface OpenId4VciCreateCredentialOfferOptionsBase {
|
|
68
|
+
/**
|
|
69
|
+
* The credential configurations to offer.
|
|
70
|
+
*
|
|
71
|
+
* At least one id must be offered, and all ids must be present in the credential configurations.
|
|
72
|
+
*/
|
|
73
|
+
credentialConfigurationIds: string[];
|
|
74
|
+
/**
|
|
75
|
+
* baseUri for the credential offer uri. By default `openid-credential-offer://` will be used
|
|
76
|
+
* if no value is provided. If a value is provided, make sure it contains the scheme as well as `://`.
|
|
77
|
+
*/
|
|
78
|
+
baseUri?: string;
|
|
79
|
+
/**
|
|
80
|
+
* @default v1
|
|
81
|
+
*/
|
|
82
|
+
version?: OpenId4VciVersion;
|
|
83
|
+
}
|
|
84
|
+
interface OpenId4VciCreateStatelessCredentialOfferOptions extends OpenId4VciCreateCredentialOfferOptionsBase {
|
|
85
|
+
authorizationCodeFlowConfig: Required<Pick<OpenId4VciAuthorizationCodeFlowConfig, 'authorizationServerUrl'>>;
|
|
86
|
+
/**
|
|
87
|
+
* For stateless credential offers we need an external authorization server, which also means we need to
|
|
88
|
+
* support `authorization_servers`.
|
|
89
|
+
*
|
|
90
|
+
* NOTE: `v1` credential is compatible with draft 13 credential offer as well. Only the issuer metadata
|
|
91
|
+
* is different, so ensure you configure the issuer metadata in a compatible way based on the provided draft version.
|
|
92
|
+
*
|
|
93
|
+
* @default v1
|
|
94
|
+
*/
|
|
95
|
+
version?: 'v1';
|
|
96
|
+
}
|
|
97
|
+
interface OpenId4VciCreateCredentialOfferOptions extends OpenId4VciCreateCredentialOfferOptionsBase {
|
|
98
|
+
preAuthorizedCodeFlowConfig?: OpenId4VciPreAuthorizedCodeFlowConfig;
|
|
99
|
+
authorizationCodeFlowConfig?: OpenId4VciAuthorizationCodeFlowConfig;
|
|
100
|
+
/**
|
|
101
|
+
* Options related to authorization, for both the pre-authorized and authorization_code flows.
|
|
102
|
+
*/
|
|
103
|
+
authorization?: {
|
|
104
|
+
/**
|
|
105
|
+
* Whether wallet attestations are required at the PAR, Authorization Challenge and token endpoints.
|
|
106
|
+
*
|
|
107
|
+
* If not provided, the value from the global agent config will be used.
|
|
108
|
+
*
|
|
109
|
+
* NOTE: this only has effect if the Credo authorization server is used. If an external authorization
|
|
110
|
+
* server is used, it's up to the authorization server to require wallet attestations for client authentication.
|
|
111
|
+
*/
|
|
112
|
+
requireWalletAttestation: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Whether DPoP is required.
|
|
115
|
+
*
|
|
116
|
+
* If not provided, the value from the global agent config will be used.
|
|
117
|
+
*
|
|
118
|
+
* NOTE: it's up to the authorization server to enforce DPoP binding. So if an external authorization server
|
|
119
|
+
* is used, and DPoP is required, you should ensure the authorization server enforces DPoP. If DPoP is required
|
|
120
|
+
* but not bound to the access token created by an external authorization server, the issuance will fail when the
|
|
121
|
+
* credential endpoint is called.
|
|
122
|
+
*/
|
|
123
|
+
requireDpop: boolean;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Metadata about the issuance, that will be stored in the issuance session record and
|
|
127
|
+
* passed to the credential request to credential mapper. This can be used to e.g. store an
|
|
128
|
+
* user identifier so user data can be fetched in the credential mapper, or the actual credential
|
|
129
|
+
* data.
|
|
130
|
+
*/
|
|
131
|
+
issuanceMetadata?: Record<string, unknown>;
|
|
132
|
+
/**
|
|
133
|
+
* Whether this issuance session allows to generate refresh tokens.
|
|
134
|
+
*/
|
|
135
|
+
generateRefreshTokens?: boolean;
|
|
136
|
+
}
|
|
137
|
+
interface OpenId4VciCreateCredentialResponseOptions {
|
|
138
|
+
credentialRequest: OpenId4VciCredentialRequest;
|
|
139
|
+
authorization: OpenId4VciCredentialRequestAuthorization;
|
|
140
|
+
/**
|
|
141
|
+
* You can optionally provide a credential request to credential mapper that will be
|
|
142
|
+
* dynamically invoked to return credential data based on the credential request.
|
|
143
|
+
*
|
|
144
|
+
* If not provided, the `credentialRequestToCredentialMapper` from the agent config
|
|
145
|
+
* will be used.
|
|
146
|
+
*/
|
|
147
|
+
credentialRequestToCredentialMapper?: OpenId4VciCredentialRequestToCredentialMapper;
|
|
148
|
+
}
|
|
149
|
+
interface OpenId4VciCreateDeferredCredentialResponseOptions {
|
|
150
|
+
deferredCredentialRequest: OpenId4VciDeferredCredentialRequest;
|
|
151
|
+
authorization: OpenId4VciCredentialRequestAuthorization;
|
|
152
|
+
/**
|
|
153
|
+
* You can optionally provide a deferred credential request to credential mapper that will be
|
|
154
|
+
* dynamically invoked to return credential data based on the credential request.
|
|
155
|
+
*
|
|
156
|
+
* If not provided, the `deferredCredentialRequestToCredentialMapper` from the agent config
|
|
157
|
+
* will be used.
|
|
158
|
+
*/
|
|
159
|
+
deferredCredentialRequestToCredentialMapper?: OpenId4VciDeferredCredentialRequestToCredentialMapper;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Callback that is called when a verification session needs to be created to complete
|
|
163
|
+
* authorization of credential issuance.
|
|
164
|
+
*
|
|
165
|
+
*
|
|
166
|
+
*/
|
|
167
|
+
type OpenId4VciGetVerificationSessionForIssuanceSessionAuthorization = (options: {
|
|
168
|
+
agentContext: AgentContext;
|
|
169
|
+
issuanceSession: OpenId4VcIssuanceSessionRecord;
|
|
170
|
+
/**
|
|
171
|
+
* The credential configurations for which authorization has been requested based on the **scope**
|
|
172
|
+
* values. It doesn't mean the wallet will request all credentials to be issued.
|
|
173
|
+
*/
|
|
174
|
+
requestedCredentialConfigurations: OpenId4VciCredentialConfigurationsSupportedWithFormats;
|
|
175
|
+
/**
|
|
176
|
+
* The scopes which were requested and are also present in the credential configurations supported
|
|
177
|
+
* that were offered. It will match with the scope values in the `requestedCredentialConfiguration`
|
|
178
|
+
* parameter
|
|
179
|
+
*/
|
|
180
|
+
scopes: string[];
|
|
181
|
+
}) => Promise<OpenId4VpCreateAuthorizationRequestReturn & {
|
|
182
|
+
/**
|
|
183
|
+
* The scopes which will be granted by successfully completing the verification
|
|
184
|
+
* session.
|
|
185
|
+
*
|
|
186
|
+
* @todo do we need more granular support? I.e. every input descriptor can satisfy a
|
|
187
|
+
* different scope?
|
|
188
|
+
*/
|
|
189
|
+
scopes: string[];
|
|
190
|
+
}>;
|
|
191
|
+
interface OpenId4VciCredentialRequestToCredentialMapperOptions {
|
|
192
|
+
agentContext: AgentContext;
|
|
193
|
+
/**
|
|
194
|
+
* Authorization associated with the credential request
|
|
195
|
+
*/
|
|
196
|
+
authorization: OpenId4VciCredentialRequestAuthorization;
|
|
197
|
+
/**
|
|
198
|
+
* If an openid4vp verification was done as part of the authorization flow this parameter will be defined.
|
|
199
|
+
*
|
|
200
|
+
* The contents can be used to populate credential data
|
|
201
|
+
*/
|
|
202
|
+
verification?: {
|
|
203
|
+
session: OpenId4VcVerificationSessionRecord;
|
|
204
|
+
} & ({
|
|
205
|
+
presentationExchange: OpenId4VpVerifiedAuthorizationResponsePresentationExchange;
|
|
206
|
+
dcql?: never;
|
|
207
|
+
} | {
|
|
208
|
+
dcql: OpenId4VpVerifiedAuthorizationResponseDcql;
|
|
209
|
+
presentationExchange?: never;
|
|
210
|
+
});
|
|
211
|
+
/**
|
|
212
|
+
* The issuance session associated with the credential request. You can extract the
|
|
213
|
+
* issuance metadata from this record if passed in the offer creation method.
|
|
214
|
+
*/
|
|
215
|
+
issuanceSession: OpenId4VcIssuanceSessionRecord;
|
|
216
|
+
/**
|
|
217
|
+
* The credential request received from the wallet
|
|
218
|
+
*/
|
|
219
|
+
credentialRequest: OpenId4VciCredentialRequest;
|
|
220
|
+
/**
|
|
221
|
+
* Contains format specific credential request data. This will only be
|
|
222
|
+
* defined if a credential was requested using the `format` syntax
|
|
223
|
+
*/
|
|
224
|
+
credentialRequestFormat?: OpenId4VciCredentialRequestFormatSpecific;
|
|
225
|
+
/**
|
|
226
|
+
* The offer associated with the credential request
|
|
227
|
+
*/
|
|
228
|
+
credentialOffer: OpenId4VciCredentialOfferPayload;
|
|
229
|
+
/**
|
|
230
|
+
* Verified key binding material entries that should be included in the credential(s)
|
|
231
|
+
* A separate credential should be returned for each holder binding entry.
|
|
232
|
+
*
|
|
233
|
+
* All keys and dids have a verified proof, or in the case a key attestation is provided
|
|
234
|
+
* are attested by a key attestation. Ensure the issuer of the key attestation is trusted.
|
|
235
|
+
*/
|
|
236
|
+
holderBinding: VerifiedOpenId4VcCredentialHolderBinding;
|
|
237
|
+
/**
|
|
238
|
+
* The credential configurations supported entry from the issuer metadata
|
|
239
|
+
* that was offered and matches the incoming request.
|
|
240
|
+
*
|
|
241
|
+
* If multiple offered configuration match the request (which is possible pre-draft 15)
|
|
242
|
+
* the first configuration that has not been issued yet will be passed.
|
|
243
|
+
*/
|
|
244
|
+
credentialConfiguration: OpenId4VciCredentialConfigurationSupportedWithFormats;
|
|
245
|
+
/**
|
|
246
|
+
* The ids of the credential configuration that was offered and matches the request.
|
|
247
|
+
*/
|
|
248
|
+
credentialConfigurationId: string;
|
|
249
|
+
}
|
|
250
|
+
type OpenId4VciCredentialRequestToCredentialMapper = (options: OpenId4VciCredentialRequestToCredentialMapperOptions) => CanBePromise<OpenId4VciSignCredentials | OpenId4VciDeferredCredentials>;
|
|
251
|
+
interface OpenId4VciDeferredCredentialRequestToCredentialMapperOptions {
|
|
252
|
+
agentContext: AgentContext;
|
|
253
|
+
/**
|
|
254
|
+
* Authorization associated with the credential request
|
|
255
|
+
*/
|
|
256
|
+
authorization: OpenId4VciCredentialRequestAuthorization;
|
|
257
|
+
/**
|
|
258
|
+
* The issuance session associated with the credential request. You can extract the
|
|
259
|
+
* issuance metadata from this record if passed in the offer creation method.
|
|
260
|
+
*/
|
|
261
|
+
issuanceSession: OpenId4VcIssuanceSessionRecord;
|
|
262
|
+
/**
|
|
263
|
+
* The deferred credential request received from the wallet
|
|
264
|
+
*/
|
|
265
|
+
deferredCredentialRequest: OpenId4VciDeferredCredentialRequest;
|
|
266
|
+
}
|
|
267
|
+
type OpenId4VciDeferredCredentialRequestToCredentialMapper = (options: OpenId4VciDeferredCredentialRequestToCredentialMapperOptions) => CanBePromise<OpenId4VciSignCredentials | OpenId4VciDeferredCredentials>;
|
|
268
|
+
type OpenId4VciSignCredentials = OpenId4VciSignSdJwtCredentials | OpenId4VciSignW3cCredentials | OpenId4VciSignW3cV2Credentials | OpenId4VciSignMdocCredentials;
|
|
269
|
+
interface OpenId4VciSignSdJwtCredentials {
|
|
270
|
+
type: 'credentials';
|
|
271
|
+
format: ClaimFormat.SdJwtDc | `${ClaimFormat.SdJwtDc}`;
|
|
272
|
+
credentials: SdJwtVcSignOptions[];
|
|
273
|
+
}
|
|
274
|
+
interface OpenId4VciSignMdocCredentials {
|
|
275
|
+
type: 'credentials';
|
|
276
|
+
format: ClaimFormat.MsoMdoc | `${ClaimFormat.MsoMdoc}`;
|
|
277
|
+
credentials: MdocSignOptions[];
|
|
278
|
+
}
|
|
279
|
+
interface OpenId4VciSignW3cCredentials {
|
|
280
|
+
type: 'credentials';
|
|
281
|
+
format: ClaimFormat.JwtVc | `${ClaimFormat.JwtVc}` | ClaimFormat.LdpVc | `${ClaimFormat.LdpVc}`;
|
|
282
|
+
credentials: Array<{
|
|
283
|
+
verificationMethod: string;
|
|
284
|
+
credential: W3cCredential;
|
|
285
|
+
}>;
|
|
286
|
+
}
|
|
287
|
+
interface OpenId4VciSignW3cV2Credentials {
|
|
288
|
+
type: 'credentials';
|
|
289
|
+
format: ClaimFormat.SdJwtW3cVc | `${ClaimFormat.SdJwtW3cVc}`;
|
|
290
|
+
credentials: Omit<W3cV2SignCredentialOptions<ClaimFormat.SdJwtW3cVc>, 'format'>[];
|
|
291
|
+
}
|
|
292
|
+
type OpenId4VciDeferredCredentials = {
|
|
293
|
+
type: 'deferral';
|
|
294
|
+
transactionId: string;
|
|
295
|
+
interval: number;
|
|
296
|
+
};
|
|
297
|
+
interface OpenId4VciBatchCredentialIssuanceOptions {
|
|
298
|
+
/**
|
|
299
|
+
* The maximum batch size
|
|
300
|
+
*/
|
|
301
|
+
batchSize: number;
|
|
302
|
+
}
|
|
303
|
+
type OpenId4VciCreateIssuerOptions = {
|
|
304
|
+
/**
|
|
305
|
+
* Id of the issuer, not the id of the issuer record. Will be exposed publicly
|
|
306
|
+
*/
|
|
307
|
+
issuerId?: string;
|
|
308
|
+
/**
|
|
309
|
+
* Key type to use for signing access tokens
|
|
310
|
+
*
|
|
311
|
+
* @default
|
|
312
|
+
* ```json
|
|
313
|
+
* {
|
|
314
|
+
* kty: "OKP",
|
|
315
|
+
* crv: "Ed25519"
|
|
316
|
+
* }
|
|
317
|
+
* ```
|
|
318
|
+
*/
|
|
319
|
+
accessTokenSignerKeyType?: Kms.KmsCreateKeyTypeAssymetric;
|
|
320
|
+
display?: OpenId4VciCredentialIssuerMetadataDisplay[];
|
|
321
|
+
authorizationServerConfigs?: OpenId4VciAuthorizationServerConfig[];
|
|
322
|
+
dpopSigningAlgValuesSupported?: [Kms.KnownJwaSignatureAlgorithm, ...Kms.KnownJwaSignatureAlgorithm[]];
|
|
323
|
+
credentialConfigurationsSupported: OpenId4VciCredentialConfigurationsSupportedWithFormats;
|
|
324
|
+
/**
|
|
325
|
+
* Indicate support for batch issuance of credentials
|
|
326
|
+
*/
|
|
327
|
+
batchCredentialIssuance?: OpenId4VciBatchCredentialIssuanceOptions;
|
|
328
|
+
/**
|
|
329
|
+
* When provided, allows wallets to fetch signed metadata.
|
|
330
|
+
*
|
|
331
|
+
* Currently the metadata is signed when the issuer metadata is created or updated, but
|
|
332
|
+
* it won't be updated for each wallet that resolves the metadata. This also mean that no exp
|
|
333
|
+
* is added to the signed metadata.
|
|
334
|
+
*/
|
|
335
|
+
metadataSigner?: OpenId4VcJwtIssuer;
|
|
336
|
+
};
|
|
337
|
+
type OpenId4VcUpdateIssuerRecordOptions = Pick<OpenId4VcIssuerRecordProps, 'issuerId' | 'display' | 'dpopSigningAlgValuesSupported' | 'credentialConfigurationsSupported' | 'batchCredentialIssuance' | 'authorizationServerConfigs'>;
|
|
338
|
+
//#endregion
|
|
339
|
+
export { OpenId4VcUpdateIssuerRecordOptions, OpenId4VciAuthorizationCodeFlowConfig, OpenId4VciBatchCredentialIssuanceOptions, OpenId4VciCreateCredentialOfferOptions, OpenId4VciCreateCredentialResponseOptions, OpenId4VciCreateDeferredCredentialResponseOptions, OpenId4VciCreateIssuerOptions, OpenId4VciCreateStatelessCredentialOfferOptions, OpenId4VciCredentialRequestAuthorization, OpenId4VciCredentialRequestToCredentialMapper, OpenId4VciCredentialRequestToCredentialMapperOptions, OpenId4VciDeferredCredentialRequestToCredentialMapper, OpenId4VciDeferredCredentialRequestToCredentialMapperOptions, OpenId4VciDeferredCredentials, OpenId4VciGetVerificationSessionForIssuanceSessionAuthorization, OpenId4VciPreAuthorizedCodeFlowConfig, OpenId4VciSignCredentials, OpenId4VciSignMdocCredentials, OpenId4VciSignSdJwtCredentials, OpenId4VciSignW3cCredentials, OpenId4VciSignW3cV2Credentials, OpenId4VciVersion };
|
|
340
|
+
//# sourceMappingURL=OpenId4VcIssuerServiceOptions.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenId4VcIssuerServiceOptions.d.mts","names":[],"sources":["../../src/openid4vc-issuer/OpenId4VcIssuerServiceOptions.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;UAgCiB,wCAAA;;;aAGJ,+BAA+B;;;;KAKhC,iBAAA;UAEK,qCAAA;EAVA,iBAAA,CAAA,EAAA,MAAA;EAQL;AAEZ;AAaA;EAsCU,MAAA,CAAA,EA7CC,gBA6CD;EAoBO,sBAAA,CAAA,EAAA,MAAA;;AACuB,UA3DvB,qCAAA,CA2DuB;EAAT;;;AAc/B;;;EAqCqB,WAAA,CAAA,EAAA,MAAA;EArC2C;;AA6ChE;;;;;EAciB,sBAAA,CAAA,EAAA,MAAA;EACY;;;;AAmB7B;;;;;;;AA6BA;;;;;;EA8BmB,iCAAA,CAAA,EAAA,OAAA;;UA7KT,0CAAA,CAwLkB;EAKT;;;;AA0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UAEP,WAAA,CAAY,aAAa,WAAA,CAAY;eAChC;;UAGE,4BAAA;;UAEP,WAAA,CAAY,WAAW,WAAA,CAAY,UAAU,WAAA,CAAY,WAAW,WAAA,CAAY;eAC3E;;gBAEC;;;UAIC,8BAAA;;UAEP,WAAA,CAAY,gBAAgB,WAAA,CAAY;eACnC,KAAK,2BAA2B,WAAA,CAAY;;KAG/C,6BAAA;;;;;UAMK,wCAAA;;;;;;KAOL,6BAAA;;;;;;;;;;;;;;;;6BAiBiB,GAAA,CAAI;YAErB;+BACmB;mCACI,GAAA,CAAI,+BAA+B,GAAA,CAAI;qCAErC;;;;4BAKT;;;;;;;;mBAST;;KAGP,kCAAA,GAAqC,KAC/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./repository/index.mjs";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { OpenId4VcIssuanceSessionState } from "./OpenId4VcIssuanceSessionState.mjs";
|
|
2
|
+
import { OpenId4VcIssuanceSessionAuthorization, OpenId4VcIssuanceSessionChainedIdentity, OpenId4VcIssuanceSessionDpop, OpenId4VcIssuanceSessionPkce, OpenId4VcIssuanceSessionPresentation, OpenId4VcIssuanceSessionRecord, OpenId4VcIssuanceSessionRecordTransaction, OpenId4VcIssuanceSessionWalletAttestation } from "./repository/OpenId4VcIssuanceSessionRecord.mjs";
|
|
3
|
+
import { OpenId4VcIssuanceSessionRepository } from "./repository/OpenId4VcIssuanceSessionRepository.mjs";
|
|
4
|
+
import { OpenId4VcIssuerRecord, OpenId4VcIssuerRecordProps, OpenId4VcIssuerRecordSignedMetadata, OpenId4VcIssuerRecordTags } from "./repository/OpenId4VcIssuerRecord.mjs";
|
|
5
|
+
import "./repository/index.mjs";
|
|
6
|
+
import { OpenId4VcUpdateIssuerRecordOptions, OpenId4VciAuthorizationCodeFlowConfig, OpenId4VciBatchCredentialIssuanceOptions, OpenId4VciCreateCredentialOfferOptions, OpenId4VciCreateCredentialResponseOptions, OpenId4VciCreateDeferredCredentialResponseOptions, OpenId4VciCreateIssuerOptions, OpenId4VciCreateStatelessCredentialOfferOptions, OpenId4VciCredentialRequestAuthorization, OpenId4VciCredentialRequestToCredentialMapper, OpenId4VciCredentialRequestToCredentialMapperOptions, OpenId4VciDeferredCredentialRequestToCredentialMapper, OpenId4VciDeferredCredentialRequestToCredentialMapperOptions, OpenId4VciDeferredCredentials, OpenId4VciGetVerificationSessionForIssuanceSessionAuthorization, OpenId4VciPreAuthorizedCodeFlowConfig, OpenId4VciSignCredentials, OpenId4VciSignMdocCredentials, OpenId4VciSignSdJwtCredentials, OpenId4VciSignW3cCredentials, OpenId4VciSignW3cV2Credentials, OpenId4VciVersion } from "./OpenId4VcIssuerServiceOptions.mjs";
|
|
7
|
+
import { OpenId4VcIssuerModuleConfig } from "./OpenId4VcIssuerModuleConfig.mjs";
|
|
8
|
+
import { OpenId4VcIssuerService } from "./OpenId4VcIssuerService.mjs";
|
|
9
|
+
import { OpenId4VcIssuerApi } from "./OpenId4VcIssuerApi.mjs";
|
|
10
|
+
import { OpenId4VcIssuanceSessionStateChangedEvent, OpenId4VcIssuerEvents } from "./OpenId4VcIssuerEvents.mjs";
|
|
11
|
+
import { OpenId4VcIssuerModule } from "./OpenId4VcIssuerModule.mjs";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { OpenId4VcIssuerModuleConfig } from "./OpenId4VcIssuerModuleConfig.mjs";
|
|
2
|
+
import { OpenId4VcIssuanceSessionState } from "./OpenId4VcIssuanceSessionState.mjs";
|
|
3
|
+
import { OpenId4VcIssuerEvents } from "./OpenId4VcIssuerEvents.mjs";
|
|
4
|
+
import { OpenId4VcIssuanceSessionRecord } from "./repository/OpenId4VcIssuanceSessionRecord.mjs";
|
|
5
|
+
import { OpenId4VcIssuanceSessionRepository } from "./repository/OpenId4VcIssuanceSessionRepository.mjs";
|
|
6
|
+
import { OpenId4VcIssuerRecord } from "./repository/OpenId4VcIssuerRecord.mjs";
|
|
7
|
+
import "./repository/index.mjs";
|
|
8
|
+
import { OpenId4VcIssuerService } from "./OpenId4VcIssuerService.mjs";
|
|
9
|
+
import { OpenId4VcIssuerApi } from "./OpenId4VcIssuerApi.mjs";
|
|
10
|
+
import { OpenId4VcIssuerModule } from "./OpenId4VcIssuerModule.mjs";
|
|
11
|
+
import "./OpenId4VcIssuerServiceOptions.mjs";
|