Skip to main content

origin_secrets/
store.rs

1use crate::{Secret, SecretKey};
2use async_trait::async_trait;
3use origin_domain::Result;
4use std::fmt::Debug;
5
6/// Persistent credential storage.
7///
8/// Implementations must be safe to call from multiple tasks at once, and must pass
9/// the shared contract suite in [`crate::contract`].
10#[async_trait]
11pub trait SecretStore: Debug + Send + Sync + 'static {
12    /// `Ok(None)` when no secret is stored under `key` — a missing key is not an error.
13    async fn get(&self, key: &SecretKey) -> Result<Option<Secret>>;
14
15    /// Store `value`, replacing any existing secret under `key`.
16    async fn set(&self, key: &SecretKey, value: Secret) -> Result<()>;
17
18    /// Remove the secret. Deleting a missing key succeeds.
19    async fn delete(&self, key: &SecretKey) -> Result<()>;
20}