grafos_securestore/
epoch.rs

1//! Epoch identifier and metadata types.
2
3use grafos_locator::locator::MemRegionLocator;
4use serde::{Deserialize, Serialize};
5
6/// Unique identifier for a key epoch.
7#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
8pub struct EpochId(pub u64);
9
10/// Lifecycle status of a key epoch.
11#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
12pub enum EpochStatus {
13    /// This epoch's key is the current encryption key.
14    Active,
15    /// A newer epoch is active; this epoch's key is still available for
16    /// decryption but will not be used for new encryptions.
17    Rotating,
18    /// This epoch's key has been destroyed. Decryption is no longer possible.
19    Expired,
20}
21
22/// Metadata for a single key epoch.
23#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
24pub struct EpochInfo {
25    pub epoch_id: EpochId,
26    pub created_at: u64,
27    pub expires_at: u64,
28    pub key_locator: MemRegionLocator,
29    pub status: EpochStatus,
30}