pub struct SecKeychain(/* private fields */);
Expand description
A type representing a keychain.
Implementations§
Source§impl SecKeychain
impl SecKeychain
Sourcepub fn default() -> Result<Self>
pub fn default() -> Result<Self>
Creates a SecKeychain
object corresponding to the user’s default
keychain.
Sourcepub fn default_for_domain(domain: SecPreferencesDomain) -> Result<Self>
pub fn default_for_domain(domain: SecPreferencesDomain) -> Result<Self>
Creates a SecKeychain
object corresponding to the user’s default
keychain for the given domain.
Sourcepub fn unlock(&mut self, password: Option<&str>) -> Result<()>
pub fn unlock(&mut self, password: Option<&str>) -> Result<()>
Unlocks the keychain.
If a password is not specified, the user will be prompted to enter it.
Sourcepub fn set_settings(&mut self, settings: &KeychainSettings) -> Result<()>
pub fn set_settings(&mut self, settings: &KeychainSettings) -> Result<()>
Sets settings of the keychain.
Sourcepub fn disable_user_interaction() -> Result<KeychainUserInteractionLock>
pub fn disable_user_interaction() -> Result<KeychainUserInteractionLock>
Disables the user interface for keychain services functions that automatically display a user interface.
Sourcepub fn user_interaction_allowed() -> Result<bool>
pub fn user_interaction_allowed() -> Result<bool>
Indicates whether keychain services functions that normally display a user interaction are allowed to do so.
Source§impl SecKeychain
impl SecKeychain
Sourcepub fn find_generic_password(
&self,
service: &str,
account: &str,
) -> Result<(SecKeychainItemPassword, SecKeychainItem)>
pub fn find_generic_password( &self, service: &str, account: &str, ) -> Result<(SecKeychainItemPassword, SecKeychainItem)>
Find application password in this keychain
Sourcepub fn find_internet_password(
&self,
server: &str,
security_domain: Option<&str>,
account: &str,
path: &str,
port: Option<u16>,
protocol: SecProtocolType,
authentication_type: SecAuthenticationType,
) -> Result<(SecKeychainItemPassword, SecKeychainItem)>
pub fn find_internet_password( &self, server: &str, security_domain: Option<&str>, account: &str, path: &str, port: Option<u16>, protocol: SecProtocolType, authentication_type: SecAuthenticationType, ) -> Result<(SecKeychainItemPassword, SecKeychainItem)>
Find internet password in this keychain
Sourcepub fn set_internet_password(
&self,
server: &str,
security_domain: Option<&str>,
account: &str,
path: &str,
port: Option<u16>,
protocol: SecProtocolType,
authentication_type: SecAuthenticationType,
password: &[u8],
) -> Result<()>
pub fn set_internet_password( &self, server: &str, security_domain: Option<&str>, account: &str, path: &str, port: Option<u16>, protocol: SecProtocolType, authentication_type: SecAuthenticationType, password: &[u8], ) -> Result<()>
Update existing or add new internet password
Sourcepub fn set_generic_password(
&self,
service: &str,
account: &str,
password: &[u8],
) -> Result<()>
pub fn set_generic_password( &self, service: &str, account: &str, password: &[u8], ) -> Result<()>
Set a generic password.
keychain_opt
is the keychain to use or None to use the default keychain.service
is the associated service name for the password.account
is the associated account name for the password.password
is the password itself.
Sourcepub fn add_generic_password(
&self,
service: &str,
account: &str,
password: &[u8],
) -> Result<()>
pub fn add_generic_password( &self, service: &str, account: &str, password: &[u8], ) -> Result<()>
Add application password to the keychain, without checking if it exists already
See set_generic_password()
Sourcepub fn add_internet_password(
&self,
server: &str,
security_domain: Option<&str>,
account: &str,
path: &str,
port: Option<u16>,
protocol: SecProtocolType,
authentication_type: SecAuthenticationType,
password: &[u8],
) -> Result<()>
pub fn add_internet_password( &self, server: &str, security_domain: Option<&str>, account: &str, path: &str, port: Option<u16>, protocol: SecProtocolType, authentication_type: SecAuthenticationType, password: &[u8], ) -> Result<()>
Add internet password to the keychain, without checking if it exists already
See set_internet_password()
Trait Implementations§
Source§impl Clone for SecKeychain
impl Clone for SecKeychain
Source§fn clone(&self) -> SecKeychain
fn clone(&self) -> SecKeychain
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Drop for SecKeychain
impl Drop for SecKeychain
Source§impl PartialEq for SecKeychain
impl PartialEq for SecKeychain
Source§impl TCFType for SecKeychain
impl TCFType for SecKeychain
Source§type Ref = *mut OpaqueSecKeychainRef
type Ref = *mut OpaqueSecKeychainRef
Source§fn as_concrete_TypeRef(&self) -> SecKeychainRef
fn as_concrete_TypeRef(&self) -> SecKeychainRef
TypeRef
.Source§unsafe fn wrap_under_get_rule(reference: SecKeychainRef) -> Self
unsafe fn wrap_under_get_rule(reference: SecKeychainRef) -> Self
CFTypeRef
subclass. Use this
when following Core Foundation’s “Get Rule”. The reference count is bumped.Source§fn as_CFTypeRef(&self) -> CFTypeRef
fn as_CFTypeRef(&self) -> CFTypeRef
CFTypeRef
. The reference count is not adjusted.Source§unsafe fn wrap_under_create_rule(reference: SecKeychainRef) -> Self
unsafe fn wrap_under_create_rule(reference: SecKeychainRef) -> Self
CFTypeRef
subclass. Use this
when following Core Foundation’s “Create Rule”. The reference count is not bumped.Source§fn as_CFType(&self) -> CFType
fn as_CFType(&self) -> CFType
CFType
. The reference count is incremented by one.Source§fn into_CFType(self) -> CFTypewhere
Self: Sized,
fn into_CFType(self) -> CFTypewhere
Self: Sized,
CFType
. Consumes self and avoids changing the reference
count.Source§fn retain_count(&self) -> isize
fn retain_count(&self) -> isize
Source§fn instance_of<OtherCFType>(&self) -> boolwhere
OtherCFType: TCFType,
fn instance_of<OtherCFType>(&self) -> boolwhere
OtherCFType: TCFType,
true
if this value is an instance of another type.Source§impl<'a> ToVoid<SecKeychain> for &'a SecKeychain
impl<'a> ToVoid<SecKeychain> for &'a SecKeychain
Source§impl ToVoid<SecKeychain> for SecKeychainRef
impl ToVoid<SecKeychain> for SecKeychainRef
Source§impl ToVoid<SecKeychain> for SecKeychain
impl ToVoid<SecKeychain> for SecKeychain
impl ConcreteCFType for SecKeychain
impl Eq for SecKeychain
impl Send for SecKeychain
impl Sync for SecKeychain
Auto Trait Implementations§
impl Freeze for SecKeychain
impl RefUnwindSafe for SecKeychain
impl Unpin for SecKeychain
impl UnwindSafe for SecKeychain
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,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)