pub trait SecretProvider:
Environment
+ Send
+ Sync {
// Required methods
fn GetSecret<'life0, 'async_trait>(
&'life0 self,
ExtensionIdentifier: String,
Key: String,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, CommonError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn StoreSecret<'life0, 'async_trait>(
&'life0 self,
ExtensionIdentifier: String,
Key: String,
Value: String,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn DeleteSecret<'life0, 'async_trait>(
&'life0 self,
ExtensionIdentifier: String,
Key: String,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
An abstract service contract for an environment component that handles the secure storage and retrieval of sensitive information like API tokens.
This trait is implemented by MountainEnvironment and typically uses a
library like keyring to interact with the native operating system’s
credential manager. Secrets are namespaced by an ExtensionIdentifier to
ensure that one extension cannot access the secrets of another.
Required Methods§
Sourcefn GetSecret<'life0, 'async_trait>(
&'life0 self,
ExtensionIdentifier: String,
Key: String,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, CommonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn GetSecret<'life0, 'async_trait>(
&'life0 self,
ExtensionIdentifier: String,
Key: String,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, CommonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Retrieves a secret for a given extension and key.
§Parameters
ExtensionIdentifier: The ID of the extension that owns the secret.Key: The key identifying the secret.
§Returns
A Result containing an Option<String>. It resolves to
Ok(Some(Value)) if the secret is found, Ok(None) if not found, or
an Err on failure.
Sourcefn StoreSecret<'life0, 'async_trait>(
&'life0 self,
ExtensionIdentifier: String,
Key: String,
Value: String,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn StoreSecret<'life0, 'async_trait>(
&'life0 self,
ExtensionIdentifier: String,
Key: String,
Value: String,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Stores a secret for a given extension and key.
§Parameters
ExtensionIdentifier: The ID of the extension that owns the secret.Key: The key to store the secret under.Value: The secret value to be stored.
Sourcefn DeleteSecret<'life0, 'async_trait>(
&'life0 self,
ExtensionIdentifier: String,
Key: String,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn DeleteSecret<'life0, 'async_trait>(
&'life0 self,
ExtensionIdentifier: String,
Key: String,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Deletes a secret for a given extension and key.
§Parameters
ExtensionIdentifier: The ID of the extension that owns the secret.Key: The key of the secret to delete.