objc2-local-authentication 0.3.2

Bindings to the LocalAuthentication framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/localauthentication/laenvironmentmechanismbiometry?language=objc)
    #[unsafe(super(LAEnvironmentMechanism, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "LAEnvironmentMechanism")]
    pub struct LAEnvironmentMechanismBiometry;
);

#[cfg(feature = "LAEnvironmentMechanism")]
unsafe impl Send for LAEnvironmentMechanismBiometry {}

#[cfg(feature = "LAEnvironmentMechanism")]
unsafe impl Sync for LAEnvironmentMechanismBiometry {}

#[cfg(feature = "LAEnvironmentMechanism")]
extern_conformance!(
    unsafe impl NSObjectProtocol for LAEnvironmentMechanismBiometry {}
);

#[cfg(feature = "LAEnvironmentMechanism")]
impl LAEnvironmentMechanismBiometry {
    extern_methods!(
        #[cfg(feature = "LABiometryType")]
        /// Type of biometry supported by the device.
        ///
        /// This property does not indicate whether biometry is available or not. It always reads the type of biometry
        /// supported by device hardware. You should check
        /// `isUsable`property to see if it is available for use.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(biometryType))]
        #[unsafe(method_family = none)]
        pub unsafe fn biometryType(&self) -> LABiometryType;

        /// Whether the user has enrolled this biometry.
        ///
        /// Even if biometry is enrolled, it does not necessarily mean that it can be used. You should check
        /// `isUsable`property to see if it is available for use.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(isEnrolled))]
        #[unsafe(method_family = none)]
        pub unsafe fn isEnrolled(&self) -> bool;

        /// Whether biometry is locked out.
        ///
        /// The system might lock the user out of biometry for various reasons. For example, with Face ID, the user is
        /// locked out after 5 failed match attempts in row. To recover from bio lockout, users need to enter their passcode
        /// (e.g. during device ulock).
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(isLockedOut))]
        #[unsafe(method_family = none)]
        pub unsafe fn isLockedOut(&self) -> bool;

        /// The application specific state of the biometric enrollment as returned by
        /// `LAContext.domainState.biometry.stateHash`
        /// This value represents the state of the enrollment and changes whenever the biometric enrollment is changed.
        /// It does not directly map to the enrolled templates, e.g. if a finger is added to Touch ID enrollement and then
        /// removed, the final state would be different.
        /// It also returns different values to different apps to prevent tracking of user identity.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(stateHash))]
        #[unsafe(method_family = none)]
        pub unsafe fn stateHash(&self) -> Retained<NSData>;

        /// Whether the built in biometric sensor is inaccessible in the current configuration, preventing the use of biometry.
        ///
        /// Currently, the only example of this is a Clamshell Mode on macOS. The user will be not able to use Touch ID
        /// if the MacBook lid is closed while connected to external monitor and keyboard, unless the external keyboard
        /// has Touch ID.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(builtInSensorInaccessible))]
        #[unsafe(method_family = none)]
        pub unsafe fn builtInSensorInaccessible(&self) -> bool;
    );
}

/// Methods declared on superclass `LAEnvironmentMechanism`.
#[cfg(feature = "LAEnvironmentMechanism")]
impl LAEnvironmentMechanismBiometry {
    extern_methods!(
        /// Clients should only consume environment mechanisms..
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;

        /// The Clients should only consume environment mechanisms..
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}