ctap2-proto: Derive Deserialize for authenticator::assertion::get::Response

main
Nick Zana 2 years ago
parent eb4ccf34a3
commit 8bf52aa842

@ -73,31 +73,45 @@ pub struct Request<'a> {
} }
/// Response structure for [`Ctap2Device::get_assertion`] operation. /// Response structure for [`Ctap2Device::get_assertion`] operation.
#[cfg_eval]
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
#[cfg_attr(
feature = "serde",
serde_as,
skip_serializing_none,
derive(Deserialize)
)]
pub struct Response { pub struct Response {
/// > PublicKeyCredentialDescriptor structure containing the credential /// > PublicKeyCredentialDescriptor structure containing the credential
/// > identifier whose private key was used to generate the assertion. /// > identifier whose private key was used to generate the assertion.
#[serde(rename = 0x01)]
pub credential: public_key::Descriptor, pub credential: public_key::Descriptor,
/// > The signed-over contextual bindings made by the authenticator, as /// > The signed-over contextual bindings made by the authenticator, as
/// > specified in [WebAuthn]. /// > specified in [WebAuthn].
#[cfg_attr(feature = "serde", serde_as(as = "Bytes"), serde(rename = 0x02))]
pub auth_data: Vec<u8>, pub auth_data: Vec<u8>,
/// > The assertion signature produced by the authenticator, as /// > The assertion signature produced by the authenticator, as
/// > specified in [WebAuthn]. /// > specified in [WebAuthn].
#[cfg_attr(feature = "serde", serde_as(as = "Bytes"), serde(rename = 0x03))]
pub signature: Vec<u8>, pub signature: Vec<u8>,
/// > [`public_key::UserEntity`] structure containing the user account /// > [`public_key::UserEntity`] structure containing the user account
/// > information /// > information
#[serde(rename = 0x04)]
pub user: Option<public_key::UserEntity>, pub user: Option<public_key::UserEntity>,
/// > Total number of account credentials for the RP. Optional; defaults /// > Total number of account credentials for the RP. Optional; defaults
/// > to one. This member is required when more than one credential is /// > to one. This member is required when more than one credential is
/// > found for an RP, and the authenticator does not have a display or /// > found for an RP, and the authenticator does not have a display or
/// > the UV & UP flags are false. /// > the UV & UP flags are false.
#[serde(rename = 0x05)]
pub number_of_credentials: Option<usize>, pub number_of_credentials: Option<usize>,
/// > Indicates that a credential was selected by the user via /// > Indicates that a credential was selected by the user via
/// > interaction directly with the authenticator, and thus the platform /// > interaction directly with the authenticator, and thus the platform
/// > does not need to confirm the credential. /// > does not need to confirm the credential.
#[serde(rename = 0x06)]
pub user_selected: Option<bool>, pub user_selected: Option<bool>,
/// > The contents of the associated `largeBlobKey` if present for the /// > The contents of the associated `largeBlobKey` if present for the
/// > asserted credential, and if `largeBlobKey` was true in the /// > asserted credential, and if `largeBlobKey` was true in the
/// > extensions input. /// > extensions input.
#[cfg_attr(feature = "serde", serde_as(as = "Option<Bytes>"), serde(rename = 0x07))]
pub large_blob_key: Option<Vec<u8>>, pub large_blob_key: Option<Vec<u8>>,
} }

Loading…
Cancel
Save