diff --git a/packages/siop-oid4vp/lib/rp/RP.ts b/packages/siop-oid4vp/lib/rp/RP.ts index 827db4c4..52981b78 100644 --- a/packages/siop-oid4vp/lib/rp/RP.ts +++ b/packages/siop-oid4vp/lib/rp/RP.ts @@ -424,8 +424,12 @@ export class RP { state, nonce, verification: mergeVerificationOpts(this._verifyResponseOptions, opts), - presentationDefinitions: opts?.presentationDefinitions ?? this._verifyResponseOptions.presentationDefinitions, - dcqlQuery: opts?.dcqlQuery ?? this._verifyResponseOptions.dcqlQuery, + ...(opts?.presentationDefinitions && !opts?.dcqlQuery && { + presentationDefinitions: this._verifyResponseOptions.presentationDefinitions + }), + ...(opts?.dcqlQuery && { + dcqlQuery: this._verifyResponseOptions.dcqlQuery + }) } } diff --git a/packages/siop-oid4vp/lib/rp/RPBuilder.ts b/packages/siop-oid4vp/lib/rp/RPBuilder.ts index 6a321c3e..4e3c5f6c 100644 --- a/packages/siop-oid4vp/lib/rp/RPBuilder.ts +++ b/packages/siop-oid4vp/lib/rp/RPBuilder.ts @@ -241,10 +241,16 @@ export class RPBuilder { }, true, ) + this._authorizationRequestPayload.presentation_definition = undefined + this._requestObjectPayload.presentation_definition = undefined return this } withPresentationDefinition(definitionOpts: { definition: IPresentationDefinition; definitionUri?: string }, targets?: PropertyTargets): RPBuilder { + if(this._authorizationRequestPayload.dcql_query) { + return this + } + const { definition, definitionUri } = definitionOpts if (this.getSupportedRequestVersion() < SupportedVersion.SIOPv2_D11) {