pub struct Vault {
pub service: String,
/* private fields */
}Expand description
A secure storage abstraction for tokens and keys.
Fields§
§service: StringThe service name used for isolation in the keychain.
Implementations§
Source§impl Vault
impl Vault
Sourcepub fn in_memory(service: &str) -> Self
pub fn in_memory(service: &str) -> Self
Creates a vault backed by a fresh, process-local in-memory store.
Sourcepub fn from_env(service: &str) -> Self
pub fn from_env(service: &str) -> Self
Uses the in-memory backend when MCP_AIRLOCK_USE_MEMORY_VAULT is set,
otherwise the OS keychain.
Sourcepub fn store_token(&self, user_id: &str, token: &str) -> Result<()>
pub fn store_token(&self, user_id: &str, token: &str) -> Result<()>
Stores an access token securely in the vault.
Sourcepub fn get_token(&self, user_id: &str) -> Result<Option<String>>
pub fn get_token(&self, user_id: &str) -> Result<Option<String>>
Retrieves an access token from the vault.
Sourcepub fn delete_token(&self, user_id: &str) -> Result<()>
pub fn delete_token(&self, user_id: &str) -> Result<()>
Deletes an access token from the vault.
Sourcepub fn store_dpop_key(&self, user_id: &str, key_bytes: &[u8]) -> Result<()>
pub fn store_dpop_key(&self, user_id: &str, key_bytes: &[u8]) -> Result<()>
Stores the DPoP private key securely.
Sourcepub fn get_dpop_key(&self, user_id: &str) -> Result<Option<Vec<u8>>>
pub fn get_dpop_key(&self, user_id: &str) -> Result<Option<Vec<u8>>>
Retrieves the DPoP private key from the vault.
Sourcepub fn delete_dpop_key(&self, user_id: &str) -> Result<()>
pub fn delete_dpop_key(&self, user_id: &str) -> Result<()>
Deletes the DPoP private key from the vault.
Sourcepub fn store_refresh_token(&self, user_id: &str, token: &str) -> Result<()>
pub fn store_refresh_token(&self, user_id: &str, token: &str) -> Result<()>
Stores a refresh token securely in the vault.
Sourcepub fn get_refresh_token(&self, user_id: &str) -> Result<Option<String>>
pub fn get_refresh_token(&self, user_id: &str) -> Result<Option<String>>
Retrieves the refresh token from the vault.
Sourcepub fn delete_refresh_token(&self, user_id: &str) -> Result<()>
pub fn delete_refresh_token(&self, user_id: &str) -> Result<()>
Deletes the refresh token from the vault.
Sourcepub fn store_meta(&self, user_id: &str, meta: &CredentialMeta) -> Result<()>
pub fn store_meta(&self, user_id: &str, meta: &CredentialMeta) -> Result<()>
Stores what the current credentials were issued for.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Vault
impl RefUnwindSafe for Vault
impl Send for Vault
impl Sync for Vault
impl Unpin for Vault
impl UnsafeUnpin for Vault
impl UnwindSafe for Vault
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more