objc2_authentication_services/generated/
ASCredentialRequest.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::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9/// [Apple's documentation](https://developer.apple.com/documentation/authenticationservices/ascredentialrequesttype?language=objc)
10// NS_ENUM
11#[repr(transparent)]
12#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
13pub struct ASCredentialRequestType(pub NSInteger);
14impl ASCredentialRequestType {
15    #[doc(alias = "ASCredentialRequestTypePassword")]
16    pub const Password: Self = Self(0);
17    #[doc(alias = "ASCredentialRequestTypePasskeyAssertion")]
18    pub const PasskeyAssertion: Self = Self(1);
19    #[doc(alias = "ASCredentialRequestTypePasskeyRegistration")]
20    pub const PasskeyRegistration: Self = Self(2);
21    #[doc(alias = "ASCredentialRequestTypeOneTimeCode")]
22    pub const OneTimeCode: Self = Self(3);
23}
24
25unsafe impl Encode for ASCredentialRequestType {
26    const ENCODING: Encoding = NSInteger::ENCODING;
27}
28
29unsafe impl RefEncode for ASCredentialRequestType {
30    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
31}
32
33extern_protocol!(
34    /// ASCredentialRequest is used by Credential Provider Extensions to identify a credential to use
35    /// for an authorization request. For passkey requests it also carries the assertion challenge to
36    /// be used by the extension to create the assertion response.
37    ///
38    /// See also [Apple's documentation](https://developer.apple.com/documentation/authenticationservices/ascredentialrequest?language=objc)
39    pub unsafe trait ASCredentialRequest:
40        NSObjectProtocol + NSSecureCoding + NSCopying
41    {
42        /// The type of credential used for this request.
43        #[unsafe(method(type))]
44        #[unsafe(method_family = none)]
45        unsafe fn r#type(&self) -> ASCredentialRequestType;
46
47        #[cfg(feature = "ASCredentialIdentity")]
48        /// The credential identity selected by the user to authenticate.
49        #[unsafe(method(credentialIdentity))]
50        #[unsafe(method_family = none)]
51        unsafe fn credentialIdentity(&self) -> Retained<ProtocolObject<dyn ASCredentialIdentity>>;
52    }
53);