objc2_crypto_token_kit/generated/
TKToken.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
12/// TKTokenObjectID Unique and persistent identification of objects on the token.
13///
14/// Uniquely and persistently identifies objects (keys and certificates) present on the token.  Type of this identifier must be compatible with plist and its format is defined by the implementation of token extension.
15///
16/// See also [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tktokenobjectid?language=objc)
17pub type TKTokenObjectID = AnyObject;
18
19/// TKTokenInstanceID Unique, persistent identifier of this token in the form of string.
20///
21/// InstanceID is Typically implemented by some kind of serial number of the target hardware, for example SmartCard serial number.
22///
23/// See also [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tktokeninstanceid?language=objc)
24pub type TKTokenInstanceID = NSString;
25
26/// TKTokenDriverClassID ClassID of the token driver.
27///
28/// Identical with
29/// `com.apple.ctk.class-id`token extension attribute. Typically in the RDN form (com.company.id).
30///
31/// See also [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tktokendriverclassid?language=objc)
32pub type TKTokenDriverClassID = NSString;
33
34/// [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tktokenoperation?language=objc)
35// NS_ENUM
36#[repr(transparent)]
37#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
38pub struct TKTokenOperation(pub NSInteger);
39impl TKTokenOperation {
40    #[doc(alias = "TKTokenOperationNone")]
41    pub const None: Self = Self(0);
42    /// Reading of raw data of certificate.
43    #[doc(alias = "TKTokenOperationReadData")]
44    pub const ReadData: Self = Self(1);
45    /// Cryptographic signature using private key.
46    #[doc(alias = "TKTokenOperationSignData")]
47    pub const SignData: Self = Self(2);
48    /// Decrypting data using private key.
49    #[doc(alias = "TKTokenOperationDecryptData")]
50    pub const DecryptData: Self = Self(3);
51    /// Performing Diffie-Hellman style of cryptographic key exchange using private key.
52    #[doc(alias = "TKTokenOperationPerformKeyExchange")]
53    pub const PerformKeyExchange: Self = Self(4);
54}
55
56unsafe impl Encode for TKTokenOperation {
57    const ENCODING: Encoding = NSInteger::ENCODING;
58}
59
60unsafe impl RefEncode for TKTokenOperation {
61    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
62}
63
64/// TKTokenOperationConstraint represents authentication constraint of token object for specific token operation.
65///
66/// Persistently identifies constraint for performing specific operation on specific object.  Value of constraint can be either:
67/// -
68/// `true`: the operation is always allowed without any authentication needed
69/// -
70/// `false`: the operation is never allowed, typically not implemented
71/// - any other plist-compatible value: defined by the token extension implementation.  Such constraint is opaque to the system and is required to stay constant for the given object during the whole token's lifetime.  For example, SmartCard token extension might decide to use string 'PIN' to indicate that the operation is protected by presenting valid PIN to the card first.
72///
73/// See also [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tktokenoperationconstraint?language=objc)
74pub type TKTokenOperationConstraint = AnyObject;
75
76extern_class!(
77    /// TKTokenKeyAlgorithm Encapsulates cryptographic algorithm, possibly with additional associated required algorithms.
78    ///
79    /// An algorithm supported by a key can be usually described by one value of
80    /// `SecKeyAlgorithm`enumeration.  However, some tokens (notably smartcards) require that input data for the operation are in generic format, but that generic format must be formatted according to some more specific algorithm.  An example for this would be token accepting raw data for cryptographic signature but requiring that raw data are formatted according to PKCS1 padding rules.  To express such requirement, TKTokenKeyAlgorithm defines target algorithm (
81    /// `kSecKeyAlgorithmRSASignatureRaw`in our example) and a set of other algorithms which were used (continuing example above,
82    /// `kSecKeyAlgorithmRSASignatureDigestPKCS1v15SHA1`will be reported as supported).
83    ///
84    /// See also [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tktokenkeyalgorithm?language=objc)
85    #[unsafe(super(NSObject))]
86    #[derive(Debug, PartialEq, Eq, Hash)]
87    pub struct TKTokenKeyAlgorithm;
88);
89
90extern_conformance!(
91    unsafe impl NSObjectProtocol for TKTokenKeyAlgorithm {}
92);
93
94impl TKTokenKeyAlgorithm {
95    extern_methods!(
96        #[unsafe(method(init))]
97        #[unsafe(method_family = init)]
98        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
99
100        #[cfg(feature = "objc2-security")]
101        /// Checks if specified algorithm is base operation algorithm.
102        #[unsafe(method(isAlgorithm:))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn isAlgorithm(&self, algorithm: &SecKeyAlgorithm) -> bool;
105
106        #[cfg(feature = "objc2-security")]
107        /// Checks whether specified algorithm is either target algorithm or one of the algorithms through which the operation passed.
108        #[unsafe(method(supportsAlgorithm:))]
109        #[unsafe(method_family = none)]
110        pub unsafe fn supportsAlgorithm(&self, algorithm: &SecKeyAlgorithm) -> bool;
111    );
112}
113
114/// Methods declared on superclass `NSObject`.
115impl TKTokenKeyAlgorithm {
116    extern_methods!(
117        #[unsafe(method(new))]
118        #[unsafe(method_family = new)]
119        pub unsafe fn new() -> Retained<Self>;
120    );
121}
122
123extern_class!(
124    /// TKTokenKeyExchangeParameters Encapsulates parameters needed for performing specific Key Exchange operation types.
125    ///
126    /// See also [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tktokenkeyexchangeparameters?language=objc)
127    #[unsafe(super(NSObject))]
128    #[derive(Debug, PartialEq, Eq, Hash)]
129    pub struct TKTokenKeyExchangeParameters;
130);
131
132extern_conformance!(
133    unsafe impl NSObjectProtocol for TKTokenKeyExchangeParameters {}
134);
135
136impl TKTokenKeyExchangeParameters {
137    extern_methods!(
138        /// Requested output size of key exchange result.  Should be ignored if output size is not configurable for specified key exchange algorithm.
139        #[unsafe(method(requestedSize))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn requestedSize(&self) -> NSInteger;
142
143        /// Additional shared information input, typically used for key derivation (KDF) step of key exchange algorithm.  Should be ignored if shared info is not used for specified key exchange algorithm.
144        #[unsafe(method(sharedInfo))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn sharedInfo(&self) -> Option<Retained<NSData>>;
147    );
148}
149
150/// Methods declared on superclass `NSObject`.
151impl TKTokenKeyExchangeParameters {
152    extern_methods!(
153        #[unsafe(method(init))]
154        #[unsafe(method_family = init)]
155        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
156
157        #[unsafe(method(new))]
158        #[unsafe(method_family = new)]
159        pub unsafe fn new() -> Retained<Self>;
160    );
161}
162
163extern_class!(
164    /// TKTokenSession represents token session which shares authentication status.
165    ///
166    /// Token implementation must inherit its own session implementation from TKTokenSession (or its subclass TKSmartCardTokenSession in case of SmartCard tokens).
167    ///
168    /// TKTokenSession should keep an authentication state of the token.  Authentication status (e.g. entered PIN to unlock SmartCard) should not be shared across borders of single TKTokenSession instance.
169    ///
170    /// TKTokenSession is always instantiated by TKToken when framework detects access to the token from new authentication session.
171    ///
172    /// See also [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tktokensession?language=objc)
173    #[unsafe(super(NSObject))]
174    #[derive(Debug, PartialEq, Eq, Hash)]
175    pub struct TKTokenSession;
176);
177
178extern_conformance!(
179    unsafe impl NSObjectProtocol for TKTokenSession {}
180);
181
182impl TKTokenSession {
183    extern_methods!(
184        /// Parameter `token`: Token instance to which is this session instance bound.
185        #[unsafe(method(initWithToken:))]
186        #[unsafe(method_family = init)]
187        pub unsafe fn initWithToken(this: Allocated<Self>, token: &TKToken) -> Retained<Self>;
188
189        #[unsafe(method(token))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn token(&self) -> Retained<TKToken>;
192
193        #[unsafe(method(delegate))]
194        #[unsafe(method_family = none)]
195        pub unsafe fn delegate(
196            &self,
197        ) -> Option<Retained<ProtocolObject<dyn TKTokenSessionDelegate>>>;
198
199        /// This is a [weak property][objc2::topics::weak_property].
200        /// Setter for [`delegate`][Self::delegate].
201        #[unsafe(method(setDelegate:))]
202        #[unsafe(method_family = none)]
203        pub unsafe fn setDelegate(
204            &self,
205            delegate: Option<&ProtocolObject<dyn TKTokenSessionDelegate>>,
206        );
207
208        #[unsafe(method(init))]
209        #[unsafe(method_family = init)]
210        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
211    );
212}
213
214/// Methods declared on superclass `NSObject`.
215impl TKTokenSession {
216    extern_methods!(
217        #[unsafe(method(new))]
218        #[unsafe(method_family = new)]
219        pub unsafe fn new() -> Retained<Self>;
220    );
221}
222
223extern_protocol!(
224    /// TKTokenSessionDelegate contains operations with token objects provided by token implementors which should be performed in the context of authentication session.
225    ///
226    /// See also [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tktokensessiondelegate?language=objc)
227    pub unsafe trait TKTokenSessionDelegate: NSObjectProtocol {
228        /// Establishes a context for the requested authentication operation.
229        ///
230        /// Parameter `session`: Related TKTokenSession instance.
231        ///
232        /// Parameter `operation`: Identifier of the operation.
233        ///
234        /// Parameter `constraint`: Constraint to be satisfied by this authentication operation.
235        ///
236        /// Parameter `error`: Error details (see TKError.h).
237        ///
238        /// Returns: authOperation Resulting context of the operation, which will be eventually finalized by receiving 'finishWithError:'.  The resulting 'authOperation' can be of any type based on TKTokenAuthOperation. For known types (e.g. TKTokenPasswordAuthOperation) the system will first fill in the context-specific properties (e.g. 'password') before triggering 'finishWithError:'. When no authentication is actually needed (typically because the session is already authenticated for requested constraint), return instance of TKTokenAuthOperation class instead of any specific subclass.
239        #[optional]
240        #[unsafe(method(tokenSession:beginAuthForOperation:constraint:error:_))]
241        #[unsafe(method_family = none)]
242        unsafe fn tokenSession_beginAuthForOperation_constraint_error(
243            &self,
244            session: &TKTokenSession,
245            operation: TKTokenOperation,
246            constraint: &TKTokenOperationConstraint,
247        ) -> Result<Retained<TKTokenAuthOperation>, Retained<NSError>>;
248
249        /// Checks whether specified operation and algorithm is supported on specified key.
250        ///
251        /// Parameter `session`: Related TKTokenSession instance.
252        ///
253        /// Parameter `operation`: Type of cryptographic operation for which the list of supported algorithms should be retrieved.
254        ///
255        /// Parameter `keyObjectID`: Identifier of the private key object.
256        ///
257        /// Parameter `algorithm`: Algorithm with which the oepration should be performed.
258        ///
259        /// Returns: YES if the operation is supported, NO otherwise.
260        #[optional]
261        #[unsafe(method(tokenSession:supportsOperation:usingKey:algorithm:))]
262        #[unsafe(method_family = none)]
263        unsafe fn tokenSession_supportsOperation_usingKey_algorithm(
264            &self,
265            session: &TKTokenSession,
266            operation: TKTokenOperation,
267            key_object_id: &TKTokenObjectID,
268            algorithm: &TKTokenKeyAlgorithm,
269        ) -> bool;
270
271        /// Performs cryptographic signature operation.
272        ///
273        /// Parameter `session`: Related TKTokenSession instance.
274        ///
275        /// Parameter `dataToSign`: Input data for the signature operation.
276        ///
277        /// Parameter `keyObjectID`: Identifier of the private key object.
278        ///
279        /// Parameter `algorithm`: Requested signature algorithm to be used.
280        ///
281        /// Parameter `error`: Error details (see TKError.h).  If authentication is required (by invoking beginAuthForOperation:),
282        /// `TKErrorCodeAuthenticationNeeded`should be used.
283        ///
284        /// Returns: Resulting signature, or nil if an error happened.
285        #[optional]
286        #[unsafe(method(tokenSession:signData:usingKey:algorithm:error:_))]
287        #[unsafe(method_family = none)]
288        unsafe fn tokenSession_signData_usingKey_algorithm_error(
289            &self,
290            session: &TKTokenSession,
291            data_to_sign: &NSData,
292            key_object_id: &TKTokenObjectID,
293            algorithm: &TKTokenKeyAlgorithm,
294        ) -> Result<Retained<NSData>, Retained<NSError>>;
295
296        /// Decrypts ciphertext using private key.
297        ///
298        /// Parameter `session`: Related TKTokenSession instance.
299        ///
300        /// Parameter `ciphertext`: Encrypted data to decrypt.
301        ///
302        /// Parameter `keyObjectID`: Identifier of the private key object.
303        ///
304        /// Parameter `algorithm`: Requested encryption/decryption algorithm to be used.
305        ///
306        /// Parameter `error`: Error details (see TKError.h).  If authentication is required (by invoking beginAuthForOperation:),
307        /// `TKErrorCodeAuthenticationNeeded`should be used.
308        ///
309        /// Returns: Resulting decrypted plaintext, or nil if an error happened.
310        #[optional]
311        #[unsafe(method(tokenSession:decryptData:usingKey:algorithm:error:_))]
312        #[unsafe(method_family = none)]
313        unsafe fn tokenSession_decryptData_usingKey_algorithm_error(
314            &self,
315            session: &TKTokenSession,
316            ciphertext: &NSData,
317            key_object_id: &TKTokenObjectID,
318            algorithm: &TKTokenKeyAlgorithm,
319        ) -> Result<Retained<NSData>, Retained<NSError>>;
320
321        /// Performs Diffie-Hellman style key exchange operation.
322        ///
323        /// Parameter `session`: Related TKTokenSession instance.
324        ///
325        /// Parameter `otherPartyPublicKeyData`: Raw public data of other party public key.
326        ///
327        /// Parameter `objectID`: Identifier of the private key object.
328        ///
329        /// Parameter `algorithm`: Requested key exchange algorithm to be used.
330        ///
331        /// Parameter `parameters`: Additional parameters for key exchange operation.  Chosen algorithm dictates meaning of parameters.
332        ///
333        /// Parameter `error`: Error details (see TKError.h).  If authentication is required (by invoking beginAuthForOperation:),
334        /// `TKErrorCodeAuthenticationNeeded`should be used.
335        ///
336        /// Returns: Result of key exchange operation, or nil if the operation failed.
337        #[optional]
338        #[unsafe(method(tokenSession:performKeyExchangeWithPublicKey:usingKey:algorithm:parameters:error:_))]
339        #[unsafe(method_family = none)]
340        unsafe fn tokenSession_performKeyExchangeWithPublicKey_usingKey_algorithm_parameters_error(
341            &self,
342            session: &TKTokenSession,
343            other_party_public_key_data: &NSData,
344            object_id: &TKTokenObjectID,
345            algorithm: &TKTokenKeyAlgorithm,
346            parameters: &TKTokenKeyExchangeParameters,
347        ) -> Result<Retained<NSData>, Retained<NSError>>;
348    }
349);
350
351extern_class!(
352    /// Class representing single token.  When implementing SmartCard based token, it is recommended to inherit the implementation from TKSmartCardToken.  Token object serves as synchronization point, all operations invoked upon token and all its sessions are serialized.
353    ///
354    /// See also [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tktoken?language=objc)
355    #[unsafe(super(NSObject))]
356    #[derive(Debug, PartialEq, Eq, Hash)]
357    pub struct TKToken;
358);
359
360extern_conformance!(
361    unsafe impl NSObjectProtocol for TKToken {}
362);
363
364impl TKToken {
365    extern_methods!(
366        /// Initializes token instance
367        ///
368        /// Parameter `tokenDriver`: Creating token driver.
369        ///
370        /// Parameter `instanceID`: Unique, persistent identifier of this token.
371        #[unsafe(method(initWithTokenDriver:instanceID:))]
372        #[unsafe(method_family = init)]
373        pub unsafe fn initWithTokenDriver_instanceID(
374            this: Allocated<Self>,
375            token_driver: &TKTokenDriver,
376            instance_id: &TKTokenInstanceID,
377        ) -> Retained<Self>;
378
379        #[unsafe(method(tokenDriver))]
380        #[unsafe(method_family = none)]
381        pub unsafe fn tokenDriver(&self) -> Retained<TKTokenDriver>;
382
383        #[unsafe(method(delegate))]
384        #[unsafe(method_family = none)]
385        pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn TKTokenDelegate>>>;
386
387        /// This is a [weak property][objc2::topics::weak_property].
388        /// Setter for [`delegate`][Self::delegate].
389        #[unsafe(method(setDelegate:))]
390        #[unsafe(method_family = none)]
391        pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn TKTokenDelegate>>);
392
393        #[cfg(feature = "TKTokenConfiguration")]
394        /// Token configuration associated with this token instance.
395        #[unsafe(method(configuration))]
396        #[unsafe(method_family = none)]
397        pub unsafe fn configuration(&self) -> Retained<TKTokenConfiguration>;
398
399        #[cfg(feature = "TKTokenKeychainItem")]
400        /// Keychain contents (certificate and key items) representing this token.
401        #[unsafe(method(keychainContents))]
402        #[unsafe(method_family = none)]
403        pub unsafe fn keychainContents(&self) -> Option<Retained<TKTokenKeychainContents>>;
404
405        #[unsafe(method(init))]
406        #[unsafe(method_family = init)]
407        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
408    );
409}
410
411/// Methods declared on superclass `NSObject`.
412impl TKToken {
413    extern_methods!(
414        #[unsafe(method(new))]
415        #[unsafe(method_family = new)]
416        pub unsafe fn new() -> Retained<Self>;
417    );
418}
419
420extern_protocol!(
421    /// TKTokenDelegate contains operations implementing functionality of token class.
422    ///
423    /// TKTokenDelegate represents protocol which must be implemented by token implementors' class representing token.  Apart from being able to identify itself with its unique identifier, and must be able to establish new TKTokenSession when requested.
424    ///
425    /// See also [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tktokendelegate?language=objc)
426    pub unsafe trait TKTokenDelegate: NSObjectProtocol {
427        /// Create new session instance
428        ///
429        /// All operations with objects on the token are performed inside TKTokenSession which represent authentication context.  This method is called whenever new authentication context is needed (typically when client application wants to perform token operation using keychain object which has associated LocalAuthentication LAContext which was not yet seen by this token instance).
430        ///
431        /// Parameter `token`: Related token instance.
432        #[unsafe(method(token:createSessionWithError:_))]
433        #[unsafe(method_family = none)]
434        unsafe fn token_createSessionWithError(
435            &self,
436            token: &TKToken,
437        ) -> Result<Retained<TKTokenSession>, Retained<NSError>>;
438
439        /// Terminates previously created session, implementation should free all associated resources.
440        ///
441        /// Parameter `token`: Related token instance.
442        #[optional]
443        #[unsafe(method(token:terminateSession:))]
444        #[unsafe(method_family = none)]
445        unsafe fn token_terminateSession(&self, token: &TKToken, session: &TKTokenSession);
446    }
447);
448
449extern_class!(
450    /// Base class for token drivers.  SmartCard token drivers should use TKSmartCardTokenDriver subclass.
451    ///
452    /// See also [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tktokendriver?language=objc)
453    #[unsafe(super(NSObject))]
454    #[derive(Debug, PartialEq, Eq, Hash)]
455    pub struct TKTokenDriver;
456);
457
458extern_conformance!(
459    unsafe impl NSObjectProtocol for TKTokenDriver {}
460);
461
462impl TKTokenDriver {
463    extern_methods!(
464        #[unsafe(method(delegate))]
465        #[unsafe(method_family = none)]
466        pub unsafe fn delegate(
467            &self,
468        ) -> Option<Retained<ProtocolObject<dyn TKTokenDriverDelegate>>>;
469
470        /// This is a [weak property][objc2::topics::weak_property].
471        /// Setter for [`delegate`][Self::delegate].
472        #[unsafe(method(setDelegate:))]
473        #[unsafe(method_family = none)]
474        pub unsafe fn setDelegate(
475            &self,
476            delegate: Option<&ProtocolObject<dyn TKTokenDriverDelegate>>,
477        );
478    );
479}
480
481/// Methods declared on superclass `NSObject`.
482impl TKTokenDriver {
483    extern_methods!(
484        #[unsafe(method(init))]
485        #[unsafe(method_family = init)]
486        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
487
488        #[unsafe(method(new))]
489        #[unsafe(method_family = new)]
490        pub unsafe fn new() -> Retained<Self>;
491    );
492}
493
494extern_protocol!(
495    /// Delegate for customizing token driver operations.  SmartCard tokens should implement TKSmartCardTokenDriverDelegate instead of this base protocol.
496    ///
497    /// See also [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tktokendriverdelegate?language=objc)
498    pub unsafe trait TKTokenDriverDelegate: NSObjectProtocol {
499        #[cfg(feature = "TKTokenConfiguration")]
500        /// Creates new token for specified configuration. SmartCard token drivers should not implement this method.
501        #[optional]
502        #[unsafe(method(tokenDriver:tokenForConfiguration:error:_))]
503        #[unsafe(method_family = none)]
504        unsafe fn tokenDriver_tokenForConfiguration_error(
505            &self,
506            driver: &TKTokenDriver,
507            configuration: &TKTokenConfiguration,
508        ) -> Result<Retained<TKToken>, Retained<NSError>>;
509
510        /// Terminates previously created token, should release all resources associated with it.
511        #[optional]
512        #[unsafe(method(tokenDriver:terminateToken:))]
513        #[unsafe(method_family = none)]
514        unsafe fn tokenDriver_terminateToken(&self, driver: &TKTokenDriver, token: &TKToken);
515    }
516);
517
518extern_class!(
519    /// Context of a pending authentication operation.
520    ///
521    /// See also [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tktokenauthoperation?language=objc)
522    #[unsafe(super(NSObject))]
523    #[derive(Debug, PartialEq, Eq, Hash)]
524    pub struct TKTokenAuthOperation;
525);
526
527extern_conformance!(
528    unsafe impl NSCoding for TKTokenAuthOperation {}
529);
530
531extern_conformance!(
532    unsafe impl NSObjectProtocol for TKTokenAuthOperation {}
533);
534
535extern_conformance!(
536    unsafe impl NSSecureCoding for TKTokenAuthOperation {}
537);
538
539impl TKTokenAuthOperation {
540    extern_methods!(
541        /// Handler triggered by the system in order to let the token finalize the authentication operation.
542        ///
543        /// Parameter `error`: Error details (see TKError.h).
544        ///
545        /// Returns: Finalization status.
546        #[unsafe(method(finishWithError:_))]
547        #[unsafe(method_family = none)]
548        pub unsafe fn finishWithError(&self) -> Result<(), Retained<NSError>>;
549    );
550}
551
552/// Methods declared on superclass `NSObject`.
553impl TKTokenAuthOperation {
554    extern_methods!(
555        #[unsafe(method(init))]
556        #[unsafe(method_family = init)]
557        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
558
559        #[unsafe(method(new))]
560        #[unsafe(method_family = new)]
561        pub unsafe fn new() -> Retained<Self>;
562    );
563}
564
565extern_class!(
566    /// Context of a password authentication operation.
567    ///
568    /// See also [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tktokenpasswordauthoperation?language=objc)
569    #[unsafe(super(TKTokenAuthOperation, NSObject))]
570    #[derive(Debug, PartialEq, Eq, Hash)]
571    pub struct TKTokenPasswordAuthOperation;
572);
573
574extern_conformance!(
575    unsafe impl NSCoding for TKTokenPasswordAuthOperation {}
576);
577
578extern_conformance!(
579    unsafe impl NSObjectProtocol for TKTokenPasswordAuthOperation {}
580);
581
582extern_conformance!(
583    unsafe impl NSSecureCoding for TKTokenPasswordAuthOperation {}
584);
585
586impl TKTokenPasswordAuthOperation {
587    extern_methods!(
588        /// Password, which will be filled in by the system when 'finishWithError:' is called.
589        #[unsafe(method(password))]
590        #[unsafe(method_family = none)]
591        pub unsafe fn password(&self) -> Option<Retained<NSString>>;
592
593        /// Setter for [`password`][Self::password].
594        #[unsafe(method(setPassword:))]
595        #[unsafe(method_family = none)]
596        pub unsafe fn setPassword(&self, password: Option<&NSString>);
597    );
598}
599
600/// Methods declared on superclass `NSObject`.
601impl TKTokenPasswordAuthOperation {
602    extern_methods!(
603        #[unsafe(method(init))]
604        #[unsafe(method_family = init)]
605        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
606
607        #[unsafe(method(new))]
608        #[unsafe(method_family = new)]
609        pub unsafe fn new() -> Retained<Self>;
610    );
611}