@@ -32,7 +32,11 @@ import { VerificationSessionQuery } from '../interfaces/oid4vp-verifier.interfac
3232import { BaseService } from 'libs/service/base.service' ;
3333import { NATSClient } from '@credebl/common/NATSClient' ;
3434
35- import { Oid4vpPresentationWh , RequestSigner } from '../interfaces/oid4vp-verification-sessions.interfaces' ;
35+ import {
36+ Oid4vpPresentationWh ,
37+ RequestSigner ,
38+ VerifyAuthorizationResponse
39+ } from '../interfaces/oid4vp-verification-sessions.interfaces' ;
3640import { X509CertificateRecord } from '@credebl/common/interfaces/x509.interface' ;
3741import { SignerMethodOption , x5cKeyType } from '@credebl/enum/enum' ;
3842import { CreateVerificationTemplate , UpdateVerificationTemplate } from '../interfaces/verification-template.interfaces' ;
@@ -694,4 +698,31 @@ export class Oid4vpVerificationService extends BaseService {
694698 throw new RpcException ( error ?. response ?? error . error ?? error ) ;
695699 }
696700 }
701+
702+ async verifyAuthorizationResponse (
703+ verifyAuthorizationResponse : VerifyAuthorizationResponse ,
704+ orgId : string
705+ ) : Promise < object > {
706+ this . logger . debug (
707+ `[verifyAuthorizationResponse] called for orgId=${ orgId } , verificationSessionId=${ JSON . stringify ( verifyAuthorizationResponse . verificationSessionId ) } `
708+ ) ;
709+ try {
710+ const agentDetails = await this . oid4vpRepository . getAgentEndPoint ( orgId ) ;
711+ if ( ! agentDetails ) {
712+ throw new NotFoundException ( ResponseMessages . issuance . error . agentEndPointNotFound ) ;
713+ }
714+ const { agentEndPoint, id } = agentDetails ;
715+ const url = getAgentUrl ( agentEndPoint , CommonConstants . OIDC_VERIFIER_SESSION_AUTH_RESPONSE_VERIFY ) ;
716+ const verificationResult = await this . natsClient . sendNatsMessage (
717+ this . oid4vpVerificationServiceProxy ,
718+ 'agent-verify-oid4vp-session-auth-response' ,
719+ { url, orgId, verifyAuthorizationResponse }
720+ ) ;
721+ this . logger . debug ( `[verifyAuthorizationResponse] verification result received successfully for orgId=${ orgId } ` ) ;
722+ return verificationResult ;
723+ } catch ( error ) {
724+ this . logger . error ( `[verifyAuthorizationResponse] - error: ${ JSON . stringify ( error ) } ` ) ;
725+ throw new RpcException ( error ?. response ?? error ) ;
726+ }
727+ }
697728}
0 commit comments