@@ -13,7 +13,7 @@ import {DcqlPresentation, DcqlQuery} from 'dcql'
1313import { verifyRevocation } from '../helpers'
1414import { AuthorizationResponse } from './AuthorizationResponse'
1515import { Dcql } from './Dcql'
16- import { RevocationVerification , VerifiedOpenID4VPSubmission } from '../types'
16+ import { PresentationSubmission , RevocationVerification , VerifiedOpenID4VPSubmission } from '../types'
1717import { VerifyAuthorizationResponseOpts , } from './types'
1818
1919export const extractNonceFromWrappedVerifiablePresentation = ( wrappedVp : WrappedVerifiablePresentation ) : string | undefined => {
@@ -50,6 +50,7 @@ export const verifyPresentations = async (
5050 verifyOpts : VerifyAuthorizationResponseOpts ,
5151) : Promise < { dcql : VerifiedOpenID4VPSubmission } > => {
5252 const dcqlQuery = DcqlQuery . parse ( verifyOpts . dcqlQuery ?? authorizationResponse ?. authorizationRequest . payload . dcql_query as DcqlQuery )
53+ DcqlQuery . validate ( dcqlQuery )
5354 const dcqlPresentation = extractDcqlPresentationFromDcqlVpToken ( authorizationResponse . payload . vp_token as string , { hasher : verifyOpts . hasher } )
5455
5556 const wrappedPresentations = Object . values ( dcqlPresentation )
@@ -59,7 +60,7 @@ export const verifyPresentations = async (
5960 ) ,
6061 )
6162
62- await Dcql . assertValidDcqlPresentationResult ( authorizationResponse . payload . vp_token as string , dcqlQuery , { hasher : verifyOpts . hasher } )
63+ const dcqlPresentationResult = await Dcql . assertValidDcqlPresentationResult ( authorizationResponse . payload . vp_token as string , dcqlQuery , { hasher : verifyOpts . hasher } )
6364
6465 if ( verifiedPresentations . some ( ( verified ) => ! verified ) ) {
6566 const message = verifiedPresentations
@@ -95,13 +96,13 @@ export const verifyPresentations = async (
9596 }
9697 }
9798
98- return { dcql : { nonce, presentation : dcqlPresentation , dcqlQuery } }
99+ return { dcql : { nonce, presentation : dcqlPresentation , dcqlQuery , dcqlPresentationResult } }
99100}
100101
101102export const extractDcqlPresentationFromDcqlVpToken = (
102103 vpToken : DcqlPresentation . Input | string ,
103104 opts ?: { hasher ?: HasherSync } ,
104- ) : { [ credentialQueryId : string ] : WrappedVerifiablePresentation } => {
105+ ) : PresentationSubmission => {
105106 return Object . fromEntries (
106107 Object . entries ( DcqlPresentation . parse ( vpToken ) ) . map ( ( [ credentialQueryId , vp ] ) => [
107108 credentialQueryId ,
0 commit comments