ockam_vault_core/
secret_vault.rs

1use crate::secret::Secret;
2use crate::types::{PublicKey, SecretAttributes, SecretKey};
3use ockam_core::Result;
4use ockam_core::{async_trait, compat::boxed::Box};
5
6/// [`Secret`]-management functionality
7#[async_trait]
8pub trait SecretVault {
9    /// Generate fresh secret with given attributes
10    async fn secret_generate(&mut self, attributes: SecretAttributes) -> Result<Secret>;
11    /// Import a secret with given attributes from binary form into the vault
12    async fn secret_import(
13        &mut self,
14        secret: &[u8],
15        attributes: SecretAttributes,
16    ) -> Result<Secret>;
17    /// Export a secret key to the binary form represented as [`SecretKey`]
18    async fn secret_export(&mut self, context: &Secret) -> Result<SecretKey>;
19    /// Get the attributes for a secret
20    async fn secret_attributes_get(&mut self, context: &Secret) -> Result<SecretAttributes>;
21    /// Return the associated public key given the secret key
22    async fn secret_public_key_get(&mut self, context: &Secret) -> Result<PublicKey>;
23    /// Remove a secret from the vault
24    async fn secret_destroy(&mut self, context: Secret) -> Result<()>;
25}