Struct SecretStore
pub struct SecretStore { /* private fields */ }Expand description
One app’s secrets.
Implementations§
§impl SecretStore
impl SecretStore
pub fn for_app(app_id: &str) -> SecretStore
pub fn for_app(app_id: &str) -> SecretStore
The app app_id’s secrets in this target’s secret store, or in the
thread’s scope_thread store, or in the process’s own after
keep_in_memory_for_process.
pub fn memory(app_id: &str) -> SecretStore
pub fn memory(app_id: &str) -> SecretStore
Secrets kept in this process, for tests. Each call is a fresh store.
pub fn with_backend(
app_id: &str,
backend: Arc<dyn SecretBackend>,
) -> SecretStore
pub fn with_backend( app_id: &str, backend: Arc<dyn SecretBackend>, ) -> SecretStore
The app app_id’s secrets in a host’s own store.
pub fn app_id(&self) -> &str
pub fn protection(&self) -> Protection
pub async fn put(
&self,
key: &str,
value: &[u8],
options: PutOptions,
) -> Result<(), SecretError>
pub async fn put( &self, key: &str, value: &[u8], options: PutOptions, ) -> Result<(), SecretError>
Store value under key, replacing any earlier secret.
§Errors
The store is unavailable, refused, or the key is malformed.
pub async fn delete(&self, key: &str) -> Result<(), SecretError>
pub async fn delete(&self, key: &str) -> Result<(), SecretError>
Delete the secret under key. Deleting a missing key succeeds.
§Errors
The store is unavailable, refused, or the key is malformed.
pub fn get_blocking(&self, key: &str) -> Result<Option<Secret>, SecretError>
pub fn get_blocking(&self, key: &str) -> Result<Option<Secret>, SecretError>
get, blocking the calling thread. Desktop code only.
§Errors
As get, and Feature::Blocking unsupported on the web.
pub fn put_blocking(
&self,
key: &str,
value: &[u8],
options: PutOptions,
) -> Result<(), SecretError>
pub fn put_blocking( &self, key: &str, value: &[u8], options: PutOptions, ) -> Result<(), SecretError>
put, blocking the calling thread. Desktop code only.
§Errors
As put, and Feature::Blocking unsupported on the web.
pub fn delete_blocking(&self, key: &str) -> Result<(), SecretError>
pub fn delete_blocking(&self, key: &str) -> Result<(), SecretError>
delete, blocking the calling thread. Desktop code
only.
§Errors
As delete, and Feature::Blocking unsupported on the web.
pub fn probe_blocking(&self) -> Result<(), SecretError>
pub fn probe_blocking(&self) -> Result<(), SecretError>
Whether the store answers on this session, blocking the calling thread. The web store always answers.
§Errors
Why it does not.
§impl SecretStore
impl SecretStore
pub fn item(&self, purpose: &'static str, item: &str) -> ItemSecret
pub fn item(&self, purpose: &'static str, item: &str) -> ItemSecret
The secret one item of a document needs for purpose: a database
profile’s password, a connection’s SSH passphrase, an account’s
one-time-password seed. The document names the item by its id and
never holds the secret; the secret stays in this store on this
device.
purpose is one of the app’s own fixed names and contains no /;
item is the item’s id in the document.
Trait Implementations§
§impl Clone for SecretStore
impl Clone for SecretStore
§fn clone(&self) -> SecretStore
fn clone(&self) -> SecretStore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for SecretStore
impl !RefUnwindSafe for SecretStore
impl Send for SecretStore
impl Sync for SecretStore
impl Unpin for SecretStore
impl UnsafeUnpin for SecretStore
impl !UnwindSafe for SecretStore
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§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>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more