Struct security_framework::os::macos::keychain::SecKeychain
source · [−]pub struct SecKeychain(_);
Expand description
A type representing a keychain.
Implementations
sourceimpl 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.
sourceimpl 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
sourceimpl Clone for SecKeychain
impl Clone for SecKeychain
sourcefn clone(&self) -> SecKeychain
fn clone(&self) -> SecKeychain
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Drop for SecKeychain
impl Drop for SecKeychain
sourceimpl PartialEq<SecKeychain> for SecKeychain
impl PartialEq<SecKeychain> for SecKeychain
sourceimpl TCFType for SecKeychain
impl TCFType for SecKeychain
type Ref = *mut OpaqueSecKeychainRef
type Ref = *mut OpaqueSecKeychainRef
The reference type wrapped inside this type.
sourcefn as_concrete_TypeRef(&self) -> SecKeychainRef
fn as_concrete_TypeRef(&self) -> SecKeychainRef
Returns the object as its concrete TypeRef.
sourceunsafe fn wrap_under_get_rule(reference: SecKeychainRef) -> Self
unsafe fn wrap_under_get_rule(reference: SecKeychainRef) -> Self
Returns an instance of the object, wrapping the underlying CFTypeRef
subclass. Use this
when following Core Foundation’s “Get Rule”. The reference count is bumped. Read more
sourcefn as_CFTypeRef(&self) -> CFTypeRef
fn as_CFTypeRef(&self) -> CFTypeRef
Returns the object as a raw CFTypeRef
. The reference count is not adjusted.
sourceunsafe fn wrap_under_create_rule(reference: SecKeychainRef) -> Self
unsafe fn wrap_under_create_rule(reference: SecKeychainRef) -> Self
Returns an instance of the object, wrapping the underlying CFTypeRef
subclass. Use this
when following Core Foundation’s “Create Rule”. The reference count is not bumped. Read more
sourcefn as_CFType(&self) -> CFType
fn as_CFType(&self) -> CFType
Returns the object as a wrapped CFType
. The reference count is incremented by one.
sourcefn into_CFType(self) -> CFType
fn into_CFType(self) -> CFType
Returns the object as a wrapped CFType
. Consumes self and avoids changing the reference
count. Read more
sourcefn retain_count(&self) -> isize
fn retain_count(&self) -> isize
Returns the reference count of the object. It is unwise to do anything other than test whether the return value of this method is greater than zero. Read more
sourcefn instance_of<OtherCFType>(&self) -> bool where
OtherCFType: TCFType,
fn instance_of<OtherCFType>(&self) -> bool where
OtherCFType: TCFType,
Returns true if this value is an instance of another type.
sourceimpl<'a> ToVoid<SecKeychain> for &'a SecKeychain
impl<'a> ToVoid<SecKeychain> for &'a SecKeychain
sourceimpl ToVoid<SecKeychain> for SecKeychain
impl ToVoid<SecKeychain> for SecKeychain
sourceimpl ToVoid<SecKeychain> for SecKeychainRef
impl ToVoid<SecKeychain> for SecKeychainRef
impl ConcreteCFType for SecKeychain
impl Eq for SecKeychain
impl Send for SecKeychain
impl Sync for SecKeychain
Auto Trait Implementations
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more