Skip to main content

KeyringStore

Struct KeyringStore 

Source
pub struct KeyringStore { /* private fields */ }
Expand description

OS-backed credential storage scoped to one service identifier (bundle id / custom).

Implementations§

Source§

impl KeyringStore

Source

pub fn new(service: impl Into<String>) -> Self

Creates a store handle; no I/O until the first read/write (backend registers lazily).

Source

pub fn service(&self) -> &str

Keyring service / namespace string passed to the native backend.

Source

pub fn set_password(&self, account: &str, password: &str) -> Result<()>

Persists a UTF-8 secret (use Self::set_bytes for arbitrary bytes).

Source

pub fn set_bytes(&self, account: &str, value: &[u8]) -> Result<()>

Encodes value as Base64 and stores it via Self::set_password.

Source

pub fn get_password(&self, account: &str) -> Result<Option<String>>

Returns stored UTF-8, or None if the entry is missing.

Source

pub fn get_bytes(&self, account: &str) -> Result<Option<Vec<u8>>>

Decodes Base64 from Self::get_password; returns None if missing.

Source

pub fn delete(&self, account: &str) -> Result<()>

Deletes the credential if present; missing entries are treated as success.

Source

pub fn exists_nonempty(&self, account: &str) -> Result<bool>

true if a non-empty password exists for account.

Source

pub fn account_raw( &self, snapshot_path: &str, client: &BytesDto, suffix: &str, ) -> String

Stable account id for an unstructured secret key under a snapshot + client namespace.

§Example
use tauri_plugin_keyring_store::{BytesDto, KeyringStore};

let store = KeyringStore::new("com.example.app");
let client = BytesDto::Text("cli".into());
let account = store.account_raw("/data/main", &client, "token");
assert!(account.starts_with("kp:v1:"));
Source

pub fn account_store_key( &self, snapshot_path: &str, client: &BytesDto, store_key: &str, ) -> String

Account key for a JSON store record (store_key is a logical filename).

Source

pub fn account_vault_record( &self, snapshot_path: &str, client: &BytesDto, vault: &BytesDto, record_path: &BytesDto, ) -> String

Account key for binary vault payload at vault / record_path.

Trait Implementations§

Source§

impl Clone for KeyringStore

Source§

fn clone(&self) -> KeyringStore

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for KeyringStore

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> UserEvent for T
where T: Debug + Clone + Send + 'static,