From 8133c7260ddd4cf95e1dbd761b734b6691e3377f Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Fri, 21 Jun 2024 18:49:34 +0200 Subject: [PATCH] Add unsigned extension outputs --- CHANGELOG.md | 1 + src/ctap2/get_assertion.rs | 7 +++++++ src/ctap2/get_info.rs | 2 +- src/ctap2/make_credential.rs | 11 +++++++++-- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 474cd7e..fd280e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add support for CTAP 2.2 ([#38](https://github.com/trussed-dev/ctap-types/issues/38)) - Add support for the `thirdPartyPayment` extension - Add new fields to `get_info` + - Add unsigned extension outputs to `make_credential` and `get_assertion` ## [0.2.0] - 2024-06-21 diff --git a/src/ctap2/get_assertion.rs b/src/ctap2/get_assertion.rs index 665f990..ff5e80a 100644 --- a/src/ctap2/get_assertion.rs +++ b/src/ctap2/get_assertion.rs @@ -122,6 +122,8 @@ pub struct Response { /// See https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#sctn-getAssert-authnr-alg #[serde(skip_serializing_if = "Option::is_none")] pub large_blob_key: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + pub unsigned_extension_outputs: Option, } #[derive(Debug)] @@ -142,6 +144,11 @@ impl ResponseBuilder { number_of_credentials: None, user_selected: None, large_blob_key: None, + unsigned_extension_outputs: None, } } } + +#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)] +#[non_exhaustive] +pub struct UnsignedExtensionOutputs {} diff --git a/src/ctap2/get_info.rs b/src/ctap2/get_info.rs index 6d9a9ba..7e30b77 100644 --- a/src/ctap2/get_info.rs +++ b/src/ctap2/get_info.rs @@ -120,7 +120,7 @@ pub struct Response { // FIDO_2_2 #[cfg(feature = "get-info-full")] #[serde(skip_serializing_if = "Option::is_none")] - pub attestation_formats: Option<()>, + pub attestation_formats: Option>, // 0x17 // FIDO_2_2 diff --git a/src/ctap2/make_credential.rs b/src/ctap2/make_credential.rs index 9abe360..4ef1441 100644 --- a/src/ctap2/make_credential.rs +++ b/src/ctap2/make_credential.rs @@ -118,6 +118,8 @@ pub struct Response { pub ep_att: Option, #[serde(skip_serializing_if = "Option::is_none")] pub large_blob_key: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + pub unsigned_extension_outputs: Option, } #[derive(Debug)] @@ -135,6 +137,7 @@ impl ResponseBuilder { att_stmt: None, ep_att: None, large_blob_key: None, + unsigned_extension_outputs: None, } } } @@ -148,9 +151,9 @@ pub enum AttestationStatement { Packed(PackedAttestationStatement), } -#[derive(Clone, Debug, Eq, PartialEq, Serialize)] +#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)] #[non_exhaustive] -#[serde(untagged)] +#[serde(rename_all = "lowercase")] pub enum AttestationStatementFormat { None, Packed, @@ -167,6 +170,10 @@ pub struct PackedAttestationStatement { pub x5c: Option, 1>>, } +#[derive(Clone, Debug, Eq, PartialEq, Serialize)] +#[non_exhaustive] +pub struct UnsignedExtensionOutputs {} + #[cfg(test)] mod tests { use super::*;