confium_patterns/escrow/
metadata.rs1use chrono::{DateTime, Utc};
4use serde::{Deserialize, Serialize};
5
6#[derive(Debug, Clone, Serialize, Deserialize)]
8pub struct EscrowMetadata {
9 pub escrowed_at: DateTime<Utc>,
11 pub escrowed_by: String,
13 pub key_id: String,
15 pub key_type: String,
17 pub custodian_count: u32,
19 pub threshold: u32,
21 #[serde(default)]
23 pub description: Option<String>,
24}
25
26impl EscrowMetadata {
27 pub fn new(
29 escrowed_by: impl Into<String>,
30 key_id: impl Into<String>,
31 key_type: impl Into<String>,
32 custodian_count: u32,
33 threshold: u32,
34 ) -> Self {
35 Self {
36 escrowed_at: Utc::now(),
37 escrowed_by: escrowed_by.into(),
38 key_id: key_id.into(),
39 key_type: key_type.into(),
40 custodian_count,
41 threshold,
42 description: None,
43 }
44 }
45}