objc2-authentication-services 0.3.2

Bindings to the AuthenticationServices 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::*;

/// [Apple's documentation](https://developer.apple.com/documentation/authenticationservices/ascredentialrequesttype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct ASCredentialRequestType(pub NSInteger);
impl ASCredentialRequestType {
    #[doc(alias = "ASCredentialRequestTypePassword")]
    pub const Password: Self = Self(0);
    #[doc(alias = "ASCredentialRequestTypePasskeyAssertion")]
    pub const PasskeyAssertion: Self = Self(1);
    #[doc(alias = "ASCredentialRequestTypePasskeyRegistration")]
    pub const PasskeyRegistration: Self = Self(2);
    #[doc(alias = "ASCredentialRequestTypeOneTimeCode")]
    pub const OneTimeCode: Self = Self(3);
}

unsafe impl Encode for ASCredentialRequestType {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for ASCredentialRequestType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_protocol!(
    /// ASCredentialRequest is used by Credential Provider Extensions to identify a credential to use
    /// for an authorization request. For passkey requests it also carries the assertion challenge to
    /// be used by the extension to create the assertion response.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/authenticationservices/ascredentialrequest?language=objc)
    pub unsafe trait ASCredentialRequest:
        NSObjectProtocol + NSSecureCoding + NSCopying
    {
        /// The type of credential used for this request.
        #[unsafe(method(type))]
        #[unsafe(method_family = none)]
        unsafe fn r#type(&self) -> ASCredentialRequestType;

        #[cfg(feature = "ASCredentialIdentity")]
        /// The credential identity selected by the user to authenticate.
        #[unsafe(method(credentialIdentity))]
        #[unsafe(method_family = none)]
        unsafe fn credentialIdentity(&self) -> Retained<ProtocolObject<dyn ASCredentialIdentity>>;
    }
);