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::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/authenticationservices/aspublickeycredentialclientdatacrossoriginvalue?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct ASPublicKeyCredentialClientDataCrossOriginValue(pub NSInteger);
impl ASPublicKeyCredentialClientDataCrossOriginValue {
    #[doc(alias = "ASPublicKeyCredentialClientDataCrossOriginValueNotSet")]
    pub const NotSet: Self = Self(0);
    #[doc(alias = "ASPublicKeyCredentialClientDataCrossOriginValueCrossOrigin")]
    pub const CrossOrigin: Self = Self(1);
    #[doc(alias = "ASPublicKeyCredentialClientDataCrossOriginValueSameOriginWithAncestors")]
    pub const SameOriginWithAncestors: Self = Self(2);
}

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

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

extern_class!(
    /// This object represents the client data for a public key credential request, as defined in the WebAuthentication standard.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/authenticationservices/aspublickeycredentialclientdata?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct ASPublicKeyCredentialClientData;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for ASPublicKeyCredentialClientData {}
);

impl ASPublicKeyCredentialClientData {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(initWithChallenge:origin:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithChallenge_origin(
            this: Allocated<Self>,
            challenge: &NSData,
            origin: &NSString,
        ) -> Retained<Self>;

        /// The challenge to be signed during the operation.
        #[unsafe(method(challenge))]
        #[unsafe(method_family = none)]
        pub unsafe fn challenge(&self) -> Retained<NSData>;

        /// Setter for [`challenge`][Self::challenge].
        #[unsafe(method(setChallenge:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setChallenge(&self, challenge: &NSData);

        /// The origin for where the request was performed.
        #[unsafe(method(origin))]
        #[unsafe(method_family = none)]
        pub unsafe fn origin(&self) -> Retained<NSString>;

        /// Setter for [`origin`][Self::origin].
        #[unsafe(method(setOrigin:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setOrigin(&self, origin: &NSString);

        /// The top-level origin, if applicable.
        #[unsafe(method(topOrigin))]
        #[unsafe(method_family = none)]
        pub unsafe fn topOrigin(&self) -> Option<Retained<NSString>>;

        /// Setter for [`topOrigin`][Self::topOrigin].
        #[unsafe(method(setTopOrigin:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setTopOrigin(&self, top_origin: Option<&NSString>);

        /// Indicates whether this is a cross-origin request, if applicable.
        #[unsafe(method(crossOrigin))]
        #[unsafe(method_family = none)]
        pub unsafe fn crossOrigin(&self) -> ASPublicKeyCredentialClientDataCrossOriginValue;

        /// Setter for [`crossOrigin`][Self::crossOrigin].
        #[unsafe(method(setCrossOrigin:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCrossOrigin(
            &self,
            cross_origin: ASPublicKeyCredentialClientDataCrossOriginValue,
        );
    );
}