apple_security_framework_sys/
keychain_item.rs

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