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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//! Represents a cryptographic nonce for OpenID Connect authentication.
use ;
/// A `Nonce` is a **unique, random value** used to prevent replay attacks in OpenID Connect authentication.
/// It ensures that the authentication request and response belong to the same session.
String);
/// # **Overview**
/// A `Nonce` is a **unique, random value** used to prevent replay attacks in OpenID Connect authentication.
/// It ensures that the authentication request and response belong to the same session.
///
/// This structure automatically generates a new random nonce using `UUIDv4` when created.
///
/// # **Usage**
///
/// - The nonce is included in the authentication request (`CodeRequest`).
/// - When receiving an ID token from Google, the `Nonce` in the token should be verified
/// against the original nonce sent in the request.
///
/// # **Implementation Details**
///
/// - The `Nonce` value is a **UUIDv4 string**.
/// - It implements `Serialize` and `Deserialize` for easy integration with JSON-based flows.
///
/// # **Example**
///
/// ```rust,no_run
/// use crate::nonce::Nonce;
///
/// let nonce = Nonce::new();
/// println!("Generated Nonce: {}", nonce.0);
/// ```
/// - Always **verify the nonce** in the received ID token against the originally generated value
/// to ensure security.
/// - If the nonce values **do not match**, the authentication response should be rejected./
/// Equivalent to `Nonce::new()`.
// ==========Test==========