objc2_local_authentication/generated/LAPublicKey.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7#[cfg(feature = "objc2-security")]
8use objc2_security::*;
9
10use crate::*;
11
12extern_class!(
13 /// The public part of an asymmetric key pair
14 ///
15 /// See also [Apple's documentation](https://developer.apple.com/documentation/localauthentication/lapublickey?language=objc)
16 #[unsafe(super(NSObject))]
17 #[derive(Debug, PartialEq, Eq, Hash)]
18 pub struct LAPublicKey;
19);
20
21extern_conformance!(
22 unsafe impl NSObjectProtocol for LAPublicKey {}
23);
24
25impl LAPublicKey {
26 extern_methods!(
27 #[cfg(feature = "block2")]
28 /// Exports public key bytes.
29 ///
30 /// Parameter `handler`: Completion handler with the raw bytes of the public key or an error on failure
31 ///
32 /// # Safety
33 ///
34 /// `handler` block must be sendable.
35 #[unsafe(method(exportBytesWithCompletion:))]
36 #[unsafe(method_family = none)]
37 pub unsafe fn exportBytesWithCompletion(
38 &self,
39 handler: &block2::DynBlock<dyn Fn(*mut NSData, *mut NSError)>,
40 );
41
42 #[cfg(all(feature = "block2", feature = "objc2-security"))]
43 /// Encrypts the given data
44 ///
45 /// Parameter `data`: The data to encrypt.
46 ///
47 /// Parameter `algorithm`: A
48 /// `SecKeyAlgorithm`suitable for encrypting with this key –e.g:
49 /// `kSecKeyAlgorithmECIESEncryptionStandardVariableIVX963SHA256AESGCM`.
50 ///
51 /// Parameter `handler`: Completion handler with the cipher text or an error on failure.
52 ///
53 /// # Safety
54 ///
55 /// `handler` block must be sendable.
56 #[unsafe(method(encryptData:secKeyAlgorithm:completion:))]
57 #[unsafe(method_family = none)]
58 pub unsafe fn encryptData_secKeyAlgorithm_completion(
59 &self,
60 data: &NSData,
61 algorithm: &SecKeyAlgorithm,
62 handler: &block2::DynBlock<dyn Fn(*mut NSData, *mut NSError)>,
63 );
64
65 #[cfg(feature = "objc2-security")]
66 /// Checks if the the provided algorithm can be used for encryption with the key.
67 ///
68 /// Parameter `algorithm`: Cryptographic algorithm
69 ///
70 /// Returns: `YES`in case the key supports the provided algorithm with the specified operation.
71 #[unsafe(method(canEncryptUsingSecKeyAlgorithm:))]
72 #[unsafe(method_family = none)]
73 pub unsafe fn canEncryptUsingSecKeyAlgorithm(&self, algorithm: &SecKeyAlgorithm) -> bool;
74
75 #[cfg(all(feature = "block2", feature = "objc2-security"))]
76 /// Verifies a digital signature for the given data.
77 ///
78 /// Parameter `signedData`: The signed data.
79 ///
80 /// Parameter `signature`: The signature of the given data.
81 ///
82 /// Parameter `algorithm`: One of
83 /// `SecKeyAlgorithm`suitable for verifying signatures with this key –e.g:
84 /// `kSecKeyAlgorithmECDSASignatureMessageX962SHA256`
85 /// Parameter `handler`: Completion handler with the signature of given data or an error on failure.
86 ///
87 /// # Safety
88 ///
89 /// `handler` block must be sendable.
90 #[unsafe(method(verifyData:signature:secKeyAlgorithm:completion:))]
91 #[unsafe(method_family = none)]
92 pub unsafe fn verifyData_signature_secKeyAlgorithm_completion(
93 &self,
94 signed_data: &NSData,
95 signature: &NSData,
96 algorithm: &SecKeyAlgorithm,
97 handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
98 );
99
100 #[cfg(feature = "objc2-security")]
101 /// Checks if the the provided algorithm can be used for verifying signatures with the key.
102 ///
103 /// Parameter `algorithm`: Cryptographic algorithm
104 ///
105 /// Returns: `YES`in case the key supports the provided algorithm with the specified operation.
106 #[unsafe(method(canVerifyUsingSecKeyAlgorithm:))]
107 #[unsafe(method_family = none)]
108 pub unsafe fn canVerifyUsingSecKeyAlgorithm(&self, algorithm: &SecKeyAlgorithm) -> bool;
109
110 /// Clients cannot create
111 /// `LAPublicKey`instances directly. They can only obtain them from a related
112 /// `LAPrivateKey`instance
113 #[unsafe(method(new))]
114 #[unsafe(method_family = new)]
115 pub unsafe fn new() -> Retained<Self>;
116
117 /// Clients cannot create
118 /// `LAPublicKey`instances directly. They can only obtain them from a related
119 /// `LAPrivateKey`instance
120 #[unsafe(method(init))]
121 #[unsafe(method_family = init)]
122 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
123 );
124}