pub fn verify_sender_bound_token(
token: &ExchangedToken,
dpop_pubkey: &[u8; 32],
) -> Result<()>Expand description
Verify an ExchangedToken is actually sender-bound to dpop_pubkey
before the caller (the browser sender-bound exchange) trusts it (#1425 r2
P2).
parse_exchange_response treats an omitted or Bearer token_type as
backward-compatible (other, non-browser callers of this endpoint shape
still expect that). But fetch_exchange_token is exclusively the
sender-bound browser exchange: a response that comes back as Bearer (a
misrouted request, a downgraded/compatibility responder, or a proxy that
stripped the DPoP semantics) must be rejected here rather than silently
installed as if it were correctly bound — the caller only checks
token_type once, at parse time, and every downstream RPC assumes the
installed credential really is cnf.jkt-bound to this key.
This also independently confirms the token’s cnf.jkt (decoded from the
unverified JWT payload — the server re-verifies the signature and binding
on every RPC; this is client-side defense in depth, not the trust
boundary) equals ed25519_dpop_jkt of the exact key that produced the
proof, so a compatibility/misrouted response bound to some other key
cannot be mistaken for a token this browser can actually use.