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
use identity_core::crypto::ProofPurpose;
use serde;
use serde::Deserialize;
use serde::Serialize;
use crate::verification::MethodScope;
use crate::verification::MethodType;
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct VerifierOptions {
pub method_scope: Option<MethodScope>,
pub method_type: Option<Vec<MethodType>>,
pub challenge: Option<String>,
pub domain: Option<String>,
pub purpose: Option<ProofPurpose>,
pub allow_expired: Option<bool>,
}
impl VerifierOptions {
pub fn new() -> Self {
Self {
method_scope: None,
method_type: None,
challenge: None,
domain: None,
purpose: None,
allow_expired: None,
}
}
#[must_use]
pub fn method_scope(mut self, method_scope: MethodScope) -> Self {
self.method_scope = Some(method_scope);
self
}
#[must_use]
pub fn method_type(mut self, method_type: Vec<MethodType>) -> Self {
self.method_type = Some(method_type);
self
}
#[must_use]
pub fn challenge(mut self, challenge: String) -> Self {
self.challenge = Some(challenge);
self
}
#[must_use]
pub fn domain(mut self, domain: String) -> Self {
self.domain = Some(domain);
self
}
#[must_use]
pub fn purpose(mut self, purpose: ProofPurpose) -> Self {
self.purpose = Some(purpose);
self
}
#[must_use]
pub fn allow_expired(mut self, allow_expired: bool) -> Self {
self.allow_expired = Some(allow_expired);
self
}
}