objc2_crypto_token_kit/generated/
TKTokenConfiguration.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    /// Holds configuration of one class of tokens
12    ///
13    /// See also [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tktokendriverconfiguration?language=objc)
14    #[unsafe(super(NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    pub struct TKTokenDriverConfiguration;
17);
18
19extern_conformance!(
20    unsafe impl NSObjectProtocol for TKTokenDriverConfiguration {}
21);
22
23impl TKTokenDriverConfiguration {
24    extern_methods!(
25        #[cfg(feature = "TKToken")]
26        /// Contains dictionary of token class configurations keyed by TKTokenDriverClassID of token driver.
27        ///
28        /// Hosting application of token extension will contain the list of configurations for hosted token extensions. All other callers will get an empty array. This means that only token's hosting application can actually modify token's configuration. Typically, hosting application will contain only one token extension, therefore this dictionary will have one element.
29        #[unsafe(method(driverConfigurations))]
30        #[unsafe(method_family = none)]
31        pub unsafe fn driverConfigurations(
32        ) -> Retained<NSDictionary<TKTokenDriverClassID, TKTokenDriverConfiguration>>;
33
34        #[cfg(feature = "TKToken")]
35        /// ClassID of the token configuration. ClassID is taken from
36        /// `com.apple.ctk.class-id`token extension attribute.
37        #[unsafe(method(classID))]
38        #[unsafe(method_family = none)]
39        pub unsafe fn classID(&self) -> Retained<TKTokenDriverClassID>;
40
41        #[cfg(feature = "TKToken")]
42        /// Dictionary of all currently configured tokens for this token class, keyed by instanceID.
43        #[unsafe(method(tokenConfigurations))]
44        #[unsafe(method_family = none)]
45        pub unsafe fn tokenConfigurations(
46            &self,
47        ) -> Retained<NSDictionary<TKTokenInstanceID, TKTokenConfiguration>>;
48
49        #[cfg(feature = "TKToken")]
50        /// Creates new configuration object for token with specified instanceID and adds it into tokenConfigurations dictionary. If configuration with specified instanceID already exists, it is replaced with new empty configuration.
51        #[unsafe(method(addTokenConfigurationForTokenInstanceID:))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn addTokenConfigurationForTokenInstanceID(
54            &self,
55            instance_id: &TKTokenInstanceID,
56        ) -> Retained<TKTokenConfiguration>;
57
58        #[cfg(feature = "TKToken")]
59        /// Removes configuration with specified tokenID. Does nothing if no such token configuration exists.
60        #[unsafe(method(removeTokenConfigurationForTokenInstanceID:))]
61        #[unsafe(method_family = none)]
62        pub unsafe fn removeTokenConfigurationForTokenInstanceID(
63            &self,
64            instance_id: &TKTokenInstanceID,
65        );
66
67        #[unsafe(method(init))]
68        #[unsafe(method_family = init)]
69        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
70
71        #[unsafe(method(new))]
72        #[unsafe(method_family = new)]
73        pub unsafe fn new() -> Retained<Self>;
74    );
75}
76
77extern_class!(
78    /// Holds configuration of one token identified by unique token's instanceID
79    ///
80    /// See also [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tktokenconfiguration?language=objc)
81    #[unsafe(super(NSObject))]
82    #[derive(Debug, PartialEq, Eq, Hash)]
83    pub struct TKTokenConfiguration;
84);
85
86extern_conformance!(
87    unsafe impl NSObjectProtocol for TKTokenConfiguration {}
88);
89
90impl TKTokenConfiguration {
91    extern_methods!(
92        #[cfg(feature = "TKToken")]
93        /// Unique, persistent identifier of this token, always created by specific token implementation. Typically implemented by some kind of serial number of the target hardware, for example SmartCard serial number.
94        #[unsafe(method(instanceID))]
95        #[unsafe(method_family = none)]
96        pub unsafe fn instanceID(&self) -> Retained<TKTokenInstanceID>;
97
98        /// Additional configuration available for token instance.
99        ///
100        /// Token implementation and its hosting application can use this data for specifying any additional configuration for the token. System does not interpret this data in any way. For example, network-based HSM can store here (using Codable or other serialization mechanisms) target network address, access credentials and the list of identities accessible in the HSM.
101        #[unsafe(method(configurationData))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn configurationData(&self) -> Option<Retained<NSData>>;
104
105        /// Setter for [`configurationData`][Self::configurationData].
106        ///
107        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
108        #[unsafe(method(setConfigurationData:))]
109        #[unsafe(method_family = none)]
110        pub unsafe fn setConfigurationData(&self, configuration_data: Option<&NSData>);
111
112        #[cfg(feature = "TKTokenKeychainItem")]
113        /// All keychain items of this token.
114        #[unsafe(method(keychainItems))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn keychainItems(&self) -> Retained<NSArray<TKTokenKeychainItem>>;
117
118        #[cfg(feature = "TKTokenKeychainItem")]
119        /// Setter for [`keychainItems`][Self::keychainItems].
120        ///
121        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
122        #[unsafe(method(setKeychainItems:))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn setKeychainItems(&self, keychain_items: &NSArray<TKTokenKeychainItem>);
125
126        #[cfg(all(feature = "TKToken", feature = "TKTokenKeychainItem"))]
127        /// Returns keychain item key with specified objectID.  Fills error with TKTokenErrorCodeObjectNotFound if no such key exists.
128        ///
129        /// # Safety
130        ///
131        /// `object_id` should be of the correct type.
132        #[unsafe(method(keyForObjectID:error:_))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn keyForObjectID_error(
135            &self,
136            object_id: &TKTokenObjectID,
137        ) -> Result<Retained<TKTokenKeychainKey>, Retained<NSError>>;
138
139        #[cfg(all(feature = "TKToken", feature = "TKTokenKeychainItem"))]
140        /// Returns certificate with specified objectID.  Fills error with TKTokenErrorCodeObjectNotFound if no such certificate exists.
141        ///
142        /// # Safety
143        ///
144        /// `object_id` should be of the correct type.
145        #[unsafe(method(certificateForObjectID:error:_))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn certificateForObjectID_error(
148            &self,
149            object_id: &TKTokenObjectID,
150        ) -> Result<Retained<TKTokenKeychainCertificate>, Retained<NSError>>;
151
152        #[unsafe(method(init))]
153        #[unsafe(method_family = init)]
154        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
155
156        #[unsafe(method(new))]
157        #[unsafe(method_family = new)]
158        pub unsafe fn new() -> Retained<Self>;
159    );
160}