apple_security_sys/
keychain_item.rs

1use crate::base::{SecKeychainAttributeList, SecKeychainItemRef};
2use core_foundation_sys::base::{CFTypeID, CFTypeRef, OSStatus};
3use core_foundation_sys::dictionary::CFDictionaryRef;
4use std::os::raw::c_void;
5
6extern "C" {
7
8    /// Returns the unique identifier of the opaque type to which a keychain item object belongs.
9    pub fn SecKeychainItemGetTypeID() -> CFTypeID;
10
11    /// Adds one or more items to a keychain.
12    pub fn SecItemAdd(attributes: CFDictionaryRef, result: *mut CFTypeRef) -> OSStatus;
13
14    /// Returns one or more keychain items that match a search query, or copies attributes of specific keychain items.
15    pub fn SecItemCopyMatching(query: CFDictionaryRef, result: *mut CFTypeRef) -> OSStatus;
16
17    /// Modifies items that match a search query.
18    pub fn SecItemUpdate(query: CFDictionaryRef, attributesToUpdate: CFDictionaryRef) -> OSStatus;
19
20    /// Deletes items that match a search query.
21    pub fn SecItemDelete(query: CFDictionaryRef) -> OSStatus;
22
23    /// # Legacy API
24    pub fn SecKeychainItemModifyAttributesAndData(
25        itemRef: SecKeychainItemRef,
26        attrList: *const SecKeychainAttributeList,
27        length: u32,
28        data: *const c_void,
29    ) -> OSStatus;
30
31    pub fn SecKeychainItemFreeContent(
32        attrList: *mut SecKeychainAttributeList,
33        data: *mut c_void,
34    ) -> OSStatus;
35
36    pub fn SecKeychainItemDelete(itemRef: SecKeychainItemRef) -> OSStatus;
37}