Skip to content
Wallet and Entity Collection draft updates
Documentation menu

16.9. Apply effective DCQL and framework query policy

Feature guides / 16. Wallet workflows · Example context

Car Rental Company requests driving licence data, but Driving Licence Federation may constrain the permitted query. The wallet must evaluate the effective query after federation policy, rather than showing whatever appeared first in the request.

How to use it

Request completion returns effectiveQueries and querySource. Metadata can supply or override queries; policy and optional framework matching contribute to acceptance. queryPolicy is the application's synchronous or asynchronous decision hook over authenticated context. Wallet DCQL policy; DCQL.

import type { CryptoEngine } from "@oidfed/crypto";
import { CredentialVerifierRole, type AuthorizationRequestOptions, type WalletAuthorizationRequest } from "@oidfed/wallet";
import type { TrustAnchorSet } from "@oidfed/core";

export async function completeDrivingLicenceQuery(
  engine: CryptoEngine,
  outer: WalletAuthorizationRequest, signedRequestJwt: string, anchors: TrustAnchorSet,
  approve: NonNullable<AuthorizationRequestOptions["queryPolicy"]>,
) {
  const prepared = await CredentialVerifierRole.prepareAuthorizationRequest(outer, anchors, {
    engine,
    queryPolicy: approve,
  });
  if (!prepared.ok) return prepared;
  return CredentialVerifierRole.completeAuthorizationRequest(prepared.value, signedRequestJwt);
}

What your application owns

Implement the framework's real matching rules in approve; a placeholder true would skip that policy. Received duplicate claim paths are normalized after policy evaluation, while publication/outbound creation rejects duplicates. The host maps scopes where required and handles credential-format semantics. An effective query still does not prove the returned credential satisfies it: verify presentations and holder binding in the protocol engine.

Use the query after federation policy

Car Rental Company's request expresses what it wants; Driving Licence Federation's policy and the wallet profile determine which query is effective.

The wallet passes the sanitized request and effectiveQueries together to its credential-selection engine. An immediate-Superior override replaces the requested query with the effective scenario list. Otherwise the signed inline query, or the host's scope mapping, remains active and may need matching against a separate published scenario list. queryPolicy or the protocol engine enforces that relationship; the mere presence of a scenario list does not authorize any different request.

A successful query-policy check is not a claim that the wallet holds a matching credential or that Maya agreed to disclose it. Keep credential-format interpretation, matching, and consent in the host engine. If a requested scope needs a local query mapping, configure that mapping explicitly instead of treating the scope string as a verified query.

Next: 16.10. Approve transaction data in a presentation request

View source on GitHub