DpopVerifier class final
Checks DPoP proofs: signature with the header jwk (ES256), typ, htm, htu, ath,
iat, nonce and jti reuse; the key must be the one the token is bound to.
Nonces are opaque counters of this fake instead of the HMAC windows of 08 7.3; the current
and the previous nonce are accepted, and rotateNonce makes a new one, so a test can make
a nonce stale. EdDSA proofs are rejected (the fake checks ES256 only, README).
Example:
final verifier = DpopVerifier(now: () => DateTime.now().toUtc());
final result = verifier.verify(
proof,
method: 'GET',
htu: 'http://127.0.0.1:4711/api/v1/me',
accessToken: token,
expectedJkt: session.jkt,
);
Constructors
- DpopVerifier({required DateTime now(), Duration maxAge = const Duration(seconds: 60), Duration leeway = const Duration(seconds: 30)})
-
Creates the verifier on
now;maxAgeisauth.dpop_proof_max_age,leewayauth.clock_leeway(08 18).
Properties
- currentNonce → String
-
The nonce the server hands out now (
DPoP-Nonce,hello).no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- leeway → Duration
-
The allowed clock skew.
final
- maxAge → Duration
-
The largest age of
iat.final - now → DateTime Function()
-
The time source.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
rotateNonce(
) → void - Makes a new nonce; the current one becomes the previous one, an older one is stale.
-
toString(
) → String -
A string representation of this object.
inherited
-
verify(
String? proof, {required String method, required String htu, String? accessToken, String? expectedJkt, Set< String> ? nonces}) → DpopResult -
Checks
prooffor a request withmethodtohtu(normalized: scheme and host in lower case, default port removed, no query).
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
athOf(
String accessToken) → String -
The
athofaccessToken: base64url of its SHA-256 (RFC 9449 4.2). -
thumbprint(
Map< String, Object?> jwk) → String -
The RFC 7638 thumbprint of an EC
jwk. -
verifyCompactJws(
JsonMap jwk, String jws) → JsonMap? -
The payload of the compact JWS
jwswhen its header is only{"alg":"ES256"}and the signature verifies with the ECjwk; null otherwise (a step-up confirmation, 08 6.2).