Skip to content

Add examples for security framework #784

@zemse

Description

@zemse

I'm trying to migrate to objc2, coming from kornelski/rust-security-framework.

I was able to use the Objc2's local authentication framework in my codebase and it's working great, thanks!

However in case of security framework, I'm running into some type check errors that I'm not able to make sense of, would be really nice if I can get some pointers.

let query = CFMutableDictionary::new(
    kCFAllocatorDefault,
    1,
    &kCFTypeDictionaryKeyCallBacks,
    &kCFTypeDictionaryValueCallBacks,
)
.unwrap();

// Error on `add`: the trait bound `objc2_core_foundation::opaque::Opaque: objc2_core_foundation::Type` is not satisfied
query.add(kSecClass, kSecClassGenericPassword);
query.add(kSecMatchLimit, kSecMatchLimit);
query.add(kSecReturnData, kCFBooleanTrue);

let mut out: MaybeUninit<*const CFType> = MaybeUninit::uninit(); // Not sure if this is even correct
let result = SecItemCopyMatching(&query, out.as_mut_ptr());

Also would you be open for contributions into the examples of this repo?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-frameworkAffects the framework crates and the translator for themdocumentationImprovements or additions to documentation

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions