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        #[unsafe(method(setConfigurationData:))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn setConfigurationData(&self, configuration_data: Option<&NSData>);
109
110        #[cfg(feature = "TKTokenKeychainItem")]
111        /// All keychain items of this token.
112        #[unsafe(method(keychainItems))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn keychainItems(&self) -> Retained<NSArray<TKTokenKeychainItem>>;
115
116        #[cfg(feature = "TKTokenKeychainItem")]
117        /// Setter for [`keychainItems`][Self::keychainItems].
118        #[unsafe(method(setKeychainItems:))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn setKeychainItems(&self, keychain_items: &NSArray<TKTokenKeychainItem>);
121
122        #[cfg(all(feature = "TKToken", feature = "TKTokenKeychainItem"))]
123        /// Returns keychain item key with specified objectID.  Fills error with TKTokenErrorCodeObjectNotFound if no such key exists.
124        #[unsafe(method(keyForObjectID:error:_))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn keyForObjectID_error(
127            &self,
128            object_id: &TKTokenObjectID,
129        ) -> Result<Retained<TKTokenKeychainKey>, Retained<NSError>>;
130
131        #[cfg(all(feature = "TKToken", feature = "TKTokenKeychainItem"))]
132        /// Returns certificate with specified objectID.  Fills error with TKTokenErrorCodeObjectNotFound if no such certificate exists.
133        #[unsafe(method(certificateForObjectID:error:_))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn certificateForObjectID_error(
136            &self,
137            object_id: &TKTokenObjectID,
138        ) -> Result<Retained<TKTokenKeychainCertificate>, Retained<NSError>>;
139
140        #[unsafe(method(init))]
141        #[unsafe(method_family = init)]
142        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
143
144        #[unsafe(method(new))]
145        #[unsafe(method_family = new)]
146        pub unsafe fn new() -> Retained<Self>;
147    );
148}