From 8bf52aa842deda468369a74f6611e5bba2ae4c71 Mon Sep 17 00:00:00 2001 From: Nick Zana Date: Wed, 17 May 2023 23:18:46 -0400 Subject: [PATCH] ctap2-proto: Derive Deserialize for authenticator::assertion::get::Response --- .../ctap2-proto/src/authenticator/assertion/get.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/crates/ctap2-proto/src/authenticator/assertion/get.rs b/crates/ctap2-proto/src/authenticator/assertion/get.rs index 980b4b4..7dcbe78 100644 --- a/crates/ctap2-proto/src/authenticator/assertion/get.rs +++ b/crates/ctap2-proto/src/authenticator/assertion/get.rs @@ -73,31 +73,45 @@ pub struct Request<'a> { } /// Response structure for [`Ctap2Device::get_assertion`] operation. +#[cfg_eval] #[derive(Debug, Clone)] +#[cfg_attr( + feature = "serde", + serde_as, + skip_serializing_none, + derive(Deserialize) +)] pub struct Response { /// > PublicKeyCredentialDescriptor structure containing the credential /// > identifier whose private key was used to generate the assertion. + #[serde(rename = 0x01)] pub credential: public_key::Descriptor, /// > The signed-over contextual bindings made by the authenticator, as /// > specified in [WebAuthn]. + #[cfg_attr(feature = "serde", serde_as(as = "Bytes"), serde(rename = 0x02))] pub auth_data: Vec, /// > The assertion signature produced by the authenticator, as /// > specified in [WebAuthn]. + #[cfg_attr(feature = "serde", serde_as(as = "Bytes"), serde(rename = 0x03))] pub signature: Vec, /// > [`public_key::UserEntity`] structure containing the user account /// > information + #[serde(rename = 0x04)] pub user: Option, /// > Total number of account credentials for the RP. Optional; defaults /// > 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 /// > the UV & UP flags are false. + #[serde(rename = 0x05)] pub number_of_credentials: Option, /// > Indicates that a credential was selected by the user via /// > interaction directly with the authenticator, and thus the platform /// > does not need to confirm the credential. + #[serde(rename = 0x06)] pub user_selected: Option, /// > The contents of the associated `largeBlobKey` if present for the /// > asserted credential, and if `largeBlobKey` was true in the /// > extensions input. + #[cfg_attr(feature = "serde", serde_as(as = "Option"), serde(rename = 0x07))] pub large_blob_key: Option>, }