objc2_crypto_token_kit/generated/
TKSmartCard.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
8use crate::*;
9
10extern_class!(
11    /// Represents pool of SmartCard reader slots.
12    ///
13    /// See also [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tksmartcardslotmanager?language=objc)
14    #[unsafe(super(NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    pub struct TKSmartCardSlotManager;
17);
18
19extern_conformance!(
20    unsafe impl NSObjectProtocol for TKSmartCardSlotManager {}
21);
22
23impl TKSmartCardSlotManager {
24    extern_methods!(
25        /// Global pool of SmartCard reader slots.
26        /// macOS: Note that defaultManager instance is accessible only if the calling application has 'com.apple.security.smartcard' entitlement set to Boolean:YES.  If the calling application does not have this entitlement, defaultManager is always set to nil.
27        /// iOS: The defaultManager instance is always accessible.
28        #[unsafe(method(defaultManager))]
29        #[unsafe(method_family = none)]
30        pub unsafe fn defaultManager() -> Option<Retained<TKSmartCardSlotManager>>;
31
32        /// Array of currently known slots in the system.  Slots are identified by NSString name instances.  Use KVO to be notified about slots arrivals and removals.
33        #[unsafe(method(slotNames))]
34        #[unsafe(method_family = none)]
35        pub unsafe fn slotNames(&self) -> Retained<NSArray<NSString>>;
36
37        #[cfg(feature = "block2")]
38        /// Instantiates smartcard reader slot of specified name.  If specified name is not registered, reports nil.
39        #[unsafe(method(getSlotWithName:reply:))]
40        #[unsafe(method_family = none)]
41        pub unsafe fn getSlotWithName_reply(
42            &self,
43            name: &NSString,
44            reply: &block2::DynBlock<dyn Fn(*mut TKSmartCardSlot)>,
45        );
46
47        /// Gets SmartCard reader slot with specified name.  If reader slot with this name does not exist, returns nil.
48        #[unsafe(method(slotNamed:))]
49        #[unsafe(method_family = none)]
50        pub unsafe fn slotNamed(&self, name: &NSString) -> Option<Retained<TKSmartCardSlot>>;
51
52        #[cfg(all(feature = "TKSmartCardSlotNFCSession", feature = "block2"))]
53        /// Creates an NFC smart card slot using the device's hardware and presents a system UI.
54        ///
55        /// Parameter `message`: Message shown in the system-presented UI
56        ///
57        /// Parameter `completion`: Completion handler which returns the NFC session of the created slot or an error on failure.
58        /// If an NFC slot already exists and current caller is not the initial creator `TKErrorCodeObjectNotFound` error is returned.
59        ///
60        ///
61        /// To finish the NFC session and dismiss the system-presented UI use `TKSmartCardSlotNFCSession.endSession`.
62        ///
63        ///
64        /// Warning: Caller requires `com.apple.developer.nfc.readersession.iso7816.select-identifiers` Info.plist record which specifies application identifiers of the NFC cards
65        ///
66        /// ```text
67        ///  https://developer.apple.com/documentation/bundleresources/information-property-list/com.apple.developer.nfc.readersession.iso7816.select-identifiers
68        /// ```
69        ///
70        /// # Safety
71        ///
72        /// `completion` block must be sendable.
73        #[unsafe(method(createNFCSlotWithMessage:completion:))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn createNFCSlotWithMessage_completion(
76            &self,
77            message: Option<&NSString>,
78            completion: &block2::DynBlock<dyn Fn(*mut TKSmartCardSlotNFCSession, *mut NSError)>,
79        );
80
81        /// Determines whether NFC (Near Field Communication) is supported on this device.
82        ///
83        ///
84        /// Returns: `YES` if NFC is supported and available for use, NO otherwise.
85        #[unsafe(method(isNFCSupported))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn isNFCSupported(&self) -> bool;
88    );
89}
90
91/// Methods declared on superclass `NSObject`.
92impl TKSmartCardSlotManager {
93    extern_methods!(
94        #[unsafe(method(init))]
95        #[unsafe(method_family = init)]
96        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
97
98        #[unsafe(method(new))]
99        #[unsafe(method_family = new)]
100        pub unsafe fn new() -> Retained<Self>;
101    );
102}
103
104/// Enumerates all possible slot states.
105///
106/// See also [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tksmartcardslotstate?language=objc)
107// NS_ENUM
108#[repr(transparent)]
109#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
110pub struct TKSmartCardSlotState(pub NSInteger);
111impl TKSmartCardSlotState {
112    /// Slot is no longer known to the system.  This is terminal state for TKSmartCardSlot instance, once reached, the slot instance can never be revived.
113    #[doc(alias = "TKSmartCardSlotStateMissing")]
114    pub const Missing: Self = Self(0);
115    /// The slot is empty, no card is inserted.
116    #[doc(alias = "TKSmartCardSlotStateEmpty")]
117    pub const Empty: Self = Self(1);
118    /// The card was inserted into the slot and an initial probe is in progress.
119    #[doc(alias = "TKSmartCardSlotStateProbing")]
120    pub const Probing: Self = Self(2);
121    /// The card inserted in the slot does not answer.
122    #[doc(alias = "TKSmartCardSlotStateMuteCard")]
123    pub const MuteCard: Self = Self(3);
124    /// Card properly answered to reset.
125    #[doc(alias = "TKSmartCardSlotStateValidCard")]
126    pub const ValidCard: Self = Self(4);
127}
128
129unsafe impl Encode for TKSmartCardSlotState {
130    const ENCODING: Encoding = NSInteger::ENCODING;
131}
132
133unsafe impl RefEncode for TKSmartCardSlotState {
134    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
135}
136
137/// Enumerates all possible PIN character sets.
138///
139/// See also [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tksmartcardpincharset?language=objc)
140// NS_ENUM
141#[repr(transparent)]
142#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
143pub struct TKSmartCardPINCharset(pub NSInteger);
144impl TKSmartCardPINCharset {
145    /// PIN is only composed of digits.
146    #[doc(alias = "TKSmartCardPINCharsetNumeric")]
147    pub const Numeric: Self = Self(0);
148    /// PIN can be composed of digits and letters.
149    #[doc(alias = "TKSmartCardPINCharsetAlphanumeric")]
150    pub const Alphanumeric: Self = Self(1);
151    /// PIN can be composed of digits and uppercase letters.
152    #[doc(alias = "TKSmartCardPINCharsetUpperAlphanumeric")]
153    pub const UpperAlphanumeric: Self = Self(2);
154}
155
156unsafe impl Encode for TKSmartCardPINCharset {
157    const ENCODING: Encoding = NSInteger::ENCODING;
158}
159
160unsafe impl RefEncode for TKSmartCardPINCharset {
161    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
162}
163
164/// Enumerates all possible PIN encoding types.
165///
166/// See also [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tksmartcardpinencoding?language=objc)
167// NS_ENUM
168#[repr(transparent)]
169#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
170pub struct TKSmartCardPINEncoding(pub NSInteger);
171impl TKSmartCardPINEncoding {
172    /// Characters are encoded in Binary format (1234 => 01h 02h 03h 04h).
173    #[doc(alias = "TKSmartCardPINEncodingBinary")]
174    pub const Binary: Self = Self(0);
175    /// Characters are encoded in ASCII format (1234 => 31h 32h 33h 34h).
176    #[doc(alias = "TKSmartCardPINEncodingASCII")]
177    pub const ASCII: Self = Self(1);
178    /// Characters (only digits) are encoded in BCD format (1234 => 12h 34h).
179    #[doc(alias = "TKSmartCardPINEncodingBCD")]
180    pub const BCD: Self = Self(2);
181}
182
183unsafe impl Encode for TKSmartCardPINEncoding {
184    const ENCODING: Encoding = NSInteger::ENCODING;
185}
186
187unsafe impl RefEncode for TKSmartCardPINEncoding {
188    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
189}
190
191/// Enumerates all posible PIN justification types.
192///
193/// See also [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tksmartcardpinjustification?language=objc)
194// NS_ENUM
195#[repr(transparent)]
196#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
197pub struct TKSmartCardPINJustification(pub NSInteger);
198impl TKSmartCardPINJustification {
199    /// Justify to the left.
200    #[doc(alias = "TKSmartCardPINJustificationLeft")]
201    pub const Left: Self = Self(0);
202    /// Justify to the right.
203    #[doc(alias = "TKSmartCardPINJustificationRight")]
204    pub const Right: Self = Self(1);
205}
206
207unsafe impl Encode for TKSmartCardPINJustification {
208    const ENCODING: Encoding = NSInteger::ENCODING;
209}
210
211unsafe impl RefEncode for TKSmartCardPINJustification {
212    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
213}
214
215/// Bitmask specifying condition(s) under which PIN entry should be considered complete.
216///
217/// See also [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tksmartcardpincompletion?language=objc)
218// NS_OPTIONS
219#[repr(transparent)]
220#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
221pub struct TKSmartCardPINCompletion(pub NSUInteger);
222bitflags::bitflags! {
223    impl TKSmartCardPINCompletion: NSUInteger {
224/// Completion by reaching the maximum PIN length.
225        #[doc(alias = "TKSmartCardPINCompletionMaxLength")]
226        const MaxLength = 1<<0;
227/// Completion by pressing the validation key.
228        #[doc(alias = "TKSmartCardPINCompletionKey")]
229        const Key = 1<<1;
230/// Completion by timeout expiration.
231        #[doc(alias = "TKSmartCardPINCompletionTimeout")]
232        const Timeout = 1<<2;
233    }
234}
235
236unsafe impl Encode for TKSmartCardPINCompletion {
237    const ENCODING: Encoding = NSUInteger::ENCODING;
238}
239
240unsafe impl RefEncode for TKSmartCardPINCompletion {
241    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
242}
243
244/// Bitmask specifying whether PIN confirmation should be requested.
245///
246/// See also [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tksmartcardpinconfirmation?language=objc)
247// NS_OPTIONS
248#[repr(transparent)]
249#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
250pub struct TKSmartCardPINConfirmation(pub NSUInteger);
251bitflags::bitflags! {
252    impl TKSmartCardPINConfirmation: NSUInteger {
253/// No confirmation requested.
254        #[doc(alias = "TKSmartCardPINConfirmationNone")]
255        const None = 0;
256/// Confirmation (entry) of the new PIN requested.
257        #[doc(alias = "TKSmartCardPINConfirmationNew")]
258        const New = 1<<0;
259/// Confirmation (entry) of the current PIN requested.
260        #[doc(alias = "TKSmartCardPINConfirmationCurrent")]
261        const Current = 1<<1;
262    }
263}
264
265unsafe impl Encode for TKSmartCardPINConfirmation {
266    const ENCODING: Encoding = NSUInteger::ENCODING;
267}
268
269unsafe impl RefEncode for TKSmartCardPINConfirmation {
270    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
271}
272
273extern_class!(
274    /// Specifies PIN formatting properties.
275    ///
276    /// See also [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tksmartcardpinformat?language=objc)
277    #[unsafe(super(NSObject))]
278    #[derive(Debug, PartialEq, Eq, Hash)]
279    pub struct TKSmartCardPINFormat;
280);
281
282extern_conformance!(
283    unsafe impl NSObjectProtocol for TKSmartCardPINFormat {}
284);
285
286impl TKSmartCardPINFormat {
287    extern_methods!(
288        /// Format of PIN characters.
289        ///
290        /// Note: Default value: TKSmartCardPINCharsetNumeric
291        #[unsafe(method(charset))]
292        #[unsafe(method_family = none)]
293        pub unsafe fn charset(&self) -> TKSmartCardPINCharset;
294
295        /// Setter for [`charset`][Self::charset].
296        #[unsafe(method(setCharset:))]
297        #[unsafe(method_family = none)]
298        pub unsafe fn setCharset(&self, charset: TKSmartCardPINCharset);
299
300        /// Encoding of PIN characters.
301        ///
302        /// Note: Default value: TKSmartCardPINEncodingASCII
303        #[unsafe(method(encoding))]
304        #[unsafe(method_family = none)]
305        pub unsafe fn encoding(&self) -> TKSmartCardPINEncoding;
306
307        /// Setter for [`encoding`][Self::encoding].
308        #[unsafe(method(setEncoding:))]
309        #[unsafe(method_family = none)]
310        pub unsafe fn setEncoding(&self, encoding: TKSmartCardPINEncoding);
311
312        /// Minimum number of characters to form a valid PIN.
313        ///
314        /// Note: Default value: 4
315        #[unsafe(method(minPINLength))]
316        #[unsafe(method_family = none)]
317        pub unsafe fn minPINLength(&self) -> NSInteger;
318
319        /// Setter for [`minPINLength`][Self::minPINLength].
320        #[unsafe(method(setMinPINLength:))]
321        #[unsafe(method_family = none)]
322        pub unsafe fn setMinPINLength(&self, min_pin_length: NSInteger);
323
324        /// Maximum number of characters to form a valid PIN.
325        ///
326        /// Note: Default value: 8
327        #[unsafe(method(maxPINLength))]
328        #[unsafe(method_family = none)]
329        pub unsafe fn maxPINLength(&self) -> NSInteger;
330
331        /// Setter for [`maxPINLength`][Self::maxPINLength].
332        #[unsafe(method(setMaxPINLength:))]
333        #[unsafe(method_family = none)]
334        pub unsafe fn setMaxPINLength(&self, max_pin_length: NSInteger);
335
336        /// Total length of the PIN block in bytes.
337        ///
338        /// Note: Default value: 8
339        #[unsafe(method(PINBlockByteLength))]
340        #[unsafe(method_family = none)]
341        pub unsafe fn PINBlockByteLength(&self) -> NSInteger;
342
343        /// Setter for [`PINBlockByteLength`][Self::PINBlockByteLength].
344        #[unsafe(method(setPINBlockByteLength:))]
345        #[unsafe(method_family = none)]
346        pub unsafe fn setPINBlockByteLength(&self, pin_block_byte_length: NSInteger);
347
348        /// PIN justification within the PIN block.
349        ///
350        /// Note: Default value: TKSmartCardPINJustificationLeft
351        #[unsafe(method(PINJustification))]
352        #[unsafe(method_family = none)]
353        pub unsafe fn PINJustification(&self) -> TKSmartCardPINJustification;
354
355        /// Setter for [`PINJustification`][Self::PINJustification].
356        #[unsafe(method(setPINJustification:))]
357        #[unsafe(method_family = none)]
358        pub unsafe fn setPINJustification(&self, pin_justification: TKSmartCardPINJustification);
359
360        /// Offset in bits within the PIN block to mark a location for filling in the formatted PIN (justified with respect to PINJustification).
361        ///
362        /// Note: Default value: 0
363        ///
364        /// The offset, in bits, within the PIN block to mark a location for filling in the formatted PIN, which is justified with respect to the PINJustification property value.
365        #[unsafe(method(PINBitOffset))]
366        #[unsafe(method_family = none)]
367        pub unsafe fn PINBitOffset(&self) -> NSInteger;
368
369        /// Setter for [`PINBitOffset`][Self::PINBitOffset].
370        #[unsafe(method(setPINBitOffset:))]
371        #[unsafe(method_family = none)]
372        pub unsafe fn setPINBitOffset(&self, pin_bit_offset: NSInteger);
373
374        /// Offset in bits within the PIN block to mark a location for filling in the PIN length (always left justified).
375        ///
376        /// Note: Default value: 0
377        ///
378        /// The offset, in bits, within the PIN block to mark a location for filling in the PIN length, which is always left justified.
379        #[unsafe(method(PINLengthBitOffset))]
380        #[unsafe(method_family = none)]
381        pub unsafe fn PINLengthBitOffset(&self) -> NSInteger;
382
383        /// Setter for [`PINLengthBitOffset`][Self::PINLengthBitOffset].
384        #[unsafe(method(setPINLengthBitOffset:))]
385        #[unsafe(method_family = none)]
386        pub unsafe fn setPINLengthBitOffset(&self, pin_length_bit_offset: NSInteger);
387
388        /// Size in bits of the PIN length field. If set to 0, PIN length is not written.
389        ///
390        /// Note: Default value: 0
391        #[unsafe(method(PINLengthBitSize))]
392        #[unsafe(method_family = none)]
393        pub unsafe fn PINLengthBitSize(&self) -> NSInteger;
394
395        /// Setter for [`PINLengthBitSize`][Self::PINLengthBitSize].
396        #[unsafe(method(setPINLengthBitSize:))]
397        #[unsafe(method_family = none)]
398        pub unsafe fn setPINLengthBitSize(&self, pin_length_bit_size: NSInteger);
399    );
400}
401
402/// Methods declared on superclass `NSObject`.
403impl TKSmartCardPINFormat {
404    extern_methods!(
405        #[unsafe(method(init))]
406        #[unsafe(method_family = init)]
407        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
408
409        #[unsafe(method(new))]
410        #[unsafe(method_family = new)]
411        pub unsafe fn new() -> Retained<Self>;
412    );
413}
414
415extern_protocol!(
416    /// Delegate for user interactions involving the SmartCard reader.
417    ///
418    /// See also [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tksmartcarduserinteractiondelegate?language=objc)
419    pub unsafe trait TKSmartCardUserInteractionDelegate {
420        /// A valid character has been entered.
421        #[optional]
422        #[unsafe(method(characterEnteredInUserInteraction:))]
423        #[unsafe(method_family = none)]
424        unsafe fn characterEnteredInUserInteraction(
425            &self,
426            interaction: &TKSmartCardUserInteraction,
427        );
428
429        /// A correction key has been pressed.
430        #[optional]
431        #[unsafe(method(correctionKeyPressedInUserInteraction:))]
432        #[unsafe(method_family = none)]
433        unsafe fn correctionKeyPressedInUserInteraction(
434            &self,
435            interaction: &TKSmartCardUserInteraction,
436        );
437
438        /// The validation key has been pressed (end of PIN entry).
439        #[optional]
440        #[unsafe(method(validationKeyPressedInUserInteraction:))]
441        #[unsafe(method_family = none)]
442        unsafe fn validationKeyPressedInUserInteraction(
443            &self,
444            interaction: &TKSmartCardUserInteraction,
445        );
446
447        /// An invalid character has been entered.
448        #[optional]
449        #[unsafe(method(invalidCharacterEnteredInUserInteraction:))]
450        #[unsafe(method_family = none)]
451        unsafe fn invalidCharacterEnteredInUserInteraction(
452            &self,
453            interaction: &TKSmartCardUserInteraction,
454        );
455
456        /// Indicates that the old PIN needs to be entered.
457        #[optional]
458        #[unsafe(method(oldPINRequestedInUserInteraction:))]
459        #[unsafe(method_family = none)]
460        unsafe fn oldPINRequestedInUserInteraction(&self, interaction: &TKSmartCardUserInteraction);
461
462        /// Indicates that the new PIN needs to be entered.
463        #[optional]
464        #[unsafe(method(newPINRequestedInUserInteraction:))]
465        #[unsafe(method_family = none)]
466        unsafe fn newPINRequestedInUserInteraction(&self, interaction: &TKSmartCardUserInteraction);
467
468        /// Indicates that the new PIN needs to be confirmed (re-entered).
469        #[optional]
470        #[unsafe(method(newPINConfirmationRequestedInUserInteraction:))]
471        #[unsafe(method_family = none)]
472        unsafe fn newPINConfirmationRequestedInUserInteraction(
473            &self,
474            interaction: &TKSmartCardUserInteraction,
475        );
476    }
477);
478
479extern_class!(
480    /// Represents handle to a user interaction involving the SmartCard reader.
481    ///
482    /// It is a proxy object obtained as a result of invoking the userInteractionFor*** family of methods in TKSmartCardSlot and TKSmartCard.
483    ///
484    /// See also [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tksmartcarduserinteraction?language=objc)
485    #[unsafe(super(NSObject))]
486    #[derive(Debug, PartialEq, Eq, Hash)]
487    pub struct TKSmartCardUserInteraction;
488);
489
490extern_conformance!(
491    unsafe impl NSObjectProtocol for TKSmartCardUserInteraction {}
492);
493
494impl TKSmartCardUserInteraction {
495    extern_methods!(
496        /// Delegate for state observing of the interaction.
497        #[unsafe(method(delegate))]
498        #[unsafe(method_family = none)]
499        pub unsafe fn delegate(
500            &self,
501        ) -> Option<Retained<ProtocolObject<dyn TKSmartCardUserInteractionDelegate>>>;
502
503        /// Setter for [`delegate`][Self::delegate].
504        ///
505        /// This is a [weak property][objc2::topics::weak_property].
506        #[unsafe(method(setDelegate:))]
507        #[unsafe(method_family = none)]
508        pub unsafe fn setDelegate(
509            &self,
510            delegate: Option<&ProtocolObject<dyn TKSmartCardUserInteractionDelegate>>,
511        );
512
513        /// Initial interaction timeout. If set to 0, the reader-defined default timeout is used.
514        ///
515        /// Note: Default value: 0
516        #[unsafe(method(initialTimeout))]
517        #[unsafe(method_family = none)]
518        pub unsafe fn initialTimeout(&self) -> NSTimeInterval;
519
520        /// Setter for [`initialTimeout`][Self::initialTimeout].
521        #[unsafe(method(setInitialTimeout:))]
522        #[unsafe(method_family = none)]
523        pub unsafe fn setInitialTimeout(&self, initial_timeout: NSTimeInterval);
524
525        /// Timeout after the first key stroke. If set to 0, the reader-defined default timeout is used.
526        ///
527        /// Note: Default value: 0
528        #[unsafe(method(interactionTimeout))]
529        #[unsafe(method_family = none)]
530        pub unsafe fn interactionTimeout(&self) -> NSTimeInterval;
531
532        /// Setter for [`interactionTimeout`][Self::interactionTimeout].
533        #[unsafe(method(setInteractionTimeout:))]
534        #[unsafe(method_family = none)]
535        pub unsafe fn setInteractionTimeout(&self, interaction_timeout: NSTimeInterval);
536
537        #[cfg(feature = "block2")]
538        /// Runs the interaction.
539        #[unsafe(method(runWithReply:))]
540        #[unsafe(method_family = none)]
541        pub unsafe fn runWithReply(&self, reply: &block2::DynBlock<dyn Fn(Bool, *mut NSError)>);
542
543        /// Attempts to cancel a running interaction. Note that for some interactions, this functionality might not be available.
544        ///
545        /// Returns: Returns NO if the operation is not running, or cancelling is not supported.
546        #[unsafe(method(cancel))]
547        #[unsafe(method_family = none)]
548        pub unsafe fn cancel(&self) -> bool;
549    );
550}
551
552/// Methods declared on superclass `NSObject`.
553impl TKSmartCardUserInteraction {
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    /// User interaction for the secure PIN operations on the SmartCard reader.
567    ///
568    /// Note: Result is available after the interaction has been successfully completed.
569    ///
570    /// See also [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tksmartcarduserinteractionforpinoperation?language=objc)
571    #[unsafe(super(TKSmartCardUserInteraction, NSObject))]
572    #[derive(Debug, PartialEq, Eq, Hash)]
573    pub struct TKSmartCardUserInteractionForPINOperation;
574);
575
576extern_conformance!(
577    unsafe impl NSObjectProtocol for TKSmartCardUserInteractionForPINOperation {}
578);
579
580impl TKSmartCardUserInteractionForPINOperation {
581    extern_methods!(
582        /// Bitmask specifying condition(s) under which PIN entry should be considered complete.
583        ///
584        /// Note: Default value: TKSmartCardPINCompletionKey
585        #[unsafe(method(PINCompletion))]
586        #[unsafe(method_family = none)]
587        pub unsafe fn PINCompletion(&self) -> TKSmartCardPINCompletion;
588
589        /// Setter for [`PINCompletion`][Self::PINCompletion].
590        #[unsafe(method(setPINCompletion:))]
591        #[unsafe(method_family = none)]
592        pub unsafe fn setPINCompletion(&self, pin_completion: TKSmartCardPINCompletion);
593
594        /// List of message indices referring to a predefined message table. It is used to specify the type and number of messages displayed during the PIN operation.
595        ///
596        /// If nil, the reader does not display any message (reader specific). Typically, PIN verification takes 1 message, PIN modification 1-3 messages.
597        ///
598        /// Note: Default value: nil
599        #[unsafe(method(PINMessageIndices))]
600        #[unsafe(method_family = none)]
601        pub unsafe fn PINMessageIndices(&self) -> Option<Retained<NSArray<NSNumber>>>;
602
603        /// Setter for [`PINMessageIndices`][Self::PINMessageIndices].
604        #[unsafe(method(setPINMessageIndices:))]
605        #[unsafe(method_family = none)]
606        pub unsafe fn setPINMessageIndices(&self, pin_message_indices: Option<&NSArray<NSNumber>>);
607
608        /// Locale defining the language of displayed messages. If set to nil, the user's current locale is used.
609        ///
610        /// Note: Default value: the user's current locale
611        #[unsafe(method(locale))]
612        #[unsafe(method_family = none)]
613        pub unsafe fn locale(&self) -> Option<Retained<NSLocale>>;
614
615        /// Setter for [`locale`][Self::locale].
616        ///
617        /// # Safety
618        ///
619        /// `locale` might not allow `None`.
620        #[unsafe(method(setLocale:))]
621        #[unsafe(method_family = none)]
622        pub unsafe fn setLocale(&self, locale: Option<&NSLocale>);
623
624        /// SW1SW2 result code.
625        #[unsafe(method(resultSW))]
626        #[unsafe(method_family = none)]
627        pub unsafe fn resultSW(&self) -> u16;
628
629        /// Setter for [`resultSW`][Self::resultSW].
630        #[unsafe(method(setResultSW:))]
631        #[unsafe(method_family = none)]
632        pub unsafe fn setResultSW(&self, result_sw: u16);
633
634        /// Optional block of returned data (without SW1SW2 bytes).
635        #[unsafe(method(resultData))]
636        #[unsafe(method_family = none)]
637        pub unsafe fn resultData(&self) -> Option<Retained<NSData>>;
638
639        /// Setter for [`resultData`][Self::resultData].
640        #[unsafe(method(setResultData:))]
641        #[unsafe(method_family = none)]
642        pub unsafe fn setResultData(&self, result_data: Option<&NSData>);
643    );
644}
645
646/// Methods declared on superclass `NSObject`.
647impl TKSmartCardUserInteractionForPINOperation {
648    extern_methods!(
649        #[unsafe(method(init))]
650        #[unsafe(method_family = init)]
651        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
652
653        #[unsafe(method(new))]
654        #[unsafe(method_family = new)]
655        pub unsafe fn new() -> Retained<Self>;
656    );
657}
658
659extern_class!(
660    /// User interaction for the secure PIN verification on the SmartCard reader.
661    ///
662    /// Note: Result is available after the interaction has been successfully completed.
663    ///
664    /// See also [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tksmartcarduserinteractionforsecurepinverification?language=objc)
665    #[unsafe(super(
666        TKSmartCardUserInteractionForPINOperation,
667        TKSmartCardUserInteraction,
668        NSObject
669    ))]
670    #[derive(Debug, PartialEq, Eq, Hash)]
671    pub struct TKSmartCardUserInteractionForSecurePINVerification;
672);
673
674extern_conformance!(
675    unsafe impl NSObjectProtocol for TKSmartCardUserInteractionForSecurePINVerification {}
676);
677
678impl TKSmartCardUserInteractionForSecurePINVerification {
679    extern_methods!();
680}
681
682/// Methods declared on superclass `NSObject`.
683impl TKSmartCardUserInteractionForSecurePINVerification {
684    extern_methods!(
685        #[unsafe(method(init))]
686        #[unsafe(method_family = init)]
687        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
688
689        #[unsafe(method(new))]
690        #[unsafe(method_family = new)]
691        pub unsafe fn new() -> Retained<Self>;
692    );
693}
694
695extern_class!(
696    /// User interaction for the secure PIN change on the SmartCard reader.
697    ///
698    /// Note: Result is available after the interaction has been successfully completed.
699    ///
700    /// See also [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tksmartcarduserinteractionforsecurepinchange?language=objc)
701    #[unsafe(super(
702        TKSmartCardUserInteractionForPINOperation,
703        TKSmartCardUserInteraction,
704        NSObject
705    ))]
706    #[derive(Debug, PartialEq, Eq, Hash)]
707    pub struct TKSmartCardUserInteractionForSecurePINChange;
708);
709
710extern_conformance!(
711    unsafe impl NSObjectProtocol for TKSmartCardUserInteractionForSecurePINChange {}
712);
713
714impl TKSmartCardUserInteractionForSecurePINChange {
715    extern_methods!(
716        /// Bitmask specifying whether PIN confirmation should be requested.
717        ///
718        /// Note: Default value: TKSmartCardPINConfirmationNone
719        #[unsafe(method(PINConfirmation))]
720        #[unsafe(method_family = none)]
721        pub unsafe fn PINConfirmation(&self) -> TKSmartCardPINConfirmation;
722
723        /// Setter for [`PINConfirmation`][Self::PINConfirmation].
724        #[unsafe(method(setPINConfirmation:))]
725        #[unsafe(method_family = none)]
726        pub unsafe fn setPINConfirmation(&self, pin_confirmation: TKSmartCardPINConfirmation);
727    );
728}
729
730/// Methods declared on superclass `NSObject`.
731impl TKSmartCardUserInteractionForSecurePINChange {
732    extern_methods!(
733        #[unsafe(method(init))]
734        #[unsafe(method_family = init)]
735        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
736
737        #[unsafe(method(new))]
738        #[unsafe(method_family = new)]
739        pub unsafe fn new() -> Retained<Self>;
740    );
741}
742
743extern_class!(
744    /// Represents single slot which can contain SmartCard.
745    ///
746    /// See also [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tksmartcardslot?language=objc)
747    #[unsafe(super(NSObject))]
748    #[derive(Debug, PartialEq, Eq, Hash)]
749    pub struct TKSmartCardSlot;
750);
751
752extern_conformance!(
753    unsafe impl NSObjectProtocol for TKSmartCardSlot {}
754);
755
756impl TKSmartCardSlot {
757    extern_methods!(
758        /// Current state of the slot.  Use KVO to be notified about state changes.
759        #[unsafe(method(state))]
760        #[unsafe(method_family = none)]
761        pub unsafe fn state(&self) -> TKSmartCardSlotState;
762
763        #[cfg(feature = "TKSmartCardATR")]
764        /// ATR of the inserted SmartCard, or nil if no or mute SmartCard is inserted.
765        #[unsafe(method(ATR))]
766        #[unsafe(method_family = none)]
767        pub unsafe fn ATR(&self) -> Option<Retained<TKSmartCardATR>>;
768
769        /// Name of the SmartCard reader slot.
770        #[unsafe(method(name))]
771        #[unsafe(method_family = none)]
772        pub unsafe fn name(&self) -> Retained<NSString>;
773
774        /// Maximal length of input APDU that the slot is able to transfer to the card.
775        #[unsafe(method(maxInputLength))]
776        #[unsafe(method_family = none)]
777        pub unsafe fn maxInputLength(&self) -> NSInteger;
778
779        /// Maximal length of output APDU that the slot is able to transfer from the card.
780        #[unsafe(method(maxOutputLength))]
781        #[unsafe(method_family = none)]
782        pub unsafe fn maxOutputLength(&self) -> NSInteger;
783
784        /// Creates new object representing currently inserted and valid card.
785        ///
786        /// It is possible to instantiate multiple objects for single card, exclusivity is handled by sessions on the level of created SmartCard objects.
787        ///
788        /// Returns: Newly created SmartCard object, or nil if slot does not contain valid card.
789        #[unsafe(method(makeSmartCard))]
790        #[unsafe(method_family = none)]
791        pub unsafe fn makeSmartCard(&self) -> Option<Retained<TKSmartCard>>;
792    );
793}
794
795/// Methods declared on superclass `NSObject`.
796impl TKSmartCardSlot {
797    extern_methods!(
798        #[unsafe(method(init))]
799        #[unsafe(method_family = init)]
800        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
801
802        #[unsafe(method(new))]
803        #[unsafe(method_family = new)]
804        pub unsafe fn new() -> Retained<Self>;
805    );
806}
807
808extern_class!(
809    /// Represents SmartCard inserted in the slot. Once the card is physically removed from the slot, the session object is invalid and will always fail the operation invoked on it.  In order to communicate with the card, an exclusive session must be established.
810    ///
811    /// See also [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tksmartcard?language=objc)
812    #[unsafe(super(NSObject))]
813    #[derive(Debug, PartialEq, Eq, Hash)]
814    pub struct TKSmartCard;
815);
816
817extern_conformance!(
818    unsafe impl NSObjectProtocol for TKSmartCard {}
819);
820
821impl TKSmartCard {
822    extern_methods!(
823        /// Slot in which is this card inserted.
824        #[unsafe(method(slot))]
825        #[unsafe(method_family = none)]
826        pub unsafe fn slot(&self) -> Retained<TKSmartCardSlot>;
827
828        /// Flag indicating whether card is valid, i.e. it was not removed from the reader.  Use Key-Value-Observing to be notified about card removal.
829        #[unsafe(method(valid))]
830        #[unsafe(method_family = none)]
831        pub unsafe fn valid(&self) -> bool;
832
833        #[cfg(feature = "TKSmartCardATR")]
834        /// Bitmask containing allowed protocols to be used when communicating with the card.  This property is consulted only during connection to the card, changes are not propagated to already connected session.  By default, any protocol can be used.
835        #[unsafe(method(allowedProtocols))]
836        #[unsafe(method_family = none)]
837        pub unsafe fn allowedProtocols(&self) -> TKSmartCardProtocol;
838
839        #[cfg(feature = "TKSmartCardATR")]
840        /// Setter for [`allowedProtocols`][Self::allowedProtocols].
841        #[unsafe(method(setAllowedProtocols:))]
842        #[unsafe(method_family = none)]
843        pub unsafe fn setAllowedProtocols(&self, allowed_protocols: TKSmartCardProtocol);
844
845        #[cfg(feature = "TKSmartCardATR")]
846        /// Protocol used for communication with the SmartCard.  If no card session is established, TKSmartCardProtocolNone is set.
847        #[unsafe(method(currentProtocol))]
848        #[unsafe(method_family = none)]
849        pub unsafe fn currentProtocol(&self) -> TKSmartCardProtocol;
850
851        /// Flag indicating whether card session should be considered as sensitive.  Sensitive session always gets card after reset before communicating with it and never leaves card without reset to be used by another SmartCard object.  This might be important in case that card session contain some important state which should not leak to another SmartCard object (possibly running in another, foreign application).  Default is NO.
852        #[unsafe(method(sensitive))]
853        #[unsafe(method_family = none)]
854        pub unsafe fn sensitive(&self) -> bool;
855
856        /// Setter for [`sensitive`][Self::sensitive].
857        #[unsafe(method(setSensitive:))]
858        #[unsafe(method_family = none)]
859        pub unsafe fn setSensitive(&self, sensitive: bool);
860
861        /// User-specified context kept as long as the card is powered.  Once the card is removed or another TKSmartCard object opens session, this property is automatically set to nil.
862        #[unsafe(method(context))]
863        #[unsafe(method_family = none)]
864        pub unsafe fn context(&self) -> Option<Retained<AnyObject>>;
865
866        /// Setter for [`context`][Self::context].
867        ///
868        /// # Safety
869        ///
870        /// `context` should be of the correct type.
871        #[unsafe(method(setContext:))]
872        #[unsafe(method_family = none)]
873        pub unsafe fn setContext(&self, context: Option<&AnyObject>);
874
875        #[cfg(feature = "block2")]
876        /// Begins session with the card.
877        ///
878        /// When session exists, other requests for sessions from other card objects to the same card are blocked. Session is reference-counted, the same amount of 'end' calls must be done to really terminate the session. Note that finishing session does not automatically mean that the card is disconnected; it only happens when another session from different card object is requested.
879        ///
880        /// Parameter `success`: Signals whether session was successfully started.
881        ///
882        /// Parameter `error`: More information about error preventing the transaction to start
883        #[unsafe(method(beginSessionWithReply:))]
884        #[unsafe(method_family = none)]
885        pub unsafe fn beginSessionWithReply(
886            &self,
887            reply: &block2::DynBlock<dyn Fn(Bool, *mut NSError)>,
888        );
889
890        #[cfg(feature = "block2")]
891        /// Transmits raw command to the card.  This call is allowed only inside session.
892        ///
893        /// Parameter `request`: Request part of APDU
894        ///
895        /// Parameter `reponse`: Response part of APDU, or nil if communication with the card failed
896        ///
897        /// Parameter `error`: Error details when communication with the card failed
898        #[unsafe(method(transmitRequest:reply:))]
899        #[unsafe(method_family = none)]
900        pub unsafe fn transmitRequest_reply(
901            &self,
902            request: &NSData,
903            reply: &block2::DynBlock<dyn Fn(*mut NSData, *mut NSError)>,
904        );
905
906        /// Terminates the transaction. If no transaction is pending any more, the connection will be closed if there is another session in the system waiting for the transaction.
907        #[unsafe(method(endSession))]
908        #[unsafe(method_family = none)]
909        pub unsafe fn endSession(&self);
910
911        /// Creates a new user interaction object for secure PIN verification using the SmartCard reader facilities (typically a HW keypad).
912        ///
913        /// Note: This interaction is only allowed within a session.
914        ///
915        /// Parameter `PINFormat`: PIN format descriptor.
916        ///
917        /// Parameter `APDU`: Predefined APDU in which the SmartCard reader fills in the PIN.
918        ///
919        /// Parameter `PINByteOffset`: Offset in bytes within APDU data field to mark a location of a PIN block for filling in the entered PIN (currently unused, must be 0).
920        ///
921        /// Returns: A new user interaction object, or nil if this feature is not supported by the SmartCard reader. After the interaction has been successfully completed the operation result is available in the result properites.
922        #[unsafe(method(userInteractionForSecurePINVerificationWithPINFormat:APDU:PINByteOffset:))]
923        #[unsafe(method_family = none)]
924        pub unsafe fn userInteractionForSecurePINVerificationWithPINFormat_APDU_PINByteOffset(
925            &self,
926            pin_format: &TKSmartCardPINFormat,
927            apdu: &NSData,
928            pin_byte_offset: NSInteger,
929        ) -> Option<Retained<TKSmartCardUserInteractionForSecurePINVerification>>;
930
931        /// Creates a new user interaction object for secure PIN change using the SmartCard reader facilities (typically a HW keypad).
932        ///
933        /// Note: This interaction is only allowed within a session.
934        ///
935        /// Parameter `PINFormat`: PIN format descriptor.
936        ///
937        /// Parameter `APDU`: Predefined APDU in which the SmartCard reader fills in the PIN(s).
938        ///
939        /// Parameter `currentPINByteOffset`: Offset in bytes within APDU data field to mark a location of a PIN block for filling in the current PIN.
940        ///
941        /// Parameter `newPINByteOffset`: Offset in bytes within APDU data field to mark a location of a PIN block for filling in the new PIN.
942        ///
943        /// Returns: A new user interaction object, or nil if this feature is not supported by the SmartCard reader. After the interaction has been successfully completed the operation result is available in the result properites.
944        #[unsafe(method(userInteractionForSecurePINChangeWithPINFormat:APDU:currentPINByteOffset:newPINByteOffset:))]
945        #[unsafe(method_family = none)]
946        pub unsafe fn userInteractionForSecurePINChangeWithPINFormat_APDU_currentPINByteOffset_newPINByteOffset(
947            &self,
948            pin_format: &TKSmartCardPINFormat,
949            apdu: &NSData,
950            current_pin_byte_offset: NSInteger,
951            new_pin_byte_offset: NSInteger,
952        ) -> Option<Retained<TKSmartCardUserInteractionForSecurePINChange>>;
953    );
954}
955
956/// Methods declared on superclass `NSObject`.
957impl TKSmartCard {
958    extern_methods!(
959        #[unsafe(method(init))]
960        #[unsafe(method_family = init)]
961        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
962
963        #[unsafe(method(new))]
964        #[unsafe(method_family = new)]
965        pub unsafe fn new() -> Retained<Self>;
966    );
967}
968
969/// APDULevelTransmit.
970///
971/// Extension of base TKSmartCard interface implementing ISO7816-3 and ISO7816-4 structured APDU transmission.
972impl TKSmartCard {
973    extern_methods!(
974        /// CLA byte which will be used for sendIns: APDU transmits.  Default value is 0x00.
975        #[unsafe(method(cla))]
976        #[unsafe(method_family = none)]
977        pub unsafe fn cla(&self) -> u8;
978
979        /// Setter for [`cla`][Self::cla].
980        #[unsafe(method(setCla:))]
981        #[unsafe(method_family = none)]
982        pub unsafe fn setCla(&self, cla: u8);
983
984        /// Flag indicating whether extended length APDUs should be used. It is automatically enabled only when used slot supports transmitting extended length commands and card announces that extended length APDU are supported in its ATR. However, caller can explicitly override this decision.
985        #[unsafe(method(useExtendedLength))]
986        #[unsafe(method_family = none)]
987        pub unsafe fn useExtendedLength(&self) -> bool;
988
989        /// Setter for [`useExtendedLength`][Self::useExtendedLength].
990        #[unsafe(method(setUseExtendedLength:))]
991        #[unsafe(method_family = none)]
992        pub unsafe fn setUseExtendedLength(&self, use_extended_length: bool);
993
994        /// Flag indicating whether command chaining of APDU with data field longer than 255 bytes can be used.  It is automatically enabled when card announces that command chaining is supported in its ATR.  However, caller can explicitly override this decision.
995        #[unsafe(method(useCommandChaining))]
996        #[unsafe(method_family = none)]
997        pub unsafe fn useCommandChaining(&self) -> bool;
998
999        /// Setter for [`useCommandChaining`][Self::useCommandChaining].
1000        #[unsafe(method(setUseCommandChaining:))]
1001        #[unsafe(method_family = none)]
1002        pub unsafe fn setUseCommandChaining(&self, use_command_chaining: bool);
1003
1004        #[cfg(feature = "block2")]
1005        /// Transmits APDU to the card and returns response.
1006        ///
1007        /// Asynchronous high level variant of command for transmitting APDU to the card.  Handles all ISO7816-4 APDU cases translation to proper sequences according to used protocol.  Consults useExtendedAPDU and useCommandChaining properties and uses these modes whenever appropriate and beneficial for sending requested APDU request.
1008        ///
1009        /// Parameter `ins`: INS code of the APDU
1010        ///
1011        /// Parameter `p1`: P1 code of the APDU
1012        ///
1013        /// Parameter `p2`: P2 code of the APDU
1014        ///
1015        /// Parameter `requestData`: Data field of the APDU, or nil if no input data field should be present (i.e case1 or case2 APDUs).  Length of the data serves as Lc field of the APDU.
1016        ///
1017        /// Parameter `le`: Expected number of bytes to be returned, or nil if no output data are expected (i.e. case1 or case3 APDUs). To get as much bytes as card provides, pass
1018        /// @
1019        /// 0.
1020        ///
1021        /// Parameter `replyData`: Block of returned data without SW1SW2 bytes, or nil if an error occured.
1022        ///
1023        /// Parameter `sw`: SW1SW2 result code, first two bytes of returned card's reply.
1024        ///
1025        /// Parameter `error`: Contains error details when nil is returned.  Specific error is also filled in if there was no communication error, but card returned other SW code than 0x9000.
1026        #[unsafe(method(sendIns:p1:p2:data:le:reply:))]
1027        #[unsafe(method_family = none)]
1028        pub unsafe fn sendIns_p1_p2_data_le_reply(
1029            &self,
1030            ins: u8,
1031            p1: u8,
1032            p2: u8,
1033            request_data: Option<&NSData>,
1034            le: Option<&NSNumber>,
1035            reply: &block2::DynBlock<dyn Fn(*mut NSData, u16, *mut NSError)>,
1036        );
1037
1038        #[cfg(feature = "block2")]
1039        /// Synchronous variant of session creation.  Begins the session, executes given block and ends session.
1040        ///
1041        /// Parameter `error`: Error receiving more information when transaction failed to start or block failed for some reason.
1042        ///
1043        /// Parameter `block`: Block to be executed when the session was successfully begun.
1044        ///
1045        /// Returns: Returns YES if the session was successfully begun and block returned YES, otherwise NO.
1046        #[unsafe(method(inSessionWithError:executeBlock:))]
1047        #[unsafe(method_family = none)]
1048        pub unsafe fn inSessionWithError_executeBlock(
1049            &self,
1050            error: Option<&mut Option<Retained<NSError>>>,
1051            block: &block2::DynBlock<dyn Fn(*mut *mut NSError) -> Bool>,
1052        ) -> bool;
1053
1054        /// Transmits APDU to the card and returns response.
1055        ///
1056        /// Synchronous high level variant of command for transmitting APDU to the card.  Handles all ISO7816-4 APDU cases translation to proper sequences according to used protocol.  Should be used in block passed to -[TKSmartCard inSessionWithError:executeBlock:] method.
1057        ///
1058        /// Parameter `ins`: INS code of the APDU
1059        ///
1060        /// Parameter `p1`: P1 code of the APDU
1061        ///
1062        /// Parameter `p2`: P2 code of the APDU
1063        ///
1064        /// Parameter `data`: Data field of the APDU.  Length of the data serves as Lc field of the APDU
1065        ///
1066        /// Parameter `le`: Expected number of bytes to be returned, or nil if no output data are expected (i.e. case1 or case3 APDUs). To get as much bytes as card provides, pass
1067        /// @
1068        /// 0.
1069        ///
1070        /// Parameter `sw`: On output, filled with SW1SW2 result code
1071        ///
1072        /// Parameter `error`: Contains error details when nil is returned.  Specific error is also filled in if there was no communication error, but card returned other SW code than 0x9000.
1073        ///
1074        /// Returns: Returned data field, excluding SW status bytes.  If an error occured, returns nil.
1075        ///
1076        /// # Safety
1077        ///
1078        /// `sw` must be a valid pointer.
1079        #[unsafe(method(sendIns:p1:p2:data:le:sw:error:_))]
1080        #[unsafe(method_family = none)]
1081        pub unsafe fn sendIns_p1_p2_data_le_sw_error(
1082            &self,
1083            ins: u8,
1084            p1: u8,
1085            p2: u8,
1086            request_data: Option<&NSData>,
1087            le: Option<&NSNumber>,
1088            sw: NonNull<u16>,
1089        ) -> Result<Retained<NSData>, Retained<NSError>>;
1090    );
1091}