ctap2-proto: Replace unecessary owned types with references in make::Request

Remove IndexMap in favor of borrowed slices for make::Request fields
Update imports
dev
Nick Zana 2 years ago
parent 5cc976afbd
commit 5f87584176
No known key found for this signature in database
GPG Key ID: 936524EE913D6538

@ -10,7 +10,6 @@ fido-common = { path = "../fido-common" }
bounded-integer = { version = "0.5.3", features = ["types", "std"] } bounded-integer = { version = "0.5.3", features = ["types", "std"] }
bounded-vec = "0.7.1" bounded-vec = "0.7.1"
coset = "0.3.3" coset = "0.3.3"
indexmap = "1.9.2"
serde = { version = "1.0", features = ["derive"], optional = true } serde = { version = "1.0", features = ["derive"], optional = true }
[features] [features]

@ -1,9 +1,5 @@
use crate::{ use crate::authenticator::{self, client_pin, Sha256Hash};
attestation, use fido_common::{credential::public_key, extension};
authenticator::{self, client_pin, Sha256Hash},
};
use fido_common::credential::public_key;
use indexmap::IndexSet;
use std::collections::HashMap; use std::collections::HashMap;
pub enum Error { pub enum Error {
@ -25,6 +21,7 @@ pub enum Error {
/// > The following option keys are defined for use in /// > The following option keys are defined for use in
/// > `authenticatorMakeCredential`'s `options` parameter. /// > `authenticatorMakeCredential`'s `options` parameter.
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
pub enum OptionKey { pub enum OptionKey {
/// > Specifies whether this credential is to be discoverable or /// > Specifies whether this credential is to be discoverable or
/// > not. /// > not.
@ -51,10 +48,10 @@ pub struct Request<'a> {
/// > ... describes the user account to which the new public key /// > ... describes the user account to which the new public key
/// > credential will be associated at the RP. /// > credential will be associated at the RP.
pub user: &'a public_key::UserEntity, 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 /// > specified in [WebAuthn]. The array is ordered from most preferred
/// > to least preferred... /// > to least preferred and MUST NOT include duplicate entries.
pub public_key_credential_params: &'a IndexSet<public_key::Parameters>, pub public_key_credential_params: &'a [public_key::Parameters],
/// > An array of PublicKeyCredentialDescriptor structures, as specified /// > An array of PublicKeyCredentialDescriptor structures, as specified
/// > in [WebAuthn]. The authenticator returns an error if the /// > in [WebAuthn]. The authenticator returns an error if the
/// > authenticator already contains one of the credentials enumerated /// > 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]>, pub exclude_list: Option<&'a [&'a public_key::Descriptor]>,
/// > Parameters to influence authenticator operation, as specified in /// > Parameters to influence authenticator operation, as specified in
/// > [WebAuthn]. These parameters might be authenticator specific. /// > [WebAuthn]. These parameters might be authenticator specific.
pub extensions: Option<&'a HashMap<fido_common::extension::Identifier, Vec<u8>>>, pub extensions: Option<&'a HashMap<extension::Identifier, Vec<u8>>>,
pub options: Option<&'a HashMap<OptionKey, bool>>, pub options: Option<&'a HashMap<OptionKey, bool>>,
pub pin_uv_auth_param: &'a [u8], pub pin_uv_auth_param: &'a [u8],
/// > PIN/UV protocol version selected by platform. /// > 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 /// > attestation batching may not apply to the results of this operation
/// > and the platform is requesting an enterprise attestation that includes /// > and the platform is requesting an enterprise attestation that includes
/// > uniquely identifying information. /// > uniquely identifying information.
pub enterprise_attestation: Option<attestation::enterprise::Kind>, pub enterprise_attestation: Option<crate::attestation::enterprise::Kind>,
} }
pub struct Response { pub struct Response {

Loading…
Cancel
Save