objc2_local_authentication/generated/LAContext.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/localauthentication/lapolicy?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct LAPolicy(pub NSInteger);
17impl LAPolicy {
18 /// Device owner will be authenticated using a biometric method (Touch ID).
19 ///
20 ///
21 /// Biometric authentication is required. If Touch ID is not available, not enrolled
22 /// or locked out, then the evaluation of this policy will fail with LAErrorBiometryNotAvailable,
23 /// LAErrorBiometryNotEnrolled or LAErrorBiometryLockout.
24 ///
25 /// Touch ID authentication dialog contains a cancel button with default title "Cancel"
26 /// which can be customized using localizedCancelTitle property, and a fallback button with
27 /// default title "Use Password…" which can be customized using localizedFallbackTitle
28 /// property. Clicking either button causes evaluatePolicy call to fail, returning a distinct
29 /// error code: LAErrorUserCancel or LAErrorUserFallback.
30 ///
31 /// Biometric authentication will get locked after 5 unsuccessful attempts. After that,
32 /// users have to unlock it by entering their account password. The password can be entered
33 /// either at login window or in the preference sheets or even in application by the means of
34 /// LAPolicyDeviceOwnerAuthentication. The system unlock is preferred user experience because
35 /// we generaly don't want users to enter their account password at application's request.
36 #[doc(alias = "LAPolicyDeviceOwnerAuthenticationWithBiometrics")]
37 pub const DeviceOwnerAuthenticationWithBiometrics: Self = Self(1);
38 /// Device owner will be authenticated by biometry or user password.
39 ///
40 ///
41 /// Touch ID or user password authentication is required. If Touch ID is not available,
42 /// not enrolled or locked out, then the user is asked for password right away.
43 ///
44 /// Touch ID authentication dialog behaves similarly as the one used by
45 /// LAPolicyDeviceOwnerAuthenticationWithBiometrics. However, the "Use Password.." button does
46 /// not end the authentication. Instead, it switches the authentication mechanism to user password.
47 #[doc(alias = "LAPolicyDeviceOwnerAuthentication")]
48 pub const DeviceOwnerAuthentication: Self = Self(2);
49 /// Device owner will be authenticated by a companion device e.g. Watch, Mac, etc.
50 ///
51 ///
52 /// Companion authentication is required. If no nearby paired companion device can be found,
53 /// LAErrorCompanionNotAvailable is returned.
54 ///
55 /// Users should follow instructions on the companion device to authenticate.
56 #[doc(alias = "LAPolicyDeviceOwnerAuthenticationWithCompanion")]
57 pub const DeviceOwnerAuthenticationWithCompanion: Self = Self(3);
58 /// Device owner will be authenticated by biometry or a companion device e.g. Watch, Mac, etc.
59 ///
60 ///
61 /// Companion or biometric authentication is required. If no nearby paired companion device can be found,
62 /// it behaves as LAPolicyDeviceOwnerAuthenticationWithBiometrics. Similarly, if biometry is
63 /// unavailable it behaves as LAPolicyDeviceOwnerAuthenticationWithCompanion.
64 ///
65 /// Depending on the companion type and biometry and companion availability,
66 /// either a user is asked to authenticate with biometry and on a companion device in parallel
67 /// or the companion authentication takes precedence
68 /// and a user is asked to authenticate exclusively on the companion device if available.
69 /// Users should follow instructions on the companion device to authenticate.
70 #[doc(alias = "LAPolicyDeviceOwnerAuthenticationWithBiometricsOrCompanion")]
71 pub const DeviceOwnerAuthenticationWithBiometricsOrCompanion: Self = Self(4);
72 /// Device owner will be authenticated by device passcode. The authentication will also succeed if the wrist detection is enabled,
73 /// correct passcode was entered in the past and the watch has been on the wrist ever since.
74 #[doc(alias = "LAPolicyDeviceOwnerAuthenticationWithWristDetection")]
75 pub const DeviceOwnerAuthenticationWithWristDetection: Self = Self(5);
76 /// Device owner will be authenticated by Watch.
77 ///
78 ///
79 /// Watch authentication is required. If no nearby paired watch device can be found,
80 /// LAErrorWatchNotAvailable is returned.
81 ///
82 /// Watch authentication dialog looks and behaves similarly to the biometric variant. Users can
83 /// confirm authentication by double-clicking the side button on their watch.
84 #[doc(alias = "LAPolicyDeviceOwnerAuthenticationWithWatch")]
85 #[deprecated]
86 pub const DeviceOwnerAuthenticationWithWatch: Self = Self(3);
87 /// Device owner will be authenticated by biometry or Watch.
88 ///
89 ///
90 /// Watch or biometric authentication is required. If no nearby paired watch device can be found,
91 /// it behaves as LAPolicyDeviceOwnerAuthenticationWithBiometrics. Similarly, if biometry is
92 /// unavailable it behaves as LAPolicyDeviceOwnerAuthenticationWithWatch.
93 ///
94 /// Watch authentication dialog looks and behaves similarly to biometric variant. When both
95 /// mechanisms are available, user is asked to use biometry and watch authentication will run in
96 /// parallel.
97 #[doc(alias = "LAPolicyDeviceOwnerAuthenticationWithBiometricsOrWatch")]
98 #[deprecated]
99 pub const DeviceOwnerAuthenticationWithBiometricsOrWatch: Self = Self(4);
100}
101
102unsafe impl Encode for LAPolicy {
103 const ENCODING: Encoding = NSInteger::ENCODING;
104}
105
106unsafe impl RefEncode for LAPolicy {
107 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
108}
109
110extern "C" {
111 /// The maximum value for LAContext touchIDAuthenticationAllowableReuseDuration property.
112 ///
113 /// See also [Apple's documentation](https://developer.apple.com/documentation/localauthentication/latouchidauthenticationmaximumallowablereuseduration?language=objc)
114 pub static LATouchIDAuthenticationMaximumAllowableReuseDuration: NSTimeInterval;
115}
116
117/// [Apple's documentation](https://developer.apple.com/documentation/localauthentication/lacredentialtype?language=objc)
118// NS_ENUM
119#[repr(transparent)]
120#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
121pub struct LACredentialType(pub NSInteger);
122impl LACredentialType {
123 /// Password provided by application
124 ///
125 ///
126 /// If not set, LocalAuthentication will ask for the password when necessary. It will use
127 /// its own user interface depending on the evaluated policy or ACL.
128 /// Applications can provide the password using the setCredential method. In such case,
129 /// LocalAuthentication will not show password entry user interface.
130 /// When entered from the LocalAuthentication user interface, the password is stored as
131 /// UTF-8 encoded string.
132 #[doc(alias = "LACredentialTypeApplicationPassword")]
133 pub const ApplicationPassword: Self = Self(0);
134 /// Smart card PIN provided by application
135 ///
136 ///
137 /// If not set, LocalAuthentication will ask users for the smart card PIN when necessary.
138 /// Applications can provide the PIN using setCredential method. In such case,
139 /// LocalAuthentication will not show the smart card PIN user interface.
140 /// When entered from the LocalAuthentication user interface, the PIN is stored as
141 /// UTF-8 encoded string.
142 #[doc(alias = "LACredentialTypeSmartCardPIN")]
143 pub const SmartCardPIN: Self = Self(-3);
144}
145
146unsafe impl Encode for LACredentialType {
147 const ENCODING: Encoding = NSInteger::ENCODING;
148}
149
150unsafe impl RefEncode for LACredentialType {
151 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
152}
153
154/// [Apple's documentation](https://developer.apple.com/documentation/localauthentication/laaccesscontroloperation?language=objc)
155// NS_ENUM
156#[repr(transparent)]
157#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
158pub struct LAAccessControlOperation(pub NSInteger);
159impl LAAccessControlOperation {
160 /// Access control will be used for item creation.
161 #[doc(alias = "LAAccessControlOperationCreateItem")]
162 pub const CreateItem: Self = Self(0);
163 /// Access control will be used for accessing existing item.
164 #[doc(alias = "LAAccessControlOperationUseItem")]
165 pub const UseItem: Self = Self(1);
166 /// Access control will be used for key creation.
167 #[doc(alias = "LAAccessControlOperationCreateKey")]
168 pub const CreateKey: Self = Self(2);
169 /// Access control will be used for sign operation with existing key.
170 #[doc(alias = "LAAccessControlOperationUseKeySign")]
171 pub const UseKeySign: Self = Self(3);
172 /// Access control will be used for data decryption using existing key.
173 #[doc(alias = "LAAccessControlOperationUseKeyDecrypt")]
174 pub const UseKeyDecrypt: Self = Self(4);
175 /// Access control will be used for key exchange.
176 #[doc(alias = "LAAccessControlOperationUseKeyKeyExchange")]
177 pub const UseKeyKeyExchange: Self = Self(5);
178}
179
180unsafe impl Encode for LAAccessControlOperation {
181 const ENCODING: Encoding = NSInteger::ENCODING;
182}
183
184unsafe impl RefEncode for LAAccessControlOperation {
185 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
186}
187
188extern_class!(
189 /// Class that represents an authentication context.
190 ///
191 ///
192 /// This context can be used for evaluating policies.
193 ///
194 ///
195 /// See: LAPolicy
196 ///
197 /// See also [Apple's documentation](https://developer.apple.com/documentation/localauthentication/lacontext?language=objc)
198 #[unsafe(super(NSObject))]
199 #[derive(Debug, PartialEq, Eq, Hash)]
200 pub struct LAContext;
201);
202
203extern_conformance!(
204 unsafe impl NSObjectProtocol for LAContext {}
205);
206
207impl LAContext {
208 extern_methods!(
209 /// Determines if a particular policy can be evaluated.
210 ///
211 ///
212 /// Policies can have certain requirements which, when not satisfied, would always cause
213 /// the policy evaluation to fail - e.g. a passcode set, a fingerprint
214 /// enrolled with Touch ID or a face set up with Face ID. This method allows easy checking
215 /// for such conditions.
216 ///
217 /// Applications should consume the returned value immediately and avoid relying on it
218 /// for an extensive period of time. At least, it is guaranteed to stay valid until the
219 /// application enters background.
220 ///
221 ///
222 /// Warning: Do not call this method in the reply block of evaluatePolicy:reply: because it could
223 /// lead to a deadlock.
224 ///
225 ///
226 /// Parameter `policy`: Policy for which the preflight check should be run.
227 ///
228 ///
229 /// Parameter `error`: Optional output parameter which is set to nil if the policy can be evaluated, or it
230 /// contains error information if policy evaluation is not possible.
231 ///
232 ///
233 /// Returns: YES if the policy can be evaluated, NO otherwise.
234 #[unsafe(method(canEvaluatePolicy:error:_))]
235 #[unsafe(method_family = none)]
236 pub unsafe fn canEvaluatePolicy_error(
237 &self,
238 policy: LAPolicy,
239 ) -> Result<(), Retained<NSError>>;
240
241 #[cfg(feature = "block2")]
242 /// Evaluates the specified policy.
243 ///
244 ///
245 /// Policy evaluation may involve prompting user for various kinds of interaction
246 /// or authentication. Actual behavior is dependent on evaluated policy, device type,
247 /// and can be affected by installed configuration profiles.
248 ///
249 /// Be sure to keep a strong reference to the context while the evaluation is in progress.
250 /// Otherwise, an evaluation would be canceled when the context is being deallocated.
251 ///
252 /// The method does not block. Instead, the caller must provide a reply block to be
253 /// called asynchronously when evaluation finishes. The block is executed on a private
254 /// queue internal to the framework in an unspecified threading context. Other than that,
255 /// no guarantee is made about which queue, thread, or run-loop the block is executed on.
256 ///
257 /// Implications of successful policy evaluation are policy specific. In general, this
258 /// operation is not idempotent. Policy evaluation may fail for various reasons, including
259 /// user cancel, system cancel and others, see LAError codes.
260 ///
261 ///
262 /// Parameter `policy`: Policy to be evaluated.
263 ///
264 ///
265 /// Parameter `reply`: Reply block that is executed when policy evaluation finishes.
266 /// success Reply parameter that is YES if the policy has been evaluated successfully or
267 /// NO if the evaluation failed.
268 /// error Reply parameter that is nil if the policy has been evaluated successfully, or it
269 /// contains error information about the evaluation failure.
270 ///
271 ///
272 /// Parameter `localizedReason`: Application reason for authentication. This string must be provided in correct
273 /// localization and should be short and clear. It will be eventually displayed in
274 /// the authentication dialog as a part of the following string:
275 /// "<appname>" is trying to
276 /// <localized
277 /// reason>.
278 ///
279 /// For example, if the app name is "TestApp" and localizedReason is passed "access
280 /// the hidden records", then the authentication prompt will read:
281 /// "TestApp" is trying to access the hidden records.
282 ///
283 ///
284 /// Warning: localizedReason parameter is mandatory and the call will throw NSInvalidArgumentException if
285 /// nil or empty string is specified.
286 ///
287 ///
288 /// See: LAError
289 ///
290 /// Typical error codes returned by this call are:
291 ///
292 /// LAErrorUserFallback if user tapped the fallback button
293 ///
294 /// LAErrorUserCancel if user has tapped the Cancel button
295 ///
296 /// LAErrorSystemCancel if some system event interrupted the evaluation (e.g. Home button pressed).
297 ///
298 /// # Safety
299 ///
300 /// `reply` block must be sendable.
301 #[unsafe(method(evaluatePolicy:localizedReason:reply:))]
302 #[unsafe(method_family = none)]
303 pub unsafe fn evaluatePolicy_localizedReason_reply(
304 &self,
305 policy: LAPolicy,
306 localized_reason: &NSString,
307 reply: &block2::DynBlock<dyn Fn(Bool, *mut NSError)>,
308 );
309
310 /// Invalidates the context.
311 ///
312 ///
313 /// The context is invalidated automatically when it is (auto)released. This method
314 /// allows invalidating it manually while it is still in scope.
315 ///
316 /// Invalidation terminates any existing policy evaluation and the respective call will
317 /// fail with LAErrorAppCancel. After the context has been invalidated, it can not be
318 /// used for policy evaluation and an attempt to do so will fail with LAErrorInvalidContext.
319 ///
320 /// Invalidating a context that has been already invalidated has no effect.
321 #[unsafe(method(invalidate))]
322 #[unsafe(method_family = none)]
323 pub unsafe fn invalidate(&self);
324
325 /// Sets a credential to this context.
326 ///
327 ///
328 /// Some policies allow to bind application-provided credential with them.
329 /// This method allows credential to be passed to the right context.
330 ///
331 ///
332 /// Parameter `credential`: Credential to be used with subsequent calls. Setting this parameter to nil will remove
333 /// any existing credential of the specified type.
334 ///
335 ///
336 /// Parameter `type`: Type of the provided credential.
337 ///
338 ///
339 /// Returns: YES if the credential was set successfully, NO otherwise.
340 #[unsafe(method(setCredential:type:))]
341 #[unsafe(method_family = none)]
342 pub unsafe fn setCredential_type(
343 &self,
344 credential: Option<&NSData>,
345 r#type: LACredentialType,
346 ) -> bool;
347
348 /// Reveals if credential was set with this context.
349 ///
350 ///
351 /// Parameter `type`: Type of credential we are asking for.
352 ///
353 ///
354 /// Returns: YES on success, NO otherwise.
355 #[unsafe(method(isCredentialSet:))]
356 #[unsafe(method_family = none)]
357 pub unsafe fn isCredentialSet(&self, r#type: LACredentialType) -> bool;
358
359 #[cfg(all(feature = "block2", feature = "objc2-security"))]
360 /// Evaluates access control object for the specified operation.
361 ///
362 ///
363 /// Access control evaluation may involve prompting user for various kinds of interaction
364 /// or authentication. Actual behavior is dependent on evaluated access control, device type,
365 /// and can be affected by installed configuration profiles.
366 ///
367 /// Be sure to keep a strong reference to the context while the evaluation is in progress.
368 /// Otherwise, an evaluation would be canceled when the context is being deallocated.
369 ///
370 /// The method does not block. Instead, the caller must provide a reply block to be
371 /// called asynchronously when evaluation finishes. The block is executed on a private
372 /// queue internal to the framework in an unspecified threading context. Other than that,
373 /// no guarantee is made about which queue, thread, or run-loop the block is executed on.
374 ///
375 /// After successful access control evaluation, the LAContext can be used with keychain operations,
376 /// so that they do not require user to authenticate.
377 ///
378 /// Access control evaluation may fail for various reasons, including user cancel, system cancel
379 /// and others, see LAError codes.
380 ///
381 ///
382 /// Parameter `accessControl`: Access control object that is typically created by SecAccessControlCreateWithFlags.
383 ///
384 ///
385 /// Parameter `operation`: Type of operation the access control will be used with.
386 ///
387 ///
388 /// Parameter `localizedReason`: Application reason for authentication. This string must be provided in correct
389 /// localization and should be short and clear. It will be eventually displayed in
390 /// the authentication dialog as a part of the following string:
391 /// "<appname>" is trying to
392 /// <localized
393 /// reason>.
394 ///
395 /// For example, if the app name is "TestApp" and localizedReason is passed "access
396 /// the hidden records", then the authentication prompt will read:
397 /// "TestApp" is trying to access the hidden records.
398 ///
399 ///
400 /// Parameter `reply`: Reply block that is executed when access control evaluation finishes.
401 /// success Reply parameter that is YES if the access control has been evaluated successfully or
402 /// NO if the evaluation failed.
403 /// error Reply parameter that is nil if the access control has been evaluated successfully, or
404 /// it contains error information about the evaluation failure.
405 ///
406 ///
407 /// Warning: localizedReason parameter is mandatory and the call will throw NSInvalidArgumentException if
408 /// nil or empty string is specified.
409 ///
410 /// # Safety
411 ///
412 /// `reply` block must be sendable.
413 #[unsafe(method(evaluateAccessControl:operation:localizedReason:reply:))]
414 #[unsafe(method_family = none)]
415 pub unsafe fn evaluateAccessControl_operation_localizedReason_reply(
416 &self,
417 access_control: &SecAccessControl,
418 operation: LAAccessControlOperation,
419 localized_reason: &NSString,
420 reply: &block2::DynBlock<dyn Fn(Bool, *mut NSError)>,
421 );
422
423 /// Fallback button title.
424 ///
425 /// Allows fallback button title customization. If set to empty string, the button will be hidden.
426 /// A default title "Use Password…" is used when this property is left nil.
427 #[unsafe(method(localizedFallbackTitle))]
428 #[unsafe(method_family = none)]
429 pub unsafe fn localizedFallbackTitle(&self) -> Option<Retained<NSString>>;
430
431 /// Setter for [`localizedFallbackTitle`][Self::localizedFallbackTitle].
432 ///
433 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
434 #[unsafe(method(setLocalizedFallbackTitle:))]
435 #[unsafe(method_family = none)]
436 pub unsafe fn setLocalizedFallbackTitle(&self, localized_fallback_title: Option<&NSString>);
437
438 /// This property is deprecated and setting it has no effect.
439 #[deprecated = "No longer supported"]
440 #[unsafe(method(maxBiometryFailures))]
441 #[unsafe(method_family = none)]
442 pub unsafe fn maxBiometryFailures(&self) -> Option<Retained<NSNumber>>;
443
444 /// Setter for [`maxBiometryFailures`][Self::maxBiometryFailures].
445 #[deprecated = "No longer supported"]
446 #[unsafe(method(setMaxBiometryFailures:))]
447 #[unsafe(method_family = none)]
448 pub unsafe fn setMaxBiometryFailures(&self, max_biometry_failures: Option<&NSNumber>);
449
450 /// Cancel button title.
451 ///
452 /// Allows cancel button title customization. A default title "Cancel" is used when
453 /// this property is left nil or is set to empty string.
454 #[unsafe(method(localizedCancelTitle))]
455 #[unsafe(method_family = none)]
456 pub unsafe fn localizedCancelTitle(&self) -> Option<Retained<NSString>>;
457
458 /// Setter for [`localizedCancelTitle`][Self::localizedCancelTitle].
459 ///
460 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
461 #[unsafe(method(setLocalizedCancelTitle:))]
462 #[unsafe(method_family = none)]
463 pub unsafe fn setLocalizedCancelTitle(&self, localized_cancel_title: Option<&NSString>);
464
465 /// Time interval for accepting a successful Touch ID or Face ID device unlock (on the lock screen) from the past.
466 ///
467 ///
468 /// This property can be set with a time interval in seconds. If the device was successfully unlocked by
469 /// biometry within this time interval, then biometric authentication on this context will succeed
470 /// automatically and the reply block will be called without prompting user for Touch ID or Face ID.
471 ///
472 /// The default value is 0, meaning that no previous biometric unlock can be reused.
473 ///
474 /// This property is meant only for reusing biometric matches from the device lock screen.
475 /// It does not allow reusing previous biometric matches in application or between applications.
476 ///
477 /// The maximum supported interval is 5 minutes and setting the value beyond 5 minutes does not increase
478 /// the accepted interval.
479 ///
480 ///
481 /// See: LATouchIDAuthenticationMaximumAllowableReuseDuration
482 #[unsafe(method(touchIDAuthenticationAllowableReuseDuration))]
483 #[unsafe(method_family = none)]
484 pub unsafe fn touchIDAuthenticationAllowableReuseDuration(&self) -> NSTimeInterval;
485
486 /// Setter for [`touchIDAuthenticationAllowableReuseDuration`][Self::touchIDAuthenticationAllowableReuseDuration].
487 #[unsafe(method(setTouchIDAuthenticationAllowableReuseDuration:))]
488 #[unsafe(method_family = none)]
489 pub unsafe fn setTouchIDAuthenticationAllowableReuseDuration(
490 &self,
491 touch_id_authentication_allowable_reuse_duration: NSTimeInterval,
492 );
493
494 /// Allows setting the default localized authentication reason on context.
495 ///
496 ///
497 /// A localized string from this property is displayed in the authentication UI if the caller didn't specify
498 /// its own authentication reason (e.g. a keychain operation with kSecUseAuthenticationContext). This property
499 /// is ignored if the authentication reason was provided by caller.
500 #[unsafe(method(localizedReason))]
501 #[unsafe(method_family = none)]
502 pub unsafe fn localizedReason(&self) -> Retained<NSString>;
503
504 /// Setter for [`localizedReason`][Self::localizedReason].
505 ///
506 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
507 #[unsafe(method(setLocalizedReason:))]
508 #[unsafe(method_family = none)]
509 pub unsafe fn setLocalizedReason(&self, localized_reason: &NSString);
510
511 /// Allows running authentication in non-interactive mode.
512 ///
513 ///
514 /// If the context is used in a keychain query by the means of kSecUseAuthenticationContext,
515 /// then setting this property to YES has the same effect as passing kSecUseNoAuthenticationUI
516 /// in the query, i.e. the keychain call will eventually fail with errSecInteractionNotAllowed
517 /// instead of displaying the authentication UI.
518 ///
519 /// If this property is used with a LocalAuthentication evaluation, it will eventually fail with
520 /// LAErrorNotInteractive instead of displaying the authentication UI.
521 #[unsafe(method(interactionNotAllowed))]
522 #[unsafe(method_family = none)]
523 pub unsafe fn interactionNotAllowed(&self) -> bool;
524
525 /// Setter for [`interactionNotAllowed`][Self::interactionNotAllowed].
526 #[unsafe(method(setInteractionNotAllowed:))]
527 #[unsafe(method_family = none)]
528 pub unsafe fn setInteractionNotAllowed(&self, interaction_not_allowed: bool);
529
530 #[cfg(feature = "LABiometryType")]
531 /// Indicates the type of the biometry supported by the device.
532 #[unsafe(method(biometryType))]
533 #[unsafe(method_family = none)]
534 pub unsafe fn biometryType(&self) -> LABiometryType;
535
536 /// Contains policy domain state.
537 ///
538 ///
539 /// This property is set only when evaluatePolicy is called and succesful Touch ID or Face ID authentication
540 /// was performed, or when canEvaluatePolicy succeeds for a biometric policy.
541 /// It stays nil for all other cases.
542 /// If biometric database was modified (fingers or faces were removed or added), evaluatedPolicyDomainState
543 /// data will change. Nature of such database changes cannot be determined
544 /// but comparing data of evaluatedPolicyDomainState after different evaluatePolicy
545 /// will reveal the fact database was changed between calls.
546 ///
547 ///
548 /// Warning: Please note that the value returned by this property can change exceptionally between major OS versions even if
549 /// the state of biometry has not changed.
550 #[deprecated]
551 #[unsafe(method(evaluatedPolicyDomainState))]
552 #[unsafe(method_family = none)]
553 pub unsafe fn evaluatedPolicyDomainState(&self) -> Option<Retained<NSData>>;
554
555 #[cfg(feature = "LADomainState")]
556 /// Contains authentication domain state.
557 #[unsafe(method(domainState))]
558 #[unsafe(method_family = none)]
559 pub unsafe fn domainState(&self) -> Retained<LADomainState>;
560 );
561}
562
563/// Methods declared on superclass `NSObject`.
564impl LAContext {
565 extern_methods!(
566 #[unsafe(method(init))]
567 #[unsafe(method_family = init)]
568 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
569
570 #[unsafe(method(new))]
571 #[unsafe(method_family = new)]
572 pub unsafe fn new() -> Retained<Self>;
573 );
574}