|
1 | 1 | pub const VERSION_ID_LEN: usize = 36; |
2 | | -pub const VERSION_0_1_0: &'static str = "9f1e0683-7655-4f73-940a-38fa580b5725"; |
| 2 | +pub const VERSION_0_1: &'static str = "9f1e0683-7655-4f73-940a-38fa580b5725"; |
3 | 3 |
|
4 | | -/// The archive that describes the single file storaing all information. |
5 | | -#[derive(Debug, serde::Serialize, serde::Deserialize)] |
6 | | -pub(crate) struct Archive { |
7 | | - /// Version of this program with which the secret has been generated. |
8 | | - pub version: String, |
9 | | - /// Automatically generated unique ID of this archive. |
10 | | - pub uid: String, |
11 | | - /// The actual share of the secret. |
12 | | - pub share: Share, |
| 4 | +pub mod v1 { |
| 5 | + /// The archive that describes the single file storaing all information. |
| 6 | + #[derive(Debug, serde::Serialize, serde::Deserialize)] |
| 7 | + pub(crate) struct Archive { |
| 8 | + /// Automatically generated unique ID of this archive. |
| 9 | + pub uid: String, |
| 10 | + /// The actual share of the secret. |
| 11 | + pub share: Share, |
13 | 12 |
|
14 | | - /// This shares name. |
15 | | - #[serde(skip_serializing_if = "Option::is_none")] |
16 | | - pub name: Option<String>, |
17 | | - /// Some plain text comment. |
18 | | - #[serde(skip_serializing_if = "Option::is_none")] |
19 | | - pub comment: Option<String>, |
20 | | - /// Some information about the secret. |
21 | | - #[serde(skip_serializing_if = "Option::is_none")] |
22 | | - pub info: Option<SecretInfo>, |
23 | | -} |
| 13 | + /// This shares name. |
| 14 | + #[serde(skip_serializing_if = "Option::is_none")] |
| 15 | + pub name: Option<String>, |
| 16 | + /// Some plain text comment. |
| 17 | + #[serde(skip_serializing_if = "Option::is_none")] |
| 18 | + pub comment: Option<String>, |
| 19 | + /// Some information about the secret. |
| 20 | + #[serde(skip_serializing_if = "Option::is_none")] |
| 21 | + pub info: Option<SecretInfo>, |
| 22 | + } |
24 | 23 |
|
25 | | -// Describing an individual share. |
26 | | -#[derive(Debug, serde::Serialize, serde::Deserialize)] |
27 | | -pub(crate) enum Share { |
28 | | - /// Plain base64 encoded share data. |
29 | | - PlainBase64(String), |
30 | | - /// Symmetrically encrypted, base64 encoded share data. |
31 | | - EncryptedBase64 { hash: Hash, data: String }, |
32 | | -} |
| 24 | + // Describing an individual share. |
| 25 | + #[derive(Debug, serde::Serialize, serde::Deserialize)] |
| 26 | + pub(crate) enum Share { |
| 27 | + /// Plain base64 encoded share data. |
| 28 | + PlainBase64(String), |
| 29 | + /// Symmetrically encrypted, base64 encoded share data. |
| 30 | + EncryptedBase64 { hash: Hash, data: String }, |
| 31 | + } |
33 | 32 |
|
34 | | -/// Describes the hash algorithm and value that is used for password |
35 | | -/// verification. |
36 | | -#[derive(Debug, serde::Serialize, serde::Deserialize)] |
37 | | -pub(crate) enum Hash { |
38 | | - /// Argon2id hash. |
39 | | - Argon2id(String), |
40 | | -} |
| 33 | + /// Describes the hash algorithm and value that is used for password |
| 34 | + /// verification. |
| 35 | + #[derive(Debug, serde::Serialize, serde::Deserialize)] |
| 36 | + pub(crate) enum Hash { |
| 37 | + /// Argon2id hash. |
| 38 | + Argon2id(String), |
| 39 | + } |
41 | 40 |
|
42 | | -/// Describes the secret that has been sharded. Contains information about how |
43 | | -/// to restore. |
44 | | -#[derive(Debug, serde::Serialize, serde::Deserialize)] |
45 | | -pub(crate) struct SecretInfo { |
46 | | - /// The amount of shares that were generated for the secret. |
47 | | - pub num_shares: usize, |
48 | | - /// The amount of shares that are needed for restoring the secret. |
49 | | - pub threshold: usize, |
| 41 | + /// Describes the secret that has been sharded. Contains information about |
| 42 | + /// how to restore. |
| 43 | + #[derive(Debug, serde::Serialize, serde::Deserialize)] |
| 44 | + pub(crate) struct SecretInfo { |
| 45 | + /// The amount of shares that were generated for the secret. |
| 46 | + pub num_shares: usize, |
| 47 | + /// The amount of shares that are needed for restoring the secret. |
| 48 | + pub threshold: usize, |
| 49 | + } |
50 | 50 | } |
0 commit comments