Repository navigation
Conversation
🦋 Changeset detectedLatest commit: d231a87 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
🟡 Changes recommended
Credential presentation can proceed without a verifier trust decision when transport context is null, and the provider-presence guard does not address the WebSocket startup-readiness failure.
2 open issues
What changed in this PR
This PR aims to prevent premature “untrusted verifier” refusals during DC-API callback startup in the wallet’s OpenID4VP flow.
Changes:
- Allows processing to continue without a client-side trust result when transport context is absent.
- Adds explanatory comments and logging for that case.
- Updates the callback dependency to track the full transport context.
| File | Description |
|---|---|
src/hooks/useOID4VPFlow.ts |
Changes DC-API trust gating, adds diagnostic context, and updates callback dependencies. |
Review effort: Balanced
| }) | ||
| : undefined; | ||
|
|
||
| if (trustResult && !trustResult?.trusted) { |
…VP 1.0 §8.1) The client-held direct_post.jwt response relayed the sign handler's bare vp_token string through verbatim. The final spec requires vp_token to be a JSON object with one member per Credential Query - the key the query's id, the value an array of its presentations - and verifiers enforcing that shape reject the bare string with malformed/invalid response (found live in the WRPAC drill: every cross-device presentation against siros-verifier-core v0.1.4 failed at this last hop, after the JWE envelope itself verified clean). A bare token is now restructured under the sign request's credentialsToInclude credential query ids, mirroring the engine's own non-encrypted builder exactly (newline-split, count-checked, a repeated query id collected in order) - the builder direct_post.jwt bypasses by relaying this JWE verbatim. An already-object response passes through.
The §8.1 object-form fix landed only in the JARM builder the WebSocket transport uses. The phone's QR/link flow takes another path: the callback page opens as a companion window (window.opener), answers the sign handler, and hands JSON.parse(vpToken) to DCAPISession - a JSON-quoted single token parses to a bare string at runtime (the Record<> type is decorative in JS), so the DC-API path still encrypted the bare string and final-spec verifiers kept rejecting it. Extract the restructure into a shared restructureDcqlVpToken (the JARM builder delegates to it) and wrap at the DC-API caller with the selection's own credential query ids. A JSON-quoted token now unwraps to the token itself before the object form is built.
…I callback has no transport context The QR link opens the callback page before the WebSocket transport connects; transportContext is null and the optional chain transportContext?.trustEvaluators.evaluateVerifierTrust() returns undefined. !undefined?.trusted is always true, so the 'untrusted verifier' refusal fires unconditionally before the engine's own server-side evaluation — which handles this correctly — is ever consulted. The client-side check now runs only when a context exists; without one, the engine makes the actual trust decision. Found live in the WRPAC drill: every cross-device presentation failed with 'untrusted verifier' on the phone while the wallet-backend showed zero flow activity.
03b5248 to
e1f86c6
Compare
| `DCQL vp_token has ${tokens.length} tokens but ${ids.length} credentials selected`, | ||
| ); | ||
| } | ||
| const byQueryId: Record<string, string[]> = {}; |
There was a problem hiding this comment.
I think rather than skipping the trust check, we should decouple the trust evaluators from the transport context, the could sit in their own context. I would prefer that approach regardless of if we skip checking trust here or not (which I don't think we should, unless necessary).
| Fix the client-held `direct_post.jwt` (JARM) response to carry `vp_token` in the | ||
| OpenID4VP 1.0 §8.1 object form: a JSON object with one member per Credential | ||
| Query, the key the query's `id`, the value an array of that query's | ||
| presentations. A bare vp_token string is now restructured under the sign | ||
| request's `credentialsToInclude` credential query ids — the same newline-split, | ||
| count-checked, in-order restructure the engine's own non-encrypted path | ||
| performs (go-wallet-backend's `buildDCQLVPToken`, which direct_post.jwt | ||
| bypasses by relaying the client's JWE verbatim). Verifiers enforcing the final | ||
| shape (including the OIDF conformance suite's own client) reject the previous | ||
| bare-string form with `malformed`/`invalid response` — found live in the SIROS | ||
| WRPAC drill, where every cross-device presentation against | ||
| siros-verifier-core v0.1.4 failed at this last hop. |
There was a problem hiding this comment.
Changesets are meant to be a short summary, not a detailed one. Summarise what the PR does, and if necessary, add more than one changeset.
The evaluators sit in their own TrustEvaluatorProvider — a sibling of the transport provider, not a child — so routes that run before a transport connects (the DC-API callback page) evaluate trust the same way the main app does. The provider resolves the backend token through the same session-based mechanism the transport uses, independently. The handleDCAPIRequest hook consumes the evaluators from the new context instead of the transport context — the trust check now fires on every route, not just where a transport is established.
|
| const getAuthToken = () => authToken ?? ''; | ||
| const evaluateIssuerTrust = createIssuerTrustEvaluator({ | ||
| httpClient, | ||
| backendUrl: BACKEND_URL, | ||
| getAuthToken, | ||
| tenantId, | ||
| }); | ||
| const evaluateVerifierTrust = createVerifierTrustEvaluator({ | ||
| httpClient, | ||
| backendUrl: BACKEND_URL, | ||
| getAuthToken, | ||
| tenantId, | ||
| }); | ||
| return { evaluateIssuerTrust, evaluateVerifierTrust }; | ||
| }, [tenantId, authToken, httpClient]); |






What
The QR link opens the DC-API callback page before the WebSocket transport connects.
transportContextis null, and the optional chaintransportContext?.trustEvaluators.evaluateVerifierTrust()returnsundefined.!undefined?.trustedis alwaystrue, so the 'untrusted verifier' refusal fires unconditionally before the engine's own server-side evaluation — which handles this correctly — is ever consulted.Every cross-device presentation failed with 'untrusted verifier' on the phone while the wallet-backend showed zero flow activity — found live in the WRPAC drill.
The change
The client-side trust check runs only when a transport context exists. Without one, the engine's server-side evaluation makes the actual trust decision (proven working in earlier rounds: 'Trust evaluation with x5c', cert_count=2, decision true).
Also: the
useCallbackdependency updated fromtransportContext?.trustEvaluatorstotransportContext(the exhaustive-deps warning it was suppressing).