#[non_exhaustive]pub enum LAPolicy {
DeviceOwnerAuthenticationWithBiometrics,
DeviceOwnerAuthentication,
DeviceOwnerAuthenticationWithCompanion,
DeviceOwnerAuthenticationWithBiometricsOrCompanion,
DeviceOwnerAuthenticationWithWatch,
DeviceOwnerAuthenticationWithBiometricsOrWatch,
}Expand description
Authentication policies supported on macOS by LocalAuthentication.framework.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
DeviceOwnerAuthenticationWithBiometrics
Authenticate the device owner using biometry only.
DeviceOwnerAuthentication
Authenticate the device owner using biometry or the local password.
DeviceOwnerAuthenticationWithCompanion
Authenticate the device owner using a nearby companion device.
DeviceOwnerAuthenticationWithBiometricsOrCompanion
Authenticate the device owner using biometry or a nearby companion device.
DeviceOwnerAuthenticationWithWatch
👎Deprecated:
Use DeviceOwnerAuthenticationWithCompanion instead.
Deprecated alias for companion-device authentication.
DeviceOwnerAuthenticationWithBiometricsOrWatch
👎Deprecated:
Use DeviceOwnerAuthenticationWithBiometricsOrCompanion instead.
Deprecated alias for biometry-or-companion authentication.
Implementations§
Source§impl LAPolicy
impl LAPolicy
pub const fn raw_value(self) -> i32
Sourcepub const fn description(self) -> &'static str
pub const fn description(self) -> &'static str
A short, human-readable name for the policy.
Examples found in repository?
examples/02_policy_catalog.rs (line 15)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let context = LAContext::new()?;
5 let policies = [
6 LAPolicy::DeviceOwnerAuthenticationWithBiometrics,
7 LAPolicy::DeviceOwnerAuthentication,
8 LAPolicy::DeviceOwnerAuthenticationWithCompanion,
9 LAPolicy::DeviceOwnerAuthenticationWithBiometricsOrCompanion,
10 ];
11
12 for policy in policies {
13 println!(
14 "{} => {:?}",
15 policy.description(),
16 context.can_evaluate_policy(policy)
17 );
18 }
19
20 println!("✅ policy catalogue OK");
21 Ok(())
22}Trait Implementations§
impl Copy for LAPolicy
impl Eq for LAPolicy
impl StructuralPartialEq for LAPolicy
Auto Trait Implementations§
impl Freeze for LAPolicy
impl RefUnwindSafe for LAPolicy
impl Send for LAPolicy
impl Sync for LAPolicy
impl Unpin for LAPolicy
impl UnsafeUnpin for LAPolicy
impl UnwindSafe for LAPolicy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more