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
use fmt;
use Deref;
/// Unencrypted but authenticated data (like the optional footer), but is NOT stored in the PASETO token (thus, implicit) and MUST be asserted when verifying a token.
///
/// The main purpose for Implicit Assertions is to bind the token to some value that, due to business reasons, shouldn't ever be revealed publicly (i.e., a primary key or foreign key from a relational database table).
/// Implicit Assertions allow you to build systems that are impervious to Confused Deputy attacks without ever having to disclose these internal values.
///
/// # Usage
/// ```
/// # #[cfg(feature = "default")]
/// # {
/// # use rusty_paseto::prelude::*;
/// # let key = PasetoSymmetricKey::<V4, Local>::from(Key::<32>::from(b"wubbalubbadubdubwubbalubbadubdub"));
/// let token = PasetoBuilder::<V4, Local>::default()
/// // note how we set the footer here
/// .set_implicit_assertion(ImplicitAssertion::from("Sometimes science is more art than science"))
/// .build(&key)?;
///
/// // the footer same footer should be used to parse the token
/// let json_value = PasetoParser::<V4, Local>::default()
/// .set_implicit_assertion(ImplicitAssertion::from("Sometimes science is more art than science"))
/// .parse(&token, &key)?;
/// # }
/// # Ok::<(),anyhow::Error>(())
/// ```
;