Skip to content

Commit

Permalink
Synchronizable polish
Browse files Browse the repository at this point in the history
  • Loading branch information
kornelski committed Jan 7, 2025
1 parent 9b733ff commit 22359c4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
1 change: 1 addition & 0 deletions security-framework/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ default = ["OSX_10_12"]
alpn = []
session-tickets = []
job-bless = []
# Enables `GenerateKeyOptions::set_synchronizable`. Warning: not backwards-compatible!
sync-keychain = ["OSX_10_13"]

OSX_10_12 = ["security-framework-sys/OSX_10_12"]
Expand Down
4 changes: 2 additions & 2 deletions security-framework/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,8 @@ impl ItemSearchOptions {
self
}

// The corresponding value is of type LAContext, and represents a reusable
// local authentication context that should be used for keychain item authentication.
/// The corresponding value is of type LAContext, and represents a reusable
/// local authentication context that should be used for keychain item authentication.
#[inline(always)]
#[cfg(any(feature = "OSX_10_13", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub fn authentication_context(&mut self, authentication_context: *mut std::os::raw::c_void) -> &mut Self {
Expand Down
11 changes: 4 additions & 7 deletions security-framework/src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,12 @@ use core_foundation::error::{CFError, CFErrorRef};
use security_framework_sys::{
item::{kSecAttrKeyTypeRSA, kSecValueRef},
keychain_item::SecItemDelete,
key::SecKeyCopyKeyExchangeResult
};
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
use security_framework_sys::{item::{
kSecAttrIsPermanent, kSecAttrLabel, kSecAttrKeyType,
kSecAttrKeySizeInBits, kSecPrivateKeyAttrs, kSecAttrAccessControl
}};
#[cfg(any(feature = "OSX_10_13", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
use security_framework_sys::item::kSecAttrSynchronizable;
#[cfg(target_os = "macos")]
use security_framework_sys::item::{
kSecAttrKeyType3DES, kSecAttrKeyTypeDSA, kSecAttrKeyTypeAES,
Expand Down Expand Up @@ -322,7 +319,7 @@ impl SecKey {

let mut error: CFErrorRef = std::ptr::null_mut();

let output = SecKeyCopyKeyExchangeResult(
let output = security_framework_sys::key::SecKeyCopyKeyExchangeResult(
self.as_concrete_TypeRef(),
algorithm.into(),
public_key.as_concrete_TypeRef(),
Expand Down Expand Up @@ -384,9 +381,9 @@ pub struct GenerateKeyOptions {
/// Access control
#[deprecated(note = "use set_access_control()")]
pub access_control: Option<SecAccessControl>,
/// kSecAttrSynchronizable
/// `kSecAttrSynchronizable`
#[cfg(feature = "sync-keychain")]
pub synchronizable: Option<bool>,
synchronizable: Option<bool>,
}

#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
Expand Down Expand Up @@ -428,7 +425,7 @@ impl GenerateKeyOptions {
self
}

/// Set `synchronizable`
/// Set `synchronizable` (`kSecAttrSynchronizable`)
#[cfg(feature = "sync-keychain")]
pub fn set_synchronizable(&mut self, synchronizable: bool) -> &mut Self {
self.synchronizable = Some(synchronizable);
Expand Down

0 comments on commit 22359c4

Please sign in to comment.