Skip to main content

SecretStore

Trait SecretStore 

Source
pub trait SecretStore:
    Debug
    + Send
    + Sync {
    // Required methods
    fn scope(&self) -> SecretScope;
    fn location(&self) -> String;
    fn store(&self, secret: &SecretString) -> Result<(), SecretStoreError>;
    fn load(&self) -> Result<Option<SecretString>, SecretStoreError>;
    fn delete(&self) -> Result<Removal, SecretStoreError>;
    fn protection(&self) -> Result<Protection, SecretStoreError>;
}
Expand description

Store, load, delete — and say where the value lives and what protects it.

Send + Sync because the agent holds one across tokio tasks; Debug because every other port in this workspace is, and because a store that could not be printed in an error context would be replaced by a path that could.

Required Methods§

Source

fn scope(&self) -> SecretScope

Which of the two stores this is.

Source

fn location(&self) -> String

Where the value lives, in the platform’s own terms. What host show and service status print, and never the value itself.

Source

fn store(&self, secret: &SecretString) -> Result<(), SecretStoreError>

Writes the value, replacing whatever was there.

§Errors

SecretStoreError::Store.

Source

fn load(&self) -> Result<Option<SecretString>, SecretStoreError>

Reads the value back, or reports that there is none.

Ok(None) is absence and is not an error; see SecretStoreError.

§Errors

SecretStoreError::Load when the store cannot be reached, and SecretStoreError::Corrupt when what is there is not a value this store wrote.

Source

fn delete(&self) -> Result<Removal, SecretStoreError>

Removes the value.

§Errors

SecretStoreError::Delete.

Source

fn protection(&self) -> Result<Protection, SecretStoreError>

What stands between the stored value and an ordinary local user.

§Errors

SecretStoreError::Inspect.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§