feat: claps
This commit is contained in:
36
src/spec.rs
Normal file
36
src/spec.rs
Normal 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>,
|
||||
}
|
||||
Reference in New Issue
Block a user