From 5cc976afbd80f4931c6d996b9ee87970febf5af1 Mon Sep 17 00:00:00 2001 From: Nick Zana Date: Wed, 10 May 2023 14:05:37 -0400 Subject: [PATCH] ctap2_proto: Add a from method to Aaguid type --- crates/ctap2-proto/src/authenticator/device.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/crates/ctap2-proto/src/authenticator/device.rs b/crates/ctap2-proto/src/authenticator/device.rs index b01c091..ce298f1 100644 --- a/crates/ctap2-proto/src/authenticator/device.rs +++ b/crates/ctap2-proto/src/authenticator/device.rs @@ -17,7 +17,13 @@ pub struct UsizeN(bounded_integer::BoundedUsize different values mean they refer to different authenticator models. pub struct Aaguid([u8; 16]); -#[derive(Hash)] +impl Aaguid { + pub const fn from(bytes: [u8; 16]) -> Self { + Self(bytes) + } +} + +#[derive(Debug, Hash, PartialEq, Eq, Clone, Copy)] pub enum Version { Fido2_1, Fido2_0, @@ -102,6 +108,7 @@ pub enum FidoLevel { } /// These options describe properties of a CTAP device. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum OptionId { /// > Indicates that the device is attached to the client and therefore /// > can’t be removed and used on another client. @@ -193,8 +200,7 @@ pub struct Info { /// > Maximum message size supported by the authenticator. pub max_message_size: Option, /// > List of supported PIN/UV auth protocols in order of decreasing - /// > authenticator preference. MUST NOT contain duplicate values nor be - /// > empty if present. + /// > authenticator preference. MUST NOT contain duplicate values... pub pin_uv_auth_protocols: Option>, /// > Maximum number of credentials supported in credentialID list at a time /// > by the authenticator.