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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*!
* # `yourevalid`
*
* Validation type + trait used in sonata and, soon, polyproto-rs
*/
/// Module defining the [valid::Valid] type
use Debug;
use ;
use ;
use PgPool;
/// *Look, it's you! <3*
///
/// Wrapper type, signaling that the type `T` makes no guarantees about
/// validity itself, and that by calling [Verify::verify] on `T`
/// successfully, you can receive a version of `T` (`Self`), which is
/// guaranteed to be verified and valid.
///
/// New instances of this type can only be instantiated through the
/// [Validate] trait.
///
/// ## Defining "Verified and Valid"
///
/// *Wow, it's you again! <3*
///
/// - **"Verified"** is meant as in "Verified to be well-formed". A type
/// that is verified **must** exhibit all the acceptance criteria and none
/// of the rejection criteria as according to the specification document
/// or documentation of the type.
/// - **"Valid"** means that, at a given point in time, one can attest that
/// this specific instance of a type is cryptographically and contextually
/// fit/allowed to make the claims that this instance of the type is
/// making, and optionally that this instance of a type can be used to
/// validate other information (as would be the case with a signature
/// verifying/public key). **Most importantly,** the validity has only
/// been attested to for this specific point in time. It **must** be
/// carefully evaluated whether re-validation is in order to keep up those
/// guarantees of cryptographic and contextual fitness-for-purpose, if
/// this instance of the type is to be used to validate information made
/// at a different (earlier/later) point in time.
/// Implement this trait on types `T`, where validity is not a guaranteed
/// property.
///
/// ## Example
///
/// ID-Certs have a lifetime `not_valid_before` to `not_valid_after`. In
/// addition, ID-Certs can be manually revoked/invalidated. This means, that
/// the well-formedness of an ID-Cert says nothing about whether it is valid
/// at a certain point in time. The `Valid<T>` trait can help to establish
/// that the validity of a specific ID-Cert has been verified at a certain
/// point in time.