1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//! OIDC nonce — opaque RP-minted string, gated by M66.
//!
//! OIDC Core 1.0 §3.1.2.1 + §15.5.2: the RP generates an unguessable
//! per-session value, sends it in the Authentication Request, stores a
//! copy bound to the user's browser session, and compares the id_token's
//! `nonce` claim against the stored copy on token receipt. The engine's
//! M66 gate is the *comparison*; generation/storage live RP-side.
//!
//! ── Type discipline ─────────────────────────────────────────────────────
//!
//! `Nonce` is a newtype over `String` with a non-empty invariant — empty
//! nonces would short-circuit the M66 check trivially (any payload
//! missing `nonce` would equal an empty expected value). Higher entropy
//! requirements (length, character set) are RP-side policy and not
//! enforced here: the engine can't tell whether `"abc123"` is a hash of a
//! 256-bit random or a guess; the RP that minted it knows.
//!
//! Comparison uses plain `==` — the nonce is a public correlator, not a
//! cryptographic secret. The RP holds one copy and the wire carries the
//! other; both halves are observable to anyone who can read the auth
//! request and the id_token. Constant-time comparison would be cargo-
//! culted security for a value with no secrecy contract.
use crateAuthError;
/// Opaque nonce value. Construction validates non-emptiness; the inner
/// string is private so callers cannot bypass the invariant by minting
/// `Nonce(String::new())` directly.
;