From 6e7d134b6d076f488384336103a11ce641f968a6 Mon Sep 17 00:00:00 2001 From: Nick Zana Date: Tue, 16 May 2023 13:44:55 -0400 Subject: [PATCH] fido-common: Replace authenticator data bools with enums Replaces authenticator::Data's user_is_verified and user_is_present boolean flags with clearer UserVerification and UserPresence enums. --- crates/fido-common/src/authenticator.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/crates/fido-common/src/authenticator.rs b/crates/fido-common/src/authenticator.rs index 60932d2..664ea15 100644 --- a/crates/fido-common/src/authenticator.rs +++ b/crates/fido-common/src/authenticator.rs @@ -2,6 +2,17 @@ use crate::{attestation, extensions, Sha256Hash}; use std::collections::BTreeMap; pub enum Flags {} +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum UserPresence { + Present, + NotPresent, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum UserVerification { + Verified, + NotVerified, +} /// > The authenticator data structure encodes contextual bindings made by the /// > authenticator. These bindings are controlled by the authenticator itself, @@ -16,8 +27,8 @@ pub enum Flags {} pub struct Data { /// > SHA-256 hash of the RP ID the credential is scoped to. pub relying_party_id_hash: Sha256Hash, - pub user_is_present: bool, - pub user_is_verified: bool, + pub user_presence: UserPresence, + pub user_verification: UserVerification, pub signature_counter: u32, pub attested_credential_data: Option, pub extensions: Option>>,