feat: claps

This commit is contained in:
2023-02-09 22:34:50 +08:00
parent 1773a3036c
commit 4baf429574
4 changed files with 87 additions and 2 deletions

36
src/spec.rs Normal file
View File

@@ -0,0 +1,36 @@
use serde::{Deserialize, Serialize};
// File format
// [MAGIC; 4 bytes][VERSION; 1 byte]
// [META_LENGTH; 4 bytes]
// [META; META_LENGTH bytes]
// [ENCRYPTED DATA; n bytes]
pub const EXT: &'static str = "ers";
pub const MAGIC: u16 = 0xECF0;
pub const VERSION_1: u8 = 0x01;
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct MetaBock {
pub meta_random_hex: String,
pub desc: Option<DescBlock>,
pub encrypted_desc: String,
pub keys: Vec<KeyBlock>,
pub iv_nonce_hex: String,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct DescBlock {
pub file_id: Option<String>,
pub author: Option<String>,
pub description: Option<String>,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct KeyBlock {
pub key_id: Option<String>,
pub encrypted_key_hex: String,
pub key_verification_code_hex: String,
pub extended_information: Option<String>,
}