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::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/authenticationservices/aspasskeyassertioncredential?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct ASPasskeyAssertionCredential;
);

#[cfg(feature = "ASAuthorizationCredential")]
extern_conformance!(
    unsafe impl ASAuthorizationCredential for ASPasskeyAssertionCredential {}
);

extern_conformance!(
    unsafe impl NSCoding for ASPasskeyAssertionCredential {}
);

extern_conformance!(
    unsafe impl NSCopying for ASPasskeyAssertionCredential {}
);

unsafe impl CopyingHelper for ASPasskeyAssertionCredential {
    type Result = Self;
}

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

extern_conformance!(
    unsafe impl NSSecureCoding for ASPasskeyAssertionCredential {}
);

impl ASPasskeyAssertionCredential {
    extern_methods!(
        /// Initializes an ASPasskeyCredential object.
        ///
        /// Parameter `userHandle`: The identifier for the account the passkey is associated with.
        ///
        /// Parameter `relyingParty`: the relying party.
        ///
        /// Parameter `signature`: the signature for the assertion challenge.
        #[unsafe(method(initWithUserHandle:relyingParty:signature:clientDataHash:authenticatorData:credentialID:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithUserHandle_relyingParty_signature_clientDataHash_authenticatorData_credentialID(
            this: Allocated<Self>,
            user_handle: &NSData,
            relying_party: &NSString,
            signature: &NSData,
            client_data_hash: &NSData,
            authenticator_data: &NSData,
            credential_id: &NSData,
        ) -> Retained<Self>;

        #[cfg(feature = "ASPasskeyAssertionCredentialExtensionOutput")]
        /// Initializes an ASPasskeyCredential object.
        ///
        /// Parameter `userHandle`: The identifier for the account the passkey is associated with.
        ///
        /// Parameter `relyingParty`: The relying party.
        ///
        /// Parameter `signature`: The signature for the assertion challenge.
        ///
        /// Parameter `extensionOutput`: The outputs of WebAuthn extensions processed by the credential provider.
        #[unsafe(method(initWithUserHandle:relyingParty:signature:clientDataHash:authenticatorData:credentialID:extensionOutput:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithUserHandle_relyingParty_signature_clientDataHash_authenticatorData_credentialID_extensionOutput(
            this: Allocated<Self>,
            user_handle: &NSData,
            relying_party: &NSString,
            signature: &NSData,
            client_data_hash: &NSData,
            authenticator_data: &NSData,
            credential_id: &NSData,
            extension_output: Option<&ASPasskeyAssertionCredentialExtensionOutput>,
        ) -> Retained<Self>;

        /// Creates and initializes a new ASPasskeyCredential object.
        ///
        /// Parameter `userHandle`: The identifier for the account the passkey is associated with.
        ///
        /// Parameter `relyingParty`: the relying party.
        ///
        /// Parameter `signature`: the signature for the assertion challenge.
        #[unsafe(method(credentialWithUserHandle:relyingParty:signature:clientDataHash:authenticatorData:credentialID:))]
        #[unsafe(method_family = none)]
        pub unsafe fn credentialWithUserHandle_relyingParty_signature_clientDataHash_authenticatorData_credentialID(
            user_handle: &NSData,
            relying_party: &NSString,
            signature: &NSData,
            client_data_hash: &NSData,
            authenticator_data: &NSData,
            credential_id: &NSData,
        ) -> Retained<Self>;

        /// The user handle of this passkey.
        #[unsafe(method(userHandle))]
        #[unsafe(method_family = none)]
        pub unsafe fn userHandle(&self) -> Retained<NSData>;

        /// The relying party of this credential.
        #[unsafe(method(relyingParty))]
        #[unsafe(method_family = none)]
        pub unsafe fn relyingParty(&self) -> Retained<NSString>;

        /// The signature of this credential.
        #[unsafe(method(signature))]
        #[unsafe(method_family = none)]
        pub unsafe fn signature(&self) -> Retained<NSData>;

        /// The hash of the client data for this assertion result.
        #[unsafe(method(clientDataHash))]
        #[unsafe(method_family = none)]
        pub unsafe fn clientDataHash(&self) -> Retained<NSData>;

        /// The authenticator data of the application that created this credential.
        #[unsafe(method(authenticatorData))]
        #[unsafe(method_family = none)]
        pub unsafe fn authenticatorData(&self) -> Retained<NSData>;

        /// The raw credential ID for this passkey credential.
        #[unsafe(method(credentialID))]
        #[unsafe(method_family = none)]
        pub unsafe fn credentialID(&self) -> Retained<NSData>;

        #[cfg(feature = "ASPasskeyAssertionCredentialExtensionOutput")]
        /// The outputs of WebAuthn extensions processed by the credential provider.
        #[unsafe(method(extensionOutput))]
        #[unsafe(method_family = none)]
        pub unsafe fn extensionOutput(
            &self,
        ) -> Option<Retained<ASPasskeyAssertionCredentialExtensionOutput>>;

        #[cfg(feature = "ASPasskeyAssertionCredentialExtensionOutput")]
        /// Setter for [`extensionOutput`][Self::extensionOutput].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setExtensionOutput:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setExtensionOutput(
            &self,
            extension_output: Option<&ASPasskeyAssertionCredentialExtensionOutput>,
        );
    );
}

/// Methods declared on superclass `NSObject`.
impl ASPasskeyAssertionCredential {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}