diff --git a/patches/@credo-ts+openid4vc+0.6.1+001+add-export-for-issuance-repository.patch b/patches/@credo-ts+openid4vc+0.6.1+001+add-export-for-issuance-repository.patch new file mode 100644 index 00000000..41e03ba6 --- /dev/null +++ b/patches/@credo-ts+openid4vc+0.6.1+001+add-export-for-issuance-repository.patch @@ -0,0 +1,37 @@ +diff --git a/node_modules/@credo-ts/openid4vc/build/index.d.mts b/node_modules/@credo-ts/openid4vc/build/index.d.mts +index 81a221a..20bbab4 100644 +--- a/node_modules/@credo-ts/openid4vc/build/index.d.mts ++++ b/node_modules/@credo-ts/openid4vc/build/index.d.mts +@@ -39,4 +39,5 @@ import { OpenId4VcIssuerModule } from "./openid4vc-issuer/OpenId4VcIssuerModule. + import "./openid4vc-issuer/index.mjs"; + import { OpenId4VcApi } from "./OpenId4VcApi.mjs"; + import { OpenId4VcModule } from "./OpenId4VcModule.mjs"; +-export { DefaultOpenId4VcVerificationSessionRecordTags, DefaultOpenId4VcVerifierRecordTags, OpenId4VcApi, OpenId4VcAuthorizationCodeTokenRequestOptions, OpenId4VcCredentialHolderAttestationBinding, OpenId4VcCredentialHolderBinding, OpenId4VcCredentialHolderDidBinding, OpenId4VcCredentialHolderJwkBinding, OpenId4VcHolderApi, OpenId4VcHolderModule, OpenId4VcIssuanceSessionAuthorization, OpenId4VcIssuanceSessionChainedIdentity, OpenId4VcIssuanceSessionDpop, OpenId4VcIssuanceSessionPkce, OpenId4VcIssuanceSessionPresentation, OpenId4VcIssuanceSessionRecord, OpenId4VcIssuanceSessionRecordTransaction, OpenId4VcIssuanceSessionRepository, OpenId4VcIssuanceSessionState, OpenId4VcIssuanceSessionStateChangedEvent, OpenId4VcIssuanceSessionWalletAttestation, OpenId4VcIssuerApi, OpenId4VcIssuerEvents, OpenId4VcIssuerModule, OpenId4VcIssuerModuleConfig, OpenId4VcIssuerModuleConfigOptions, OpenId4VcIssuerRecord, OpenId4VcIssuerRecordProps, OpenId4VcIssuerRecordSignedMetadata, OpenId4VcIssuerRecordTags, OpenId4VcIssuerService, OpenId4VcJwtIssuer, OpenId4VcJwtIssuerDid, OpenId4VcJwtIssuerEncoded, OpenId4VcJwtIssuerJwk, OpenId4VcJwtIssuerJwkEncoded, OpenId4VcJwtIssuerX5c, OpenId4VcJwtIssuerX5cEncoded, OpenId4VcModule, OpenId4VcModuleConfig, OpenId4VcModuleConfigOptions, OpenId4VcUpdateIssuerRecordOptions, OpenId4VcUpdateVerifierRecordOptions, OpenId4VcVerificationSessionRecord, OpenId4VcVerificationSessionRecordProps, OpenId4VcVerificationSessionRecordTags, OpenId4VcVerificationSessionRepository, OpenId4VcVerificationSessionState, OpenId4VcVerificationSessionStateChangedEvent, OpenId4VcVerifierApi, OpenId4VcVerifierEvents, OpenId4VcVerifierModule, OpenId4VcVerifierModuleConfig, OpenId4VcVerifierModuleConfigOptions, OpenId4VcVerifierRecord, OpenId4VcVerifierRecordProps, OpenId4VcVerifierRecordTags, OpenId4VcVerifierRepository, OpenId4VciAcceptCredentialOfferOptions, OpenId4VciAccessTokenResponse, OpenId4VciAuthCodeFlowOptions, OpenId4VciAuthorizationCodeFlowConfig, OpenId4VciAuthorizationFlow, OpenId4VciAuthorizationServerClientAuthenticationClientSecret, OpenId4VciAuthorizationServerConfig, OpenId4VciBatchCredentialIssuanceOptions, OpenId4VciChainedAuthorizationServerConfig, OpenId4VciCreateCredentialOfferOptions, OpenId4VciCreateCredentialResponseOptions, OpenId4VciCreateDeferredCredentialResponseOptions, OpenId4VciCreateIssuerOptions, OpenId4VciCreateStatelessCredentialOfferOptions, OpenId4VciCredentialBindingOptions, OpenId4VciCredentialBindingResolver, OpenId4VciCredentialConfigurationSupported, OpenId4VciCredentialConfigurationSupportedWithFormats, OpenId4VciCredentialConfigurationsSupported, OpenId4VciCredentialConfigurationsSupportedWithFormats, OpenId4VciCredentialFormatProfile, OpenId4VciCredentialIssuerMetadata, OpenId4VciCredentialIssuerMetadataDisplay, OpenId4VciCredentialOfferPayload, OpenId4VciCredentialRequest, OpenId4VciCredentialRequestAuthorization, OpenId4VciCredentialRequestFormatSpecific, OpenId4VciCredentialRequestOptions, OpenId4VciCredentialRequestToCredentialMapper, OpenId4VciCredentialRequestToCredentialMapperOptions, OpenId4VciCredentialRequestWithFormats, OpenId4VciCredentialResponse, OpenId4VciDeferredCredentialRequest, OpenId4VciDeferredCredentialRequestOptions, OpenId4VciDeferredCredentialRequestToCredentialMapper, OpenId4VciDeferredCredentialRequestToCredentialMapperOptions, OpenId4VciDeferredCredentialResponse, OpenId4VciDeferredCredentials, OpenId4VciDirectAuthorizationServerConfig, OpenId4VciDpopRequestOptions, OpenId4VciGetVerificationSessionForIssuanceSessionAuthorization, OpenId4VciHolderService, OpenId4VciMetadata, OpenId4VciNotificationEvent, OpenId4VciParsedCredentialRequest, OpenId4VciPreAuthorizedCodeFlowConfig, OpenId4VciPreAuthorizedTokenRequestOptions, OpenId4VciProofOfPossessionRequirements, OpenId4VciProofOfPressionProofTypes, OpenId4VciRequestTokenResponse, OpenId4VciResolvedAuthorizationRequest, OpenId4VciResolvedCredentialOffer, OpenId4VciRetrieveAuthorizationCodeUsingPresentationOptions, OpenId4VciSendNotificationOptions, OpenId4VciSignCredentials, OpenId4VciSignMdocCredentials, OpenId4VciSignSdJwtCredentials, OpenId4VciSignW3cCredentials, OpenId4VciSignW3cV2Credentials, OpenId4VciSupportedCredentialFormats, OpenId4VciTokenRefreshOptions, OpenId4VciTokenRequestOptions, OpenId4VciTxCode, OpenId4VciVersion, OpenId4VpAcceptAuthorizationRequestOptions, OpenId4VpAuthorizationRequestPayload, OpenId4VpAuthorizationResponsePayload, OpenId4VpCreateAuthorizationRequestOptions, OpenId4VpCreateAuthorizationRequestReturn, OpenId4VpCreateVerifierOptions, OpenId4VpHolderService, OpenId4VpResolvedAuthorizationRequest, OpenId4VpVerifiedAuthorizationRequest, OpenId4VpVerifiedAuthorizationResponse, OpenId4VpVerifiedAuthorizationResponseDcql, OpenId4VpVerifiedAuthorizationResponsePresentationExchange, OpenId4VpVerifiedAuthorizationResponseTransactionData, OpenId4VpVerifierClientMetadata, OpenId4VpVerifierService, OpenId4VpVerifyAuthorizationResponseOptions, OpenId4VpVersion, Openid4vpAuthorizationRequest, ParsedTransactionDataEntry, ResolveOpenId4VpAuthorizationRequestOptions, ResponseMode, VerifiedOpenId4VcCredentialHolderBinding, authorizationCodeGrantIdentifier, dynamicOid4vciClientAuthentication, getAllowedAndRequestedScopeValues, getCredentialConfigurationsSupportedForScopes, getOfferedCredentials, getOid4vcCallbacks, getOid4vcDecryptJweCallback, getOid4vcEncryptJweCallback, getOid4vcJwtSignCallback, getOid4vcJwtVerifyCallback, getScopesFromCredentialConfigurationsSupported, openId4VciSupportedCredentialFormats, preAuthorizedCodeGrantIdentifier }; +\ No newline at end of file ++import { OpenId4VcIssuerRepository } from "./openid4vc-issuer/repository/OpenId4VcIssuerRepository.mjs"; ++export { OpenId4VcIssuerRepository, DefaultOpenId4VcVerificationSessionRecordTags, DefaultOpenId4VcVerifierRecordTags, OpenId4VcApi, OpenId4VcAuthorizationCodeTokenRequestOptions, OpenId4VcCredentialHolderAttestationBinding, OpenId4VcCredentialHolderBinding, OpenId4VcCredentialHolderDidBinding, OpenId4VcCredentialHolderJwkBinding, OpenId4VcHolderApi, OpenId4VcHolderModule, OpenId4VcIssuanceSessionAuthorization, OpenId4VcIssuanceSessionChainedIdentity, OpenId4VcIssuanceSessionDpop, OpenId4VcIssuanceSessionPkce, OpenId4VcIssuanceSessionPresentation, OpenId4VcIssuanceSessionRecord, OpenId4VcIssuanceSessionRecordTransaction, OpenId4VcIssuanceSessionRepository, OpenId4VcIssuanceSessionState, OpenId4VcIssuanceSessionStateChangedEvent, OpenId4VcIssuanceSessionWalletAttestation, OpenId4VcIssuerApi, OpenId4VcIssuerEvents, OpenId4VcIssuerModule, OpenId4VcIssuerModuleConfig, OpenId4VcIssuerModuleConfigOptions, OpenId4VcIssuerRecord, OpenId4VcIssuerRecordProps, OpenId4VcIssuerRecordSignedMetadata, OpenId4VcIssuerRecordTags, OpenId4VcIssuerService, OpenId4VcJwtIssuer, OpenId4VcJwtIssuerDid, OpenId4VcJwtIssuerEncoded, OpenId4VcJwtIssuerJwk, OpenId4VcJwtIssuerJwkEncoded, OpenId4VcJwtIssuerX5c, OpenId4VcJwtIssuerX5cEncoded, OpenId4VcModule, OpenId4VcModuleConfig, OpenId4VcModuleConfigOptions, OpenId4VcUpdateIssuerRecordOptions, OpenId4VcUpdateVerifierRecordOptions, OpenId4VcVerificationSessionRecord, OpenId4VcVerificationSessionRecordProps, OpenId4VcVerificationSessionRecordTags, OpenId4VcVerificationSessionRepository, OpenId4VcVerificationSessionState, OpenId4VcVerificationSessionStateChangedEvent, OpenId4VcVerifierApi, OpenId4VcVerifierEvents, OpenId4VcVerifierModule, OpenId4VcVerifierModuleConfig, OpenId4VcVerifierModuleConfigOptions, OpenId4VcVerifierRecord, OpenId4VcVerifierRecordProps, OpenId4VcVerifierRecordTags, OpenId4VcVerifierRepository, OpenId4VciAcceptCredentialOfferOptions, OpenId4VciAccessTokenResponse, OpenId4VciAuthCodeFlowOptions, OpenId4VciAuthorizationCodeFlowConfig, OpenId4VciAuthorizationFlow, OpenId4VciAuthorizationServerClientAuthenticationClientSecret, OpenId4VciAuthorizationServerConfig, OpenId4VciBatchCredentialIssuanceOptions, OpenId4VciChainedAuthorizationServerConfig, OpenId4VciCreateCredentialOfferOptions, OpenId4VciCreateCredentialResponseOptions, OpenId4VciCreateDeferredCredentialResponseOptions, OpenId4VciCreateIssuerOptions, OpenId4VciCreateStatelessCredentialOfferOptions, OpenId4VciCredentialBindingOptions, OpenId4VciCredentialBindingResolver, OpenId4VciCredentialConfigurationSupported, OpenId4VciCredentialConfigurationSupportedWithFormats, OpenId4VciCredentialConfigurationsSupported, OpenId4VciCredentialConfigurationsSupportedWithFormats, OpenId4VciCredentialFormatProfile, OpenId4VciCredentialIssuerMetadata, OpenId4VciCredentialIssuerMetadataDisplay, OpenId4VciCredentialOfferPayload, OpenId4VciCredentialRequest, OpenId4VciCredentialRequestAuthorization, OpenId4VciCredentialRequestFormatSpecific, OpenId4VciCredentialRequestOptions, OpenId4VciCredentialRequestToCredentialMapper, OpenId4VciCredentialRequestToCredentialMapperOptions, OpenId4VciCredentialRequestWithFormats, OpenId4VciCredentialResponse, OpenId4VciDeferredCredentialRequest, OpenId4VciDeferredCredentialRequestOptions, OpenId4VciDeferredCredentialRequestToCredentialMapper, OpenId4VciDeferredCredentialRequestToCredentialMapperOptions, OpenId4VciDeferredCredentialResponse, OpenId4VciDeferredCredentials, OpenId4VciDirectAuthorizationServerConfig, OpenId4VciDpopRequestOptions, OpenId4VciGetVerificationSessionForIssuanceSessionAuthorization, OpenId4VciHolderService, OpenId4VciMetadata, OpenId4VciNotificationEvent, OpenId4VciParsedCredentialRequest, OpenId4VciPreAuthorizedCodeFlowConfig, OpenId4VciPreAuthorizedTokenRequestOptions, OpenId4VciProofOfPossessionRequirements, OpenId4VciProofOfPressionProofTypes, OpenId4VciRequestTokenResponse, OpenId4VciResolvedAuthorizationRequest, OpenId4VciResolvedCredentialOffer, OpenId4VciRetrieveAuthorizationCodeUsingPresentationOptions, OpenId4VciSendNotificationOptions, OpenId4VciSignCredentials, OpenId4VciSignMdocCredentials, OpenId4VciSignSdJwtCredentials, OpenId4VciSignW3cCredentials, OpenId4VciSignW3cV2Credentials, OpenId4VciSupportedCredentialFormats, OpenId4VciTokenRefreshOptions, OpenId4VciTokenRequestOptions, OpenId4VciTxCode, OpenId4VciVersion, OpenId4VpAcceptAuthorizationRequestOptions, OpenId4VpAuthorizationRequestPayload, OpenId4VpAuthorizationResponsePayload, OpenId4VpCreateAuthorizationRequestOptions, OpenId4VpCreateAuthorizationRequestReturn, OpenId4VpCreateVerifierOptions, OpenId4VpHolderService, OpenId4VpResolvedAuthorizationRequest, OpenId4VpVerifiedAuthorizationRequest, OpenId4VpVerifiedAuthorizationResponse, OpenId4VpVerifiedAuthorizationResponseDcql, OpenId4VpVerifiedAuthorizationResponsePresentationExchange, OpenId4VpVerifiedAuthorizationResponseTransactionData, OpenId4VpVerifierClientMetadata, OpenId4VpVerifierService, OpenId4VpVerifyAuthorizationResponseOptions, OpenId4VpVersion, Openid4vpAuthorizationRequest, ParsedTransactionDataEntry, ResolveOpenId4VpAuthorizationRequestOptions, ResponseMode, VerifiedOpenId4VcCredentialHolderBinding, authorizationCodeGrantIdentifier, dynamicOid4vciClientAuthentication, getAllowedAndRequestedScopeValues, getCredentialConfigurationsSupportedForScopes, getOfferedCredentials, getOid4vcCallbacks, getOid4vcDecryptJweCallback, getOid4vcEncryptJweCallback, getOid4vcJwtSignCallback, getOid4vcJwtVerifyCallback, getScopesFromCredentialConfigurationsSupported, openId4VciSupportedCredentialFormats, preAuthorizedCodeGrantIdentifier }; +\ No newline at end of file +diff --git a/node_modules/@credo-ts/openid4vc/build/index.mjs b/node_modules/@credo-ts/openid4vc/build/index.mjs +index 27b6afa..7c9bdaf 100644 +--- a/node_modules/@credo-ts/openid4vc/build/index.mjs ++++ b/node_modules/@credo-ts/openid4vc/build/index.mjs +@@ -33,5 +33,6 @@ import { OpenId4VcIssuerModule } from "./openid4vc-issuer/OpenId4VcIssuerModule. + import "./openid4vc-issuer/index.mjs"; + import { OpenId4VcApi } from "./OpenId4VcApi.mjs"; + import { OpenId4VcModule } from "./OpenId4VcModule.mjs"; ++import { OpenId4VcIssuerRepository } from "./openid4vc-issuer/repository/OpenId4VcIssuerRepository.mjs"; + +-export { OpenId4VcApi, OpenId4VcHolderApi, OpenId4VcHolderModule, OpenId4VcIssuanceSessionRecord, OpenId4VcIssuanceSessionRepository, OpenId4VcIssuanceSessionState, OpenId4VcIssuerApi, OpenId4VcIssuerEvents, OpenId4VcIssuerModule, OpenId4VcIssuerModuleConfig, OpenId4VcIssuerRecord, OpenId4VcIssuerService, OpenId4VcModule, OpenId4VcModuleConfig, OpenId4VcVerificationSessionRecord, OpenId4VcVerificationSessionRepository, OpenId4VcVerificationSessionState, OpenId4VcVerifierApi, OpenId4VcVerifierEvents, OpenId4VcVerifierModule, OpenId4VcVerifierModuleConfig, OpenId4VcVerifierRecord, OpenId4VcVerifierRepository, OpenId4VciAuthorizationFlow, OpenId4VciCredentialFormatProfile, OpenId4VciHolderService, OpenId4VpHolderService, OpenId4VpVerifierService, authorizationCodeGrantIdentifier, dynamicOid4vciClientAuthentication, getAllowedAndRequestedScopeValues, getCredentialConfigurationsSupportedForScopes, getOfferedCredentials, getOid4vcCallbacks, getOid4vcDecryptJweCallback, getOid4vcEncryptJweCallback, getOid4vcJwtSignCallback, getOid4vcJwtVerifyCallback, getScopesFromCredentialConfigurationsSupported, openId4VciSupportedCredentialFormats, preAuthorizedCodeGrantIdentifier }; +\ No newline at end of file ++export { OpenId4VcIssuerRepository, OpenId4VcApi, OpenId4VcHolderApi, OpenId4VcHolderModule, OpenId4VcIssuanceSessionRecord, OpenId4VcIssuanceSessionRepository, OpenId4VcIssuanceSessionState, OpenId4VcIssuerApi, OpenId4VcIssuerEvents, OpenId4VcIssuerModule, OpenId4VcIssuerModuleConfig, OpenId4VcIssuerRecord, OpenId4VcIssuerService, OpenId4VcModule, OpenId4VcModuleConfig, OpenId4VcVerificationSessionRecord, OpenId4VcVerificationSessionRepository, OpenId4VcVerificationSessionState, OpenId4VcVerifierApi, OpenId4VcVerifierEvents, OpenId4VcVerifierModule, OpenId4VcVerifierModuleConfig, OpenId4VcVerifierRecord, OpenId4VcVerifierRepository, OpenId4VciAuthorizationFlow, OpenId4VciCredentialFormatProfile, OpenId4VciHolderService, OpenId4VpHolderService, OpenId4VpVerifierService, authorizationCodeGrantIdentifier, dynamicOid4vciClientAuthentication, getAllowedAndRequestedScopeValues, getCredentialConfigurationsSupportedForScopes, getOfferedCredentials, getOid4vcCallbacks, getOid4vcDecryptJweCallback, getOid4vcEncryptJweCallback, getOid4vcJwtSignCallback, getOid4vcJwtVerifyCallback, getScopesFromCredentialConfigurationsSupported, openId4VciSupportedCredentialFormats, preAuthorizedCodeGrantIdentifier }; +\ No newline at end of file +diff --git a/node_modules/@credo-ts/openid4vc/build/openid4vc-issuer/index.mjs b/node_modules/@credo-ts/openid4vc/build/openid4vc-issuer/index.mjs +index c389872..4faeb68 100644 +--- a/node_modules/@credo-ts/openid4vc/build/openid4vc-issuer/index.mjs ++++ b/node_modules/@credo-ts/openid4vc/build/openid4vc-issuer/index.mjs +@@ -8,4 +8,5 @@ import "./repository/index.mjs"; + import { OpenId4VcIssuerService } from "./OpenId4VcIssuerService.mjs"; + import { OpenId4VcIssuerApi } from "./OpenId4VcIssuerApi.mjs"; + import { OpenId4VcIssuerModule } from "./OpenId4VcIssuerModule.mjs"; ++import { OpenId4VcIssuerRepository } from "./repository/OpenId4VcIssuerRepository.mjs"; + import "./OpenId4VcIssuerServiceOptions.mjs"; diff --git a/src/controllers/openid4vc/issuers/issuer.Controller.ts b/src/controllers/openid4vc/issuers/issuer.Controller.ts index 5dbf0418..d95c18aa 100644 --- a/src/controllers/openid4vc/issuers/issuer.Controller.ts +++ b/src/controllers/openid4vc/issuers/issuer.Controller.ts @@ -79,16 +79,15 @@ export class IssuerController extends Controller { } } - // TODO: We can implement this method later /** * Deletes a specific issuer by record id. */ - // @Delete('{id}') - // public async deleteIssuer(@Request() request: Req, @Path() id: string): Promise { - // try { - // await issuerService.deleteIssuer(request, id) - // } catch (error) { - // throw ErrorHandlingService.handle(error) - // } - // } + @Delete('{id}') + public async deleteIssuer(@Request() request: Req, @Path() id: string) { + try { + return await issuerService.deleteIssuer(request, id) + } catch (error) { + throw ErrorHandlingService.handle(error) + } + } } diff --git a/src/controllers/openid4vc/issuers/issuer.service.ts b/src/controllers/openid4vc/issuers/issuer.service.ts index 68c635ae..d5afc0e1 100644 --- a/src/controllers/openid4vc/issuers/issuer.service.ts +++ b/src/controllers/openid4vc/issuers/issuer.service.ts @@ -3,6 +3,8 @@ import type { CreateIssuerOptions } from '../types/issuer.types' import type { Agent } from '@credo-ts/core' import type { Request as Req } from 'express' +import { OpenId4VcIssuerRepository } from '@credo-ts/openid4vc' + export class IssuerService { public async createIssuerAgent( agentReq: Req, @@ -42,11 +44,11 @@ export class IssuerService { return await agentReq.agent.modules.openid4vc.issuer?.getIssuerByIssuerId(publicIssuerId) } - // TODO: We can implement this method later - // public async deleteIssuer(agentReq: Req, issuerId: string) { - // const result = (agentReq.agent as Agent).openid4vc.config.issuer. - // return result - // } + public async deleteIssuer(agentReq: Req, issuerId: string) { + const issuanceRepository = agentReq.agent.dependencyManager.resolve(OpenId4VcIssuerRepository) + await issuanceRepository.deleteById(agentReq.agent.context, issuerId) + return { message: 'Record deleted successfully' } + } public async getIssuerAgentMetaData(agentReq: Req, issuerId: string) { return (await agentReq.agent.modules.openid4vc.issuer?.getIssuerMetadata(issuerId)) as any