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        /// Returns the extension data from the MDM profile.
89        #[unsafe(method(extensionData))]
90        #[unsafe(method_family = none)]
91        pub unsafe fn extensionData(&self) -> Retained<NSDictionary>;
92
93        /// The user name to use when authenticating with the identity provider.
94        #[deprecated]
95        #[unsafe(method(loginUserName))]
96        #[unsafe(method_family = none)]
97        pub unsafe fn loginUserName(&self) -> Option<Retained<NSString>>;
98
99        /// Setter for [`loginUserName`][Self::loginUserName].
100        #[deprecated]
101        #[unsafe(method(setLoginUserName:))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn setLoginUserName(&self, login_user_name: Option<&NSString>);
104
105        #[cfg(feature = "ASAuthorizationProviderExtensionUserLoginConfiguration")]
106        /// Retrieves the current user login configuration for the extension.
107        #[unsafe(method(userLoginConfiguration))]
108        #[unsafe(method_family = none)]
109        pub unsafe fn userLoginConfiguration(
110            &self,
111        ) -> Option<Retained<ASAuthorizationProviderExtensionUserLoginConfiguration>>;
112
113        #[cfg(feature = "ASAuthorizationProviderExtensionUserLoginConfiguration")]
114        /// Saves or replaces the user login configration.
115        ///
116        /// Parameter `userLoginConfiguration`: The user login configration to use.
117        ///
118        /// Parameter `error`: The error when there are validation errors or nil.
119        #[unsafe(method(saveUserLoginConfiguration:error:_))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn saveUserLoginConfiguration_error(
122            &self,
123            user_login_configuration: &ASAuthorizationProviderExtensionUserLoginConfiguration,
124        ) -> Result<(), Retained<NSError>>;
125
126        /// Retrieves or sets the current SSO tokens response for the current user and extension.
127        #[unsafe(method(ssoTokens))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn ssoTokens(&self) -> Option<Retained<NSDictionary>>;
130
131        /// Setter for [`ssoTokens`][Self::ssoTokens].
132        #[unsafe(method(setSsoTokens:))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn setSsoTokens(&self, sso_tokens: Option<&NSDictionary>);
135
136        #[cfg(feature = "ASAuthorizationProviderExtensionLoginConfiguration")]
137        /// Retrieves or sets the current login configuration for the extension.
138        #[unsafe(method(loginConfiguration))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn loginConfiguration(
141            &self,
142        ) -> Option<Retained<ASAuthorizationProviderExtensionLoginConfiguration>>;
143
144        #[cfg(feature = "ASAuthorizationProviderExtensionLoginConfiguration")]
145        /// Saves or replaces the login configration.
146        ///
147        /// Parameter `loginConfiguration`: The login configration to use.
148        ///
149        /// Parameter `error`: The error when there are validation errors or nil.
150        #[unsafe(method(saveLoginConfiguration:error:_))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn saveLoginConfiguration_error(
153            &self,
154            login_configuration: &ASAuthorizationProviderExtensionLoginConfiguration,
155        ) -> Result<(), Retained<NSError>>;
156
157        #[cfg(feature = "objc2-security")]
158        /// Saves the provided certificate for the key type.
159        ///
160        /// Parameter `certificate`: The certificate to save.
161        ///
162        /// Parameter `keyType`: The key type for the certificate.
163        #[unsafe(method(saveCertificate:keyType:))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn saveCertificate_keyType(
166            &self,
167            certificate: &SecCertificate,
168            key_type: ASAuthorizationProviderExtensionKeyType,
169        );
170
171        #[cfg(feature = "objc2-security")]
172        /// Retrieves the key for the specified platform SSO key type.
173        ///
174        /// Parameter `keyType`: The key type to retrieve.
175        #[unsafe(method(copyKeyForKeyType:))]
176        #[unsafe(method_family = copy)]
177        pub unsafe fn copyKeyForKeyType(
178            &self,
179            key_type: ASAuthorizationProviderExtensionKeyType,
180        ) -> Option<Retained<SecKey>>;
181
182        #[cfg(feature = "objc2-security")]
183        /// Retrieves the identity for the specified platform SSO key type.
184        ///
185        /// Parameter `keyType`: The key type to retrieve.
186        #[unsafe(method(copyIdentityForKeyType:))]
187        #[unsafe(method_family = copy)]
188        pub unsafe fn copyIdentityForKeyType(
189            &self,
190            key_type: ASAuthorizationProviderExtensionKeyType,
191        ) -> Option<Retained<SecIdentity>>;
192
193        #[cfg(feature = "objc2-security")]
194        /// 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.
195        ///
196        /// Parameter `keyType`: The key type to retrieve.
197        #[unsafe(method(beginKeyRotationForKeyType:))]
198        // required for soundness, method has `returns_retained` attribute.
199        #[unsafe(method_family = copy)]
200        pub unsafe fn beginKeyRotationForKeyType(
201            &self,
202            key_type: ASAuthorizationProviderExtensionKeyType,
203        ) -> Option<Retained<SecKey>>;
204
205        /// Completes rotation for the key to replace the previous key.
206        ///
207        /// Parameter `keyType`: The key type to retrieve.
208        #[unsafe(method(completeKeyRotationForKeyType:))]
209        #[unsafe(method_family = none)]
210        pub unsafe fn completeKeyRotationForKeyType(
211            &self,
212            key_type: ASAuthorizationProviderExtensionKeyType,
213        );
214
215        #[cfg(feature = "block2")]
216        /// 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.
217        #[unsafe(method(userNeedsReauthenticationWithCompletion:))]
218        #[unsafe(method_family = none)]
219        pub unsafe fn userNeedsReauthenticationWithCompletion(
220            &self,
221            completion: &block2::DynBlock<dyn Fn(*mut NSError)>,
222        );
223
224        /// Requests that the device registration be run again to repair it.
225        #[unsafe(method(deviceRegistrationsNeedsRepair))]
226        #[unsafe(method_family = none)]
227        pub unsafe fn deviceRegistrationsNeedsRepair(&self);
228
229        /// Requests that user registration be run again for the current user to repair it.
230        #[unsafe(method(userRegistrationsNeedsRepair))]
231        #[unsafe(method_family = none)]
232        pub unsafe fn userRegistrationsNeedsRepair(&self);
233
234        /// Requests that the decryption keys are repaired.
235        #[unsafe(method(decryptionKeysNeedRepair))]
236        #[unsafe(method_family = none)]
237        pub unsafe fn decryptionKeysNeedRepair(&self);
238
239        /// Creates new Encryption, Signing, and Secure Enclave keys for the user.  The old keys will be destroyed.
240        #[unsafe(method(resetKeys))]
241        #[unsafe(method_family = none)]
242        pub unsafe fn resetKeys(&self);
243
244        /// Creates new Encryption, and Signing keys for the device or user.  The old keys will be destroyed.
245        #[unsafe(method(resetDeviceKeys))]
246        #[unsafe(method_family = none)]
247        pub unsafe fn resetDeviceKeys(&self);
248
249        /// Creates new Encryption, Signing, and Secure Enclave keys for the user.  The old keys will be destroyed.
250        #[unsafe(method(resetUserSecureEnclaveKey))]
251        #[unsafe(method_family = none)]
252        pub unsafe fn resetUserSecureEnclaveKey(&self);
253
254        #[cfg(feature = "block2")]
255        /// Provides a new or cached attestation for the specified key type.
256        ///
257        /// Parameter `keyType`: The key type for the attestation.
258        ///
259        /// Parameter `clientDataHash`: A SHA256 hash of a unique, single-use data block that embeds a challenge from your server.
260        ///
261        /// Parameter `completion`: A closure that the method calls upon completion with the following parameters:
262        /// * attestationCertificates An array of certificates that verify the validity of the key associated with the keyType. Send this to your server for processing.
263        /// * error A DCError instance that indicates the reason for failure, or nil on success.
264        #[unsafe(method(attestKey:clientDataHash:completion:))]
265        #[unsafe(method_family = none)]
266        pub unsafe fn attestKey_clientDataHash_completion(
267            &self,
268            key_type: ASAuthorizationProviderExtensionKeyType,
269            client_data_hash: &NSData,
270            completion: &block2::DynBlock<dyn Fn(*mut NSArray, *mut NSError)>,
271        );
272
273        #[cfg(feature = "block2")]
274        /// Provides a new or cached attestation for the specified pending key type.
275        ///
276        /// Parameter `keyType`: The pending key type for the attestation.
277        ///
278        /// Parameter `clientDataHash`: A SHA256 hash of a unique, single-use data block that embeds a challenge from your server.
279        ///
280        /// Parameter `completion`: A closure that the method calls upon completion with the following parameters:
281        /// * attestationCertificates An array of certificates that verify the validity of the pending key associated with the keyType. Send this to your server for processing.
282        /// * error A DCError instance that indicates the reason for failure, or nil on success.
283        #[unsafe(method(attestPendingKey:clientDataHash:completion:))]
284        #[unsafe(method_family = none)]
285        pub unsafe fn attestPendingKey_clientDataHash_completion(
286            &self,
287            key_type: ASAuthorizationProviderExtensionKeyType,
288            client_data_hash: &NSData,
289            completion: &block2::DynBlock<dyn Fn(*mut NSArray, *mut NSError)>,
290        );
291
292        #[cfg(feature = "block2")]
293        /// 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.
294        #[unsafe(method(presentRegistrationViewControllerWithCompletion:))]
295        #[unsafe(method_family = none)]
296        pub unsafe fn presentRegistrationViewControllerWithCompletion(
297            &self,
298            completion: &block2::DynBlock<dyn Fn(*mut NSError)>,
299        );
300    );
301}