Struct security_framework::os::macos::keychain::SecKeychain
source · 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§fn eq(&self, other: &SecKeychain) -> bool
fn eq(&self, other: &SecKeychain) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl TCFType for SecKeychain
impl TCFType for SecKeychain
§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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)