Skip to content

Commit 6f83705

Browse files
author
Alexander Weber
committed
archive versioning
1 parent 46bff98 commit 6f83705

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/archive.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub fn split_version_and_data(data: &Vec<u8>) -> Result<(String, &[u8])> {
1313
pub(crate) mod v1 {
1414
/// The archive that describes the single file storaing all information.
1515
#[derive(Debug, serde::Serialize, serde::Deserialize)]
16+
#[serde(rename_all = "snake_case", deny_unknown_fields)]
1617
pub(crate) struct Archive {
1718
/// Automatically generated unique ID of this archive.
1819
pub uid: String,
@@ -32,6 +33,7 @@ pub(crate) mod v1 {
3233

3334
// Describing an individual share.
3435
#[derive(Debug, serde::Serialize, serde::Deserialize)]
36+
#[serde(rename_all = "snake_case", deny_unknown_fields)]
3537
pub(crate) enum Share {
3638
/// Plain base64 encoded share data.
3739
PlainBase64(String),
@@ -42,6 +44,7 @@ pub(crate) mod v1 {
4244
/// Describes the hash algorithm and value that is used for password
4345
/// verification.
4446
#[derive(Debug, serde::Serialize, serde::Deserialize)]
47+
#[serde(rename_all = "snake_case", deny_unknown_fields)]
4548
pub(crate) enum Hash {
4649
/// Argon2id hash.
4750
Argon2id(String),
@@ -50,6 +53,7 @@ pub(crate) mod v1 {
5053
/// Describes the secret that has been sharded. Contains information about
5154
/// how to restore.
5255
#[derive(Debug, serde::Serialize, serde::Deserialize)]
56+
#[serde(rename_all = "snake_case", deny_unknown_fields)]
5357
pub(crate) struct SecretInfo {
5458
/// The amount of shares that were generated for the secret.
5559
pub num_shares: usize,

src/blueprint.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub(crate) struct Blueprint {
1212
}
1313

1414
#[derive(Debug, serde::Deserialize)]
15-
#[serde(rename_all = "snake_case")]
15+
#[serde(rename_all = "snake_case", deny_unknown_fields)]
1616
pub(crate) struct BlueprintShare {
1717
pub path: String,
1818
pub name: Option<String>,
@@ -22,7 +22,7 @@ pub(crate) struct BlueprintShare {
2222
}
2323

2424
#[derive(Debug, serde::Deserialize)]
25-
#[serde(rename_all = "snake_case")]
25+
#[serde(rename_all = "snake_case", deny_unknown_fields)]
2626
pub(crate) enum BlueprintShareEncryption {
2727
Plain(String),
2828
Shell(String),

0 commit comments

Comments
 (0)