From 5f87584176257400709fde441aab585da7fff704 Mon Sep 17 00:00:00 2001 From: Nick Zana Date: Wed, 10 May 2023 14:10:10 -0400 Subject: [PATCH] ctap2-proto: Replace unecessary owned types with references in make::Request Remove IndexMap in favor of borrowed slices for make::Request fields Update imports --- crates/ctap2-proto/Cargo.toml | 1 - .../src/authenticator/credential/make.rs | 19 ++++++++----------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/crates/ctap2-proto/Cargo.toml b/crates/ctap2-proto/Cargo.toml index 7b045f7..4e272c3 100644 --- a/crates/ctap2-proto/Cargo.toml +++ b/crates/ctap2-proto/Cargo.toml @@ -10,7 +10,6 @@ fido-common = { path = "../fido-common" } bounded-integer = { version = "0.5.3", features = ["types", "std"] } bounded-vec = "0.7.1" coset = "0.3.3" -indexmap = "1.9.2" serde = { version = "1.0", features = ["derive"], optional = true } [features] diff --git a/crates/ctap2-proto/src/authenticator/credential/make.rs b/crates/ctap2-proto/src/authenticator/credential/make.rs index 0a9eff7..809dd24 100644 --- a/crates/ctap2-proto/src/authenticator/credential/make.rs +++ b/crates/ctap2-proto/src/authenticator/credential/make.rs @@ -1,9 +1,5 @@ -use crate::{ - attestation, - authenticator::{self, client_pin, Sha256Hash}, -}; -use fido_common::credential::public_key; -use indexmap::IndexSet; +use crate::authenticator::{self, client_pin, Sha256Hash}; +use fido_common::{credential::public_key, extension}; use std::collections::HashMap; pub enum Error { @@ -25,6 +21,7 @@ pub enum Error { /// > The following option keys are defined for use in /// > `authenticatorMakeCredential`'s `options` parameter. +#[derive(Clone, Copy, PartialEq, Eq, Hash)] pub enum OptionKey { /// > Specifies whether this credential is to be discoverable or /// > not. @@ -51,10 +48,10 @@ pub struct Request<'a> { /// > ... describes the user account to which the new public key /// > credential will be associated at the RP. pub user: &'a public_key::UserEntity, - /// > [Set] of supported algorithms for credential generation, as + /// > List of supported algorithms for credential generation, as /// > specified in [WebAuthn]. The array is ordered from most preferred - /// > to least preferred... - pub public_key_credential_params: &'a IndexSet, + /// > to least preferred and MUST NOT include duplicate entries. + pub public_key_credential_params: &'a [public_key::Parameters], /// > An array of PublicKeyCredentialDescriptor structures, as specified /// > in [WebAuthn]. The authenticator returns an error if the /// > authenticator already contains one of the credentials enumerated @@ -63,7 +60,7 @@ pub struct Request<'a> { pub exclude_list: Option<&'a [&'a public_key::Descriptor]>, /// > Parameters to influence authenticator operation, as specified in /// > [WebAuthn]. These parameters might be authenticator specific. - pub extensions: Option<&'a HashMap>>, + pub extensions: Option<&'a HashMap>>, pub options: Option<&'a HashMap>, pub pin_uv_auth_param: &'a [u8], /// > PIN/UV protocol version selected by platform. @@ -80,7 +77,7 @@ pub struct Request<'a> { /// > attestation batching may not apply to the results of this operation /// > and the platform is requesting an enterprise attestation that includes /// > uniquely identifying information. - pub enterprise_attestation: Option, + pub enterprise_attestation: Option, } pub struct Response {