51 lines
1.4 KiB
Rust
51 lines
1.4 KiB
Rust
//! Data models for the vault crate
|
|
|
|
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
|
pub struct VaultMetadata {
|
|
pub name: String,
|
|
pub keyspaces: Vec<KeyspaceMetadata>,
|
|
// ... other vault-level metadata
|
|
}
|
|
|
|
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
|
pub struct KeyspaceMetadata {
|
|
pub name: String,
|
|
pub salt: [u8; 16], // Unique salt for this keyspace
|
|
pub kdf: String, // e.g. "scrypt" or "pbkdf2"
|
|
pub cipher: String, // e.g. "chacha20poly1305" or "aes-gcm"
|
|
pub encrypted_blob: Vec<u8>,
|
|
pub created_at: Option<u64>, // Unix timestamp
|
|
pub tags: Option<Vec<String>>,
|
|
// ... other keyspace metadata
|
|
}
|
|
|
|
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
|
pub struct KeyspaceData {
|
|
pub keypairs: Vec<KeyEntry>,
|
|
// ... other keyspace-level metadata
|
|
}
|
|
|
|
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
|
pub struct KeyEntry {
|
|
pub id: String,
|
|
pub key_type: KeyType,
|
|
pub private_key: Vec<u8>, // Only present in memory after decryption
|
|
pub public_key: Vec<u8>,
|
|
pub metadata: Option<KeyMetadata>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
|
pub enum KeyType {
|
|
Secp256k1,
|
|
Ed25519,
|
|
// ...
|
|
}
|
|
|
|
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
|
pub struct KeyMetadata {
|
|
pub name: Option<String>,
|
|
pub created_at: Option<u64>,
|
|
pub tags: Option<Vec<String>>,
|
|
// ...
|
|
}
|