objc2_local_authentication/generated/LARequirement.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5
6use crate::*;
7
8extern_class!(
9 /// Builds requirements that can be used for protecting a
10 /// `LARight`
11 ///
12 /// See also [Apple's documentation](https://developer.apple.com/documentation/localauthentication/laauthenticationrequirement?language=objc)
13 #[unsafe(super(NSObject))]
14 #[derive(Debug, PartialEq, Eq, Hash)]
15 pub struct LAAuthenticationRequirement;
16);
17
18extern_conformance!(
19 unsafe impl NSObjectProtocol for LAAuthenticationRequirement {}
20);
21
22impl LAAuthenticationRequirement {
23 extern_methods!(
24 /// Requires user authentication
25 ///
26 /// Returns: `LAAuthenticationRequirement`instance
27 #[unsafe(method(defaultRequirement))]
28 #[unsafe(method_family = none)]
29 pub unsafe fn defaultRequirement() -> Retained<LAAuthenticationRequirement>;
30
31 /// Requires biometric authentication
32 ///
33 /// The authorization will fail if:
34 ///
35 /// • Biometry is not available in the current device
36 ///
37 /// • There are no biometric enrollments
38 ///
39 /// Returns: `LAAuthenticationRequirement`instance
40 #[unsafe(method(biometryRequirement))]
41 #[unsafe(method_family = none)]
42 pub unsafe fn biometryRequirement() -> Retained<LAAuthenticationRequirement>;
43
44 /// Requires user authentication with the current biometric set
45 ///
46 /// The authorization will fail if:
47 ///
48 /// • Biometry is not available in the current device
49 ///
50 /// • There are no biometric enrollments
51 ///
52 /// • There is a change in the enrollment database -e.g a new TouchID finger is enrolled.
53 ///
54 /// Returns: `LAAuthenticationRequirement`instance
55 #[unsafe(method(biometryCurrentSetRequirement))]
56 #[unsafe(method_family = none)]
57 pub unsafe fn biometryCurrentSetRequirement() -> Retained<LAAuthenticationRequirement>;
58
59 /// Requires biometric authentication or the given fallback method.
60 ///
61 /// Parameter `fallback`: Fallback used in case biometry authentication fails, is not available or
62 /// not preferred by the user.
63 ///
64 /// Returns: `LAAuthenticationRequirement`instance
65 #[unsafe(method(biometryRequirementWithFallback:))]
66 #[unsafe(method_family = none)]
67 pub unsafe fn biometryRequirementWithFallback(
68 fallback: &LABiometryFallbackRequirement,
69 ) -> Retained<Self>;
70 );
71}
72
73/// Methods declared on superclass `NSObject`.
74impl LAAuthenticationRequirement {
75 extern_methods!(
76 #[unsafe(method(init))]
77 #[unsafe(method_family = init)]
78 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
79
80 #[unsafe(method(new))]
81 #[unsafe(method_family = new)]
82 pub unsafe fn new() -> Retained<Self>;
83 );
84}
85
86extern_class!(
87 /// Builds authentication requirements that can be used as fallbacks for biometric authentication
88 ///
89 /// See also [Apple's documentation](https://developer.apple.com/documentation/localauthentication/labiometryfallbackrequirement?language=objc)
90 #[unsafe(super(NSObject))]
91 #[derive(Debug, PartialEq, Eq, Hash)]
92 pub struct LABiometryFallbackRequirement;
93);
94
95extern_conformance!(
96 unsafe impl NSObjectProtocol for LABiometryFallbackRequirement {}
97);
98
99impl LABiometryFallbackRequirement {
100 extern_methods!(
101 /// Use default biometric fallback
102 ///
103 /// Returns: `LABiometryFallbackRequirement`instance
104 #[unsafe(method(defaultRequirement))]
105 #[unsafe(method_family = none)]
106 pub unsafe fn defaultRequirement() -> Retained<LABiometryFallbackRequirement>;
107
108 /// Requires authorization using the device passcode
109 ///
110 /// Returns: `LABiometryFallbackRequirement`instance
111 #[unsafe(method(devicePasscodeRequirement))]
112 #[unsafe(method_family = none)]
113 pub unsafe fn devicePasscodeRequirement() -> Retained<LABiometryFallbackRequirement>;
114 );
115}
116
117/// Methods declared on superclass `NSObject`.
118impl LABiometryFallbackRequirement {
119 extern_methods!(
120 #[unsafe(method(init))]
121 #[unsafe(method_family = init)]
122 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
123
124 #[unsafe(method(new))]
125 #[unsafe(method_family = new)]
126 pub unsafe fn new() -> Retained<Self>;
127 );
128}