objc2_authentication_services/generated/
ASAuthorizationProviderExtensionLoginManager.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/// [Apple's documentation](https://developer.apple.com/documentation/authenticationservices/asauthorizationproviderextensionkeytype?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct ASAuthorizationProviderExtensionKeyType(pub NSInteger);
17impl ASAuthorizationProviderExtensionKeyType {
18    /// The user's device signing key.
19    #[doc(alias = "ASAuthorizationProviderExtensionKeyTypeUserDeviceSigning")]
20    pub const UserDeviceSigning: Self = Self(1);
21    /// The user's device encryption key.
22    #[doc(alias = "ASAuthorizationProviderExtensionKeyTypeUserDeviceEncryption")]
23    pub const UserDeviceEncryption: Self = Self(2);
24    /// The user's Secure Enclave backed key.
25    #[doc(alias = "ASAuthorizationProviderExtensionKeyTypeUserSecureEnclaveKey")]
26    pub const UserSecureEnclaveKey: Self = Self(3);
27    /// The shared device signing key.
28    #[doc(alias = "ASAuthorizationProviderExtensionKeyTypeSharedDeviceSigning")]
29    pub const SharedDeviceSigning: Self = Self(4);
30    /// The shared device encryption key.
31    #[doc(alias = "ASAuthorizationProviderExtensionKeyTypeSharedDeviceEncryption")]
32    pub const SharedDeviceEncryption: Self = Self(5);
33    /// The currentdevice signing key.
34    #[doc(alias = "ASAuthorizationProviderExtensionKeyTypeCurrentDeviceSigning")]
35    pub const CurrentDeviceSigning: Self = Self(10);
36    /// The current device encryption key.
37    #[doc(alias = "ASAuthorizationProviderExtensionKeyTypeCurrentDeviceEncryption")]
38    pub const CurrentDeviceEncryption: Self = Self(11);
39    /// The current device encryption key.
40    #[doc(alias = "ASAuthorizationProviderExtensionKeyTypeUserSmartCard")]
41    pub const UserSmartCard: Self = Self(20);
42}
43
44unsafe impl Encode for ASAuthorizationProviderExtensionKeyType {
45    const ENCODING: Encoding = NSInteger::ENCODING;
46}
47
48unsafe impl RefEncode for ASAuthorizationProviderExtensionKeyType {
49    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
50}
51
52extern_class!(
53    /// [Apple's documentation](https://developer.apple.com/documentation/authenticationservices/asauthorizationproviderextensionloginmanager?language=objc)
54    #[unsafe(super(NSObject))]
55    #[derive(Debug, PartialEq, Eq, Hash)]
56    pub struct ASAuthorizationProviderExtensionLoginManager;
57);
58
59extern_conformance!(
60    unsafe impl NSObjectProtocol for ASAuthorizationProviderExtensionLoginManager {}
61);
62
63impl ASAuthorizationProviderExtensionLoginManager {
64    extern_methods!(
65        #[unsafe(method(init))]
66        #[unsafe(method_family = init)]
67        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
68
69        #[unsafe(method(new))]
70        #[unsafe(method_family = new)]
71        pub unsafe fn new() -> Retained<Self>;
72
73        /// Returns YES if the current device completed registration.
74        #[unsafe(method(isDeviceRegistered))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn isDeviceRegistered(&self) -> bool;
77
78        /// Returns YES if current user completed registration.
79        #[unsafe(method(isUserRegistered))]
80        #[unsafe(method_family = none)]
81        pub unsafe fn isUserRegistered(&self) -> bool;
82
83        /// Returns the device registration token from the MDM profile.
84        #[unsafe(method(registrationToken))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn registrationToken(&self) -> Option<Retained<NSString>>;
87
88        #[cfg(feature = "ASAuthorizationProviderExtensionRegistrationHandler")]
89        /// Returns the authentication method used for the device.
90        #[unsafe(method(authenticationMethod))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn authenticationMethod(
93            &self,
94        ) -> ASAuthorizationProviderExtensionAuthenticationMethod;
95
96        /// Returns the extension data from the MDM profile.
97        #[unsafe(method(extensionData))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn extensionData(&self) -> Retained<NSDictionary>;
100
101        /// The user name to use when authenticating with the identity provider.
102        #[deprecated]
103        #[unsafe(method(loginUserName))]
104        #[unsafe(method_family = none)]
105        pub unsafe fn loginUserName(&self) -> Option<Retained<NSString>>;
106
107        /// Setter for [`loginUserName`][Self::loginUserName].
108        ///
109        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
110        #[deprecated]
111        #[unsafe(method(setLoginUserName:))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn setLoginUserName(&self, login_user_name: Option<&NSString>);
114
115        #[cfg(feature = "ASAuthorizationProviderExtensionUserLoginConfiguration")]
116        /// Retrieves the current user login configuration for the extension.
117        #[unsafe(method(userLoginConfiguration))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn userLoginConfiguration(
120            &self,
121        ) -> Option<Retained<ASAuthorizationProviderExtensionUserLoginConfiguration>>;
122
123        #[cfg(feature = "ASAuthorizationProviderExtensionUserLoginConfiguration")]
124        /// Saves or replaces the user login configration.
125        ///
126        /// Parameter `userLoginConfiguration`: The user login configration to use.
127        ///
128        /// Parameter `error`: The error when there are validation errors or nil.
129        #[unsafe(method(saveUserLoginConfiguration:error:_))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn saveUserLoginConfiguration_error(
132            &self,
133            user_login_configuration: &ASAuthorizationProviderExtensionUserLoginConfiguration,
134        ) -> Result<(), Retained<NSError>>;
135
136        /// Retrieves or sets the current SSO tokens response for the current user and extension.
137        #[unsafe(method(ssoTokens))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn ssoTokens(&self) -> Option<Retained<NSDictionary>>;
140
141        /// Setter for [`ssoTokens`][Self::ssoTokens].
142        ///
143        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
144        ///
145        /// # Safety
146        ///
147        /// `sso_tokens` generic should be of the correct type.
148        #[unsafe(method(setSsoTokens:))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn setSsoTokens(&self, sso_tokens: Option<&NSDictionary>);
151
152        #[cfg(feature = "ASAuthorizationProviderExtensionLoginConfiguration")]
153        /// Retrieves or sets the current login configuration for the extension.
154        #[unsafe(method(loginConfiguration))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn loginConfiguration(
157            &self,
158        ) -> Option<Retained<ASAuthorizationProviderExtensionLoginConfiguration>>;
159
160        #[cfg(feature = "ASAuthorizationProviderExtensionLoginConfiguration")]
161        /// Saves or replaces the login configration.
162        ///
163        /// Parameter `loginConfiguration`: The login configration to use.
164        ///
165        /// Parameter `error`: The error when there are validation errors or nil.
166        #[unsafe(method(saveLoginConfiguration:error:_))]
167        #[unsafe(method_family = none)]
168        pub unsafe fn saveLoginConfiguration_error(
169            &self,
170            login_configuration: &ASAuthorizationProviderExtensionLoginConfiguration,
171        ) -> Result<(), Retained<NSError>>;
172
173        #[cfg(feature = "objc2-security")]
174        /// Saves the provided certificate for the key type.
175        ///
176        /// Parameter `certificate`: The certificate to save.
177        ///
178        /// Parameter `keyType`: The key type for the certificate.
179        #[unsafe(method(saveCertificate:keyType:))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn saveCertificate_keyType(
182            &self,
183            certificate: &SecCertificate,
184            key_type: ASAuthorizationProviderExtensionKeyType,
185        );
186
187        #[cfg(feature = "objc2-security")]
188        /// Retrieves the key for the specified platform SSO key type.
189        ///
190        /// Parameter `keyType`: The key type to retrieve.
191        #[unsafe(method(copyKeyForKeyType:))]
192        #[unsafe(method_family = copy)]
193        pub unsafe fn copyKeyForKeyType(
194            &self,
195            key_type: ASAuthorizationProviderExtensionKeyType,
196        ) -> Option<Retained<SecKey>>;
197
198        #[cfg(feature = "objc2-security")]
199        /// Retrieves the identity for the specified platform SSO key type.
200        ///
201        /// Parameter `keyType`: The key type to retrieve.
202        #[unsafe(method(copyIdentityForKeyType:))]
203        #[unsafe(method_family = copy)]
204        pub unsafe fn copyIdentityForKeyType(
205            &self,
206            key_type: ASAuthorizationProviderExtensionKeyType,
207        ) -> Option<Retained<SecIdentity>>;
208
209        #[cfg(feature = "objc2-security")]
210        /// Generates a new key for the specified platform SSO key type using the strongest supported key strength returning the new key.  Nil is returned if there is an error generating the new key.
211        ///
212        /// Parameter `keyType`: The key type to retrieve.
213        #[unsafe(method(beginKeyRotationForKeyType:))]
214        // required for soundness, method has `returns_retained` attribute.
215        #[unsafe(method_family = copy)]
216        pub unsafe fn beginKeyRotationForKeyType(
217            &self,
218            key_type: ASAuthorizationProviderExtensionKeyType,
219        ) -> Option<Retained<SecKey>>;
220
221        /// Completes rotation for the key to replace the previous key.
222        ///
223        /// Parameter `keyType`: The key type to retrieve.
224        #[unsafe(method(completeKeyRotationForKeyType:))]
225        #[unsafe(method_family = none)]
226        pub unsafe fn completeKeyRotationForKeyType(
227            &self,
228            key_type: ASAuthorizationProviderExtensionKeyType,
229        );
230
231        #[cfg(feature = "block2")]
232        /// Requests AppSSOAgent reauthenticate the current user for the current extension.  This is used when the tokens are revoked, or expired and need to be requested again.
233        #[unsafe(method(userNeedsReauthenticationWithCompletion:))]
234        #[unsafe(method_family = none)]
235        pub unsafe fn userNeedsReauthenticationWithCompletion(
236            &self,
237            completion: &block2::DynBlock<dyn Fn(*mut NSError)>,
238        );
239
240        /// Requests that the device registration be run again to repair it.
241        #[unsafe(method(deviceRegistrationsNeedsRepair))]
242        #[unsafe(method_family = none)]
243        pub unsafe fn deviceRegistrationsNeedsRepair(&self);
244
245        /// Requests that user registration be run again for the current user to repair it.
246        #[unsafe(method(userRegistrationsNeedsRepair))]
247        #[unsafe(method_family = none)]
248        pub unsafe fn userRegistrationsNeedsRepair(&self);
249
250        /// Requests that the decryption keys are repaired.
251        #[unsafe(method(decryptionKeysNeedRepair))]
252        #[unsafe(method_family = none)]
253        pub unsafe fn decryptionKeysNeedRepair(&self);
254
255        /// Creates new Encryption, Signing, and Secure Enclave keys for the user.  The old keys will be destroyed.
256        #[unsafe(method(resetKeys))]
257        #[unsafe(method_family = none)]
258        pub unsafe fn resetKeys(&self);
259
260        /// Creates new Encryption, and Signing keys for the device or user.  The old keys will be destroyed.
261        #[unsafe(method(resetDeviceKeys))]
262        #[unsafe(method_family = none)]
263        pub unsafe fn resetDeviceKeys(&self);
264
265        /// Creates new Encryption, Signing, and Secure Enclave keys for the user.  The old keys will be destroyed.
266        #[unsafe(method(resetUserSecureEnclaveKey))]
267        #[unsafe(method_family = none)]
268        pub unsafe fn resetUserSecureEnclaveKey(&self);
269
270        #[cfg(feature = "block2")]
271        /// Provides a new or cached attestation for the specified key type.
272        ///
273        /// Parameter `keyType`: The key type for the attestation.
274        ///
275        /// Parameter `clientDataHash`: A SHA256 hash of a unique, single-use data block that embeds a challenge from your server.
276        ///
277        /// Parameter `completion`: A closure that the method calls upon completion with the following parameters:
278        /// * attestationCertificates An array of certificates that verify the validity of the key associated with the keyType. Send this to your server for processing.
279        /// * error A DCError instance that indicates the reason for failure, or nil on success.
280        #[unsafe(method(attestKey:clientDataHash:completion:))]
281        #[unsafe(method_family = none)]
282        pub unsafe fn attestKey_clientDataHash_completion(
283            &self,
284            key_type: ASAuthorizationProviderExtensionKeyType,
285            client_data_hash: &NSData,
286            completion: &block2::DynBlock<dyn Fn(*mut NSArray, *mut NSError)>,
287        );
288
289        #[cfg(feature = "block2")]
290        /// Provides a new or cached attestation for the specified pending key type.
291        ///
292        /// Parameter `keyType`: The pending key type for the attestation.
293        ///
294        /// Parameter `clientDataHash`: A SHA256 hash of a unique, single-use data block that embeds a challenge from your server.
295        ///
296        /// Parameter `completion`: A closure that the method calls upon completion with the following parameters:
297        /// * attestationCertificates An array of certificates that verify the validity of the pending key associated with the keyType. Send this to your server for processing.
298        /// * error A DCError instance that indicates the reason for failure, or nil on success.
299        #[unsafe(method(attestPendingKey:clientDataHash:completion:))]
300        #[unsafe(method_family = none)]
301        pub unsafe fn attestPendingKey_clientDataHash_completion(
302            &self,
303            key_type: ASAuthorizationProviderExtensionKeyType,
304            client_data_hash: &NSData,
305            completion: &block2::DynBlock<dyn Fn(*mut NSArray, *mut NSError)>,
306        );
307
308        #[cfg(feature = "block2")]
309        /// Asks authorization service to show extension view controller for registration. If the controller cannot be shown an error is returned.  This is only valid during registration.
310        #[unsafe(method(presentRegistrationViewControllerWithCompletion:))]
311        #[unsafe(method_family = none)]
312        pub unsafe fn presentRegistrationViewControllerWithCompletion(
313            &self,
314            completion: &block2::DynBlock<dyn Fn(*mut NSError)>,
315        );
316    );
317}