pub struct SecureStorage { /* private fields */ }Expand description
Secure credential storage with AES-GCM encryption
Implementations§
Source§impl SecureStorage
impl SecureStorage
Sourcepub fn New(master_key: Vec<u8>, auditor: SecurityAuditor) -> Self
pub fn New(master_key: Vec<u8>, auditor: SecurityAuditor) -> Self
Create a new secure storage with a master key
Sourcepub fn DeriveKeyFromPassword(
password: &str,
salt: Option<&[u8]>,
) -> (Vec<u8>, [u8; 16])
pub fn DeriveKeyFromPassword( password: &str, salt: Option<&[u8]>, ) -> (Vec<u8>, [u8; 16])
Generate a secure master key from password using PBKDF2
Sourcepub async fn Store(&self, key: &str, credential: &str) -> Result<()>
pub async fn Store(&self, key: &str, credential: &str) -> Result<()>
Store a credential encrypted with AES-GCM
Sourcepub async fn Retrieve(&self, key: &str) -> Result<Option<String>>
pub async fn Retrieve(&self, key: &str) -> Result<Option<String>>
Retrieve and decrypt a credential
Sourcepub async fn RotateMasterKey(
&self,
new_master_key: Vec<u8>,
) -> Result<KeyRotationResult>
pub async fn RotateMasterKey( &self, new_master_key: Vec<u8>, ) -> Result<KeyRotationResult>
Rotate the master key and re-encrypt all credentials
Sourcepub async fn CredentialCount(&self) -> usize
pub async fn CredentialCount(&self) -> usize
Get the number of stored credentials
Sourcepub async fn ListCredentials(&self) -> Vec<String>
pub async fn ListCredentials(&self) -> Vec<String>
List all credential keys (without exposing credentials)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SecureStorage
impl !RefUnwindSafe for SecureStorage
impl Send for SecureStorage
impl Sync for SecureStorage
impl Unpin for SecureStorage
impl !UnwindSafe for SecureStorage
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].