1use num_enum::{IntoPrimitive, TryFromPrimitive};
2use zeroize::Zeroize;
3
4#[cfg(feature = "fuzz")]
5use arbitrary::Arbitrary;
6
7#[cfg(feature = "wbindgen")]
8use wasm_bindgen::prelude::*;
9
10#[cfg_attr(feature = "wbindgen", wasm_bindgen())]
12#[cfg_attr(feature = "fuzz", derive(Arbitrary))]
13#[derive(Clone, Copy, PartialEq, Eq, Zeroize, IntoPrimitive, TryFromPrimitive, Debug)]
14#[repr(u16)]
15pub enum DataType {
16    None = 0,
18    Key = 1,
20    Ciphertext = 2,
22    PasswordHash = 3,
24    Share = 4,
26    SigningKey = 5,
28    Signature = 6,
30    OnlineCiphertext = 7,
32}
33
34impl Default for DataType {
35    fn default() -> Self {
36        Self::None
37    }
38}
39
40#[cfg_attr(feature = "wbindgen", wasm_bindgen())]
42#[cfg_attr(feature = "fuzz", derive(Arbitrary))]
43#[derive(Clone, Copy, PartialEq, Eq, Zeroize, IntoPrimitive, TryFromPrimitive, Debug)]
44#[repr(u16)]
45pub enum CiphertextVersion {
46    Latest = 0,
48    V1 = 1,
50    V2 = 2,
52}
53
54impl Default for CiphertextVersion {
55    fn default() -> Self {
56        Self::Latest
57    }
58}
59
60#[cfg_attr(feature = "wbindgen", wasm_bindgen())]
62#[cfg_attr(feature = "fuzz", derive(Arbitrary))]
63#[derive(Clone, Copy, PartialEq, Eq, Zeroize, IntoPrimitive, TryFromPrimitive, Debug)]
64#[repr(u16)]
65pub enum OnlineCiphertextVersion {
66    Latest = 0,
68    V1 = 1,
70}
71
72impl Default for OnlineCiphertextVersion {
73    fn default() -> Self {
74        Self::Latest
75    }
76}
77
78#[cfg_attr(feature = "wbindgen", wasm_bindgen())]
80#[cfg_attr(feature = "fuzz", derive(Arbitrary))]
81#[derive(Clone, Copy, PartialEq, Eq, Zeroize, IntoPrimitive, TryFromPrimitive, Debug)]
82#[repr(u16)]
83pub enum PasswordHashVersion {
84    Latest = 0,
86    V1 = 1,
88}
89
90impl Default for PasswordHashVersion {
91    fn default() -> Self {
92        Self::Latest
93    }
94}
95
96#[cfg_attr(feature = "wbindgen", wasm_bindgen())]
98#[cfg_attr(feature = "fuzz", derive(Arbitrary))]
99#[derive(Clone, Copy, PartialEq, Eq, Zeroize, IntoPrimitive, TryFromPrimitive, Debug)]
100#[repr(u16)]
101pub enum KeyVersion {
102    Latest = 0,
104    V1 = 1,
106}
107
108impl Default for KeyVersion {
109    fn default() -> Self {
110        Self::Latest
111    }
112}
113
114#[cfg_attr(feature = "wbindgen", wasm_bindgen())]
115#[cfg_attr(feature = "fuzz", derive(Arbitrary))]
116#[derive(Clone, Copy, PartialEq, Eq, Zeroize, IntoPrimitive, TryFromPrimitive, Debug)]
117#[repr(u16)]
118pub enum SigningKeyVersion {
119    Latest = 0,
121    V1 = 1,
123}
124
125impl Default for SigningKeyVersion {
126    fn default() -> Self {
127        Self::Latest
128    }
129}
130
131#[cfg_attr(feature = "wbindgen", wasm_bindgen())]
133#[cfg_attr(feature = "fuzz", derive(Arbitrary))]
134#[derive(Clone, Copy, PartialEq, Eq, Zeroize, IntoPrimitive, TryFromPrimitive, Debug)]
135#[repr(u16)]
136pub enum SecretSharingVersion {
137    Latest = 0,
139    V1 = 1,
141}
142
143impl Default for SecretSharingVersion {
144    fn default() -> Self {
145        Self::Latest
146    }
147}
148
149#[cfg_attr(feature = "wbindgen", wasm_bindgen())]
151#[cfg_attr(feature = "fuzz", derive(Arbitrary))]
152#[derive(Clone, Copy, PartialEq, Eq, Zeroize, IntoPrimitive, TryFromPrimitive, Debug)]
153#[repr(u16)]
154pub enum SignatureVersion {
155    Latest = 0,
157    V1 = 1,
159}
160
161impl Default for SignatureVersion {
162    fn default() -> Self {
163        Self::Latest
164    }
165}
166
167#[derive(Clone, Copy, PartialEq, Eq, Zeroize, IntoPrimitive, TryFromPrimitive, Debug)]
168#[cfg_attr(feature = "fuzz", derive(Arbitrary))]
169#[repr(u16)]
170pub enum CiphertextSubtype {
171    None = 0,
172    Symmetric = 1,
173    Asymmetric = 2,
174}
175
176impl Default for CiphertextSubtype {
177    fn default() -> Self {
178        Self::None
179    }
180}
181
182#[derive(Clone, Copy, PartialEq, Eq, Zeroize, IntoPrimitive, TryFromPrimitive, Debug)]
183#[cfg_attr(feature = "fuzz", derive(Arbitrary))]
184#[repr(u16)]
185pub enum KeySubtype {
186    None = 0,
187    Private = 1,
188    Public = 2,
189    Pair = 3,
190}
191
192impl Default for KeySubtype {
193    fn default() -> Self {
194        Self::None
195    }
196}
197
198#[derive(Clone, Copy, PartialEq, Eq, Zeroize, IntoPrimitive, TryFromPrimitive, Debug)]
199#[cfg_attr(feature = "fuzz", derive(Arbitrary))]
200#[repr(u16)]
201pub enum PasswordHashSubtype {
202    None = 0,
203}
204
205impl Default for PasswordHashSubtype {
206    fn default() -> Self {
207        Self::None
208    }
209}
210
211#[derive(Clone, Copy, PartialEq, Eq, Zeroize, IntoPrimitive, TryFromPrimitive, Debug)]
212#[cfg_attr(feature = "fuzz", derive(Arbitrary))]
213#[repr(u16)]
214pub enum ShareSubtype {
215    None = 0,
216}
217
218impl Default for ShareSubtype {
219    fn default() -> Self {
220        Self::None
221    }
222}
223
224#[derive(Clone, Copy, PartialEq, Eq, Zeroize, IntoPrimitive, TryFromPrimitive, Debug)]
225#[cfg_attr(feature = "fuzz", derive(Arbitrary))]
226#[repr(u16)]
227pub enum SignatureSubtype {
228    None = 0,
229}
230
231impl Default for SignatureSubtype {
232    fn default() -> Self {
233        Self::None
234    }
235}