Skip to main content

Store

Struct Store 

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

The builder for iOS keychain credentials

Implementations§

Source§

impl Store

Source

pub fn new() -> Result<Arc<Self>>

Create a default store, which does not synchronize with the cloud.

Source

pub fn new_with_configuration(config: &HashMap<&str, &str>) -> Result<Arc<Self>>

Create a configured store.

There are two allowed configuration keys:

  • cloud-sync (true or false), default false. Specifying this key as true will sync all items in the store with iCloud.
  • access-group. If non-empty, this store will store all its items in the specified access group. If empty or not specified, as in the default configuration, all items will be stored in the app’s default access group.

Trait Implementations§

Source§

impl CredentialStoreApi for Store

Source§

fn vendor(&self) -> String

See the keychain-core API docs.

Source§

fn id(&self) -> String

See the keychain-core API docs.

Source§

fn build( &self, service: &str, user: &str, modifiers: Option<&HashMap<&str, &str>>, ) -> Result<Entry>

See the keychain-core API docs.

There is only one allowed modifier: access-policy, which can be one of these (case-insensitive) values (ordered least to most restrictive):

  • AfterFirstUnlock (or after-first-unlock)
  • AfterFirstUnlockThisDeviceOnly (or after-first-unlock-this-device-only)
  • WhenUnlocked (or when-unlocked), the default
  • WhenUnlockedThisDeviceOnly (or when-unlocked-this-device-only)
  • WhenPasscodeSetThisDeviceOnly (or when-passcode-set-this-device-only)
  • RequireUserPresence (or require-user-presence)

These correspond to similarly named values of the kSecAttrAccessible attribute, described in the Apple docs, except for RequireUserPresence which is like WhenUnlocked but adds a requirement to do biometric authentication whenever the credential is accessed.

Note: You cannot specify an access policy in a cloud-synchronized store: the OS controls this access to manage synchronization.

Source§

fn search(&self, spec: &HashMap<&str, &str>) -> Result<Vec<Entry>>

See the keychain-core API docs.

The primary spec keys are service, account, and access-group, which restrict the search to items which match (case-sensitive) the given values. Without any restrictions, every generic password item in the store is returned.

There is a show-authentication-ui key (value true or false, default false) which can be used to prevent the default behavior of skipping any items whose access policy requires user interaction.

Because the OS hides the access policy information of existing items, every wrapper returned from a search has a default access policy which may or may not match that of the item it wraps. This default access policy has no effect unless you delete the underlying item and re-create it from the wrapper by setting its password.

Source§

fn as_any(&self) -> &dyn Any

See the keychain-core API docs.

Source§

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

See the keychain-core API docs.

Source§

fn persistence(&self) -> CredentialPersistence

The lifetime of credentials produced by this builder. Read more
Source§

impl Debug for Store

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Store

§

impl RefUnwindSafe for Store

§

impl Send for Store

§

impl Sync for Store

§

impl Unpin for Store

§

impl UnsafeUnpin for Store

§

impl UnwindSafe for Store

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.