ockam_vault_core/
secret.rs

1use serde::{Deserialize, Serialize};
2use zeroize::Zeroize;
3
4/// Handle to a cryptographic Secret
5/// Individual Vault implementations should map secret handles
6/// into implementation-specific Secret representations (e.g. binaries, or HSM references)
7/// stored inside Vault (e.g. using HashMap)
8#[derive(Serialize, Deserialize, Clone, PartialEq, Debug, Zeroize)]
9#[zeroize(drop)]
10pub struct Secret {
11    index: usize,
12}
13
14impl Secret {
15    /// Return the index of this secret.
16    pub fn index(&self) -> usize {
17        self.index
18    }
19}
20
21impl Secret {
22    /// Create a new secret at the given index.
23    pub fn new(index: usize) -> Self {
24        Secret { index }
25    }
26}