Skip to content

Commit

Permalink
chore: withDcqlQuery update
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderPostma committed Jan 14, 2025
1 parent 0ea0125 commit 1ac4907
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/siop-oid4vp/lib/rp/RPBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,22 +228,28 @@ export class RPBuilder {
return this
}

withDcqlQuery(dcqlQuery: DcqlQuery, targets?: PropertyTargets): RPBuilder {
withDcqlQuery(dcqlQuery: DcqlQuery | string, targets?: PropertyTargets): RPBuilder {
if (this.getSupportedRequestVersion() >= SupportedVersion.SIOPv2_D12_OID4VP_D20) {
this._authorizationRequestPayload.dcql_query = assignIfAuth(
{
propertyValue: dcqlQuery,
propertyValue: typeof dcqlQuery === 'string' ? dcqlQuery : JSON.stringify(dcqlQuery),
targets
},
false
)
this._requestObjectPayload.dcql_query = assignIfRequestObject(
{
propertyValue: dcqlQuery,
propertyValue: typeof dcqlQuery === 'string' ? dcqlQuery : JSON.stringify(dcqlQuery),
targets
},
true
)

// FIXME we need to find a way in the config to select dcql vs PD without breaking OID4VC-DEMO
this._authorizationRequestPayload.presentation_definition = undefined;
this._authorizationRequestPayload.presentation_definition_uri = undefined;
this._requestObjectPayload.presentation_definition = undefined;
this._requestObjectPayload.presentation_definition_uri = undefined;
}
return this
}
Expand Down

0 comments on commit 1ac4907

Please sign in to comment.