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 #[unsafe(method(exportBytesWithCompletion:))]
32 #[unsafe(method_family = none)]
33 pub unsafe fn exportBytesWithCompletion(
34 &self,
35 handler: &block2::DynBlock<dyn Fn(*mut NSData, *mut NSError)>,
36 );
37
38 #[cfg(all(feature = "block2", feature = "objc2-security"))]
39 /// Encrypts the given data
40 ///
41 /// Parameter `data`: The data to encrypt.
42 ///
43 /// Parameter `algorithm`: A
44 /// `SecKeyAlgorithm`suitable for encrypting with this key –e.g:
45 /// `kSecKeyAlgorithmECIESEncryptionStandardVariableIVX963SHA256AESGCM`.
46 ///
47 /// Parameter `handler`: Completion handler with the ciphertext or an error on failure.
48 #[unsafe(method(encryptData:secKeyAlgorithm:completion:))]
49 #[unsafe(method_family = none)]
50 pub unsafe fn encryptData_secKeyAlgorithm_completion(
51 &self,
52 data: &NSData,
53 algorithm: &SecKeyAlgorithm,
54 handler: &block2::DynBlock<dyn Fn(*mut NSData, *mut NSError)>,
55 );
56
57 #[cfg(feature = "objc2-security")]
58 /// Checks if the the provided algorithm can be used for encryption with the key.
59 ///
60 /// Parameter `algorithm`: Cryptographic algorithm
61 ///
62 /// Returns: `YES`in case the key supports the provided algorithm with the specified operation.
63 #[unsafe(method(canEncryptUsingSecKeyAlgorithm:))]
64 #[unsafe(method_family = none)]
65 pub unsafe fn canEncryptUsingSecKeyAlgorithm(&self, algorithm: &SecKeyAlgorithm) -> bool;
66
67 #[cfg(all(feature = "block2", feature = "objc2-security"))]
68 /// Verifies a digital signature for the given data.
69 ///
70 /// Parameter `signedData`: The signed data.
71 ///
72 /// Parameter `signature`: The signature of the given data.
73 ///
74 /// Parameter `algorithm`: One of
75 /// `SecKeyAlgorithm`suitable for verifying signatures with this key –e.g:
76 /// `kSecKeyAlgorithmECDSASignatureMessageX962SHA256`
77 /// Parameter `handler`: Completion hadnler with the signature of given data or an error on failure.
78 #[unsafe(method(verifyData:signature:secKeyAlgorithm:completion:))]
79 #[unsafe(method_family = none)]
80 pub unsafe fn verifyData_signature_secKeyAlgorithm_completion(
81 &self,
82 signed_data: &NSData,
83 signature: &NSData,
84 algorithm: &SecKeyAlgorithm,
85 handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
86 );
87
88 #[cfg(feature = "objc2-security")]
89 /// Checks if the the provided algorithm can be used for verifying signatures with the key.
90 ///
91 /// Parameter `algorithm`: Cryptographic algorithm
92 ///
93 /// Returns: `YES`in case the key supports the provided algorithm with the specified operation.
94 #[unsafe(method(canVerifyUsingSecKeyAlgorithm:))]
95 #[unsafe(method_family = none)]
96 pub unsafe fn canVerifyUsingSecKeyAlgorithm(&self, algorithm: &SecKeyAlgorithm) -> bool;
97
98 /// Clients cannot create
99 /// `LAPublicKey`instances directly. They can only obtain them from a related
100 /// `LAPrivateKey`instance
101 #[unsafe(method(new))]
102 #[unsafe(method_family = new)]
103 pub unsafe fn new() -> Retained<Self>;
104
105 /// Clients cannot create
106 /// `LAPublicKey`instances directly. They can only obtain them from a related
107 /// `LAPrivateKey`instance
108 #[unsafe(method(init))]
109 #[unsafe(method_family = init)]
110 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
111 );
112}