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§
Sourcefn scope(&self) -> SecretScope
fn scope(&self) -> SecretScope
Which of the two stores this is.
Sourcefn location(&self) -> String
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.
Sourcefn store(&self, secret: &SecretString) -> Result<(), SecretStoreError>
fn store(&self, secret: &SecretString) -> Result<(), SecretStoreError>
Sourcefn load(&self) -> Result<Option<SecretString>, SecretStoreError>
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.
Sourcefn delete(&self) -> Result<Removal, SecretStoreError>
fn delete(&self) -> Result<Removal, SecretStoreError>
Sourcefn protection(&self) -> Result<Protection, SecretStoreError>
fn protection(&self) -> Result<Protection, SecretStoreError>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".