pub struct Store { /* private fields */ }Expand description
The builder for iOS keychain credentials
Implementations§
Source§impl Store
impl Store
Sourcepub fn new() -> Result<Arc<Self>>
pub fn new() -> Result<Arc<Self>>
Create a default store, which does not synchronize with the cloud.
Sourcepub fn new_with_configuration(config: &HashMap<&str, &str>) -> Result<Arc<Self>>
pub fn new_with_configuration(config: &HashMap<&str, &str>) -> Result<Arc<Self>>
Create a configured store.
There are two allowed configuration keys:
cloud-sync(trueorfalse), 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
impl CredentialStoreApi for Store
Source§fn build(
&self,
service: &str,
user: &str,
modifiers: Option<&HashMap<&str, &str>>,
) -> Result<Entry>
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(orafter-first-unlock)AfterFirstUnlockThisDeviceOnly(orafter-first-unlock-this-device-only)WhenUnlocked(orwhen-unlocked), the defaultWhenUnlockedThisDeviceOnly(orwhen-unlocked-this-device-only)WhenPasscodeSetThisDeviceOnly(orwhen-passcode-set-this-device-only)RequireUserPresence(orrequire-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>>
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.