use serde::{Deserialize, Serialize};
#[cfg(feature = "typeshare")]
use typeshare::typeshare;
use crate::{Bytes, utils::serde::ignore_unknown};
mod assertion;
mod attestation;
mod common;
mod extensions;
mod well_known;
pub use self::{assertion::*, attestation::*, common::*, extensions::*, well_known::*};
mod sealed {
pub trait Sealed {}
impl Sealed for super::AuthenticatorAssertionResponse {}
impl Sealed for super::AuthenticatorAttestationResponse {}
}
pub trait AuthenticatorResponse: sealed::Sealed {}
impl AuthenticatorResponse for AuthenticatorAssertionResponse {}
impl AuthenticatorResponse for AuthenticatorAttestationResponse {}
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
feature = "typeshare",
typeshare(
swift = "Equatable, Hashable",
swiftGenericConstraints = "R: Equatable & Hashable"
)
)]
pub struct PublicKeyCredential<R: AuthenticatorResponse> {
pub id: String,
pub raw_id: Bytes,
#[serde(rename = "type")]
pub ty: PublicKeyCredentialType,
pub response: R,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "ignore_unknown"
)]
pub authenticator_attachment: Option<AuthenticatorAttachment>,
#[serde(default)]
pub client_extension_results: AuthenticationExtensionsClientOutputs,
}