identity_storage/storage/
signature_options.rs1use identity_core::common::Object;
5use identity_core::common::Url;
6
7#[non_exhaustive]
9#[derive(Debug, Default, serde::Serialize, serde::Deserialize, Eq, PartialEq, Clone)]
10#[serde(rename_all = "camelCase")]
11#[serde(default)]
12pub struct JwsSignatureOptions {
13 pub attach_jwk: bool,
16
17 #[serde(skip_serializing_if = "Option::is_none")]
21 pub b64: Option<bool>,
22
23 #[serde(skip_serializing_if = "Option::is_none")]
27 pub typ: Option<String>,
28
29 #[serde(skip_serializing_if = "Option::is_none")]
33 pub cty: Option<String>,
34
35 #[serde(skip_serializing_if = "Option::is_none")]
39 pub url: Option<Url>,
40
41 #[serde(skip_serializing_if = "Option::is_none")]
45 pub nonce: Option<String>,
46
47 #[serde(skip_serializing_if = "Option::is_none")]
53 pub kid: Option<String>,
54
55 pub detached_payload: bool,
59
60 #[serde(skip_serializing_if = "Option::is_none")]
62 pub custom_header_parameters: Option<Object>,
63}
64
65impl JwsSignatureOptions {
66 pub fn new() -> Self {
68 Self::default()
69 }
70
71 pub fn attach_jwk_to_header(mut self, value: bool) -> Self {
73 self.attach_jwk = value;
74 self
75 }
76
77 pub fn b64(mut self, value: bool) -> Self {
79 self.b64 = Some(value);
80 self
81 }
82
83 pub fn typ(mut self, value: impl Into<String>) -> Self {
85 self.typ = Some(value.into());
86 self
87 }
88
89 pub fn cty(mut self, value: impl Into<String>) -> Self {
91 self.cty = Some(value.into());
92 self
93 }
94
95 pub fn url(mut self, value: Url) -> Self {
97 self.url = Some(value);
98 self
99 }
100
101 pub fn nonce(mut self, value: impl Into<String>) -> Self {
103 self.nonce = Some(value.into());
104 self
105 }
106
107 pub fn kid(mut self, value: impl Into<String>) -> Self {
109 self.kid = Some(value.into());
110 self
111 }
112
113 pub fn detached_payload(mut self, value: bool) -> Self {
115 self.detached_payload = value;
116 self
117 }
118
119 pub fn custom_header_parameters(mut self, value: Object) -> Self {
121 self.custom_header_parameters = Some(value);
122 self
123 }
124}