From 35c2c9666481b28f20de4a3cfc5516bd4d424cfb Mon Sep 17 00:00:00 2001 From: Timo Glastra Date: Sat, 9 Nov 2024 23:33:51 +0530 Subject: [PATCH] fix: loading of verifier module Signed-off-by: Timo Glastra --- .../openid4vc-issuer/OpenId4VcIssuerService.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/openid4vc/src/openid4vc-issuer/OpenId4VcIssuerService.ts b/packages/openid4vc/src/openid4vc-issuer/OpenId4VcIssuerService.ts index 61e92341c..9b4e76ab0 100644 --- a/packages/openid4vc/src/openid4vc-issuer/OpenId4VcIssuerService.ts +++ b/packages/openid4vc/src/openid4vc-issuer/OpenId4VcIssuerService.ts @@ -749,7 +749,6 @@ export class OpenId4VcIssuerService { }> { const { issuanceSession, issuer, requestFormat, authorization } = options const issuerMetadata = await this.getIssuerMetadata(agentContext, issuer) - const verifierApi = agentContext.dependencyManager.resolve(OpenId4VcVerifierApi) const { credentialConfigurations, credentialConfigurationIds } = this.getCredentialConfigurationsForRequest({ issuanceSession, @@ -768,14 +767,16 @@ export class OpenId4VcIssuerService { holderBindings, credentialOffer: issuanceSession.credentialOfferPayload, + // NOTE: this will throw an error if the verifier module is registered and there is a + // verification session. But you can't get here without the verifier module anyway verification: issuanceSession.presentation?.openId4VcVerificationSessionId ? { - session: await verifierApi.getVerificationSessionById( - issuanceSession.presentation.openId4VcVerificationSessionId - ), - response: await verifierApi.getVerifiedAuthorizationResponse( - issuanceSession.presentation.openId4VcVerificationSessionId - ), + session: await agentContext.dependencyManager + .resolve(OpenId4VcVerifierApi) + .getVerificationSessionById(issuanceSession.presentation.openId4VcVerificationSessionId), + response: await agentContext.dependencyManager + .resolve(OpenId4VcVerifierApi) + .getVerifiedAuthorizationResponse(issuanceSession.presentation.openId4VcVerificationSessionId), } : undefined,