ctap2-proto: Derive serde traits for credential::make::OptionKey

main
Nick Zana 2 years ago
parent 12d6f7fe51
commit 573069afad

@ -5,6 +5,11 @@ use crate::{
use fido_common::{attestation, credential::public_key}; use fido_common::{attestation, credential::public_key};
use std::collections::BTreeMap; use std::collections::BTreeMap;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
#[cfg(feature = "serde")]
use serde_with::{serde_as, skip_serializing_none, Bytes};
#[derive(Debug)] #[derive(Debug)]
pub enum Error { pub enum Error {
OperationDenied, OperationDenied,
@ -26,17 +31,21 @@ 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(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)] #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
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.
#[cfg_attr(feature = "serde", serde(rename = "rk"))]
Discoverable, Discoverable,
/// > user presence: Instructs the authenticator to require user /// > user presence: Instructs the authenticator to require user
/// > consent /// > consent
/// > to complete the operation. /// > to complete the operation.
#[cfg_attr(feature = "serde", serde(rename = "up"))]
UserPresence, UserPresence,
/// > user verification: If true, instructs the authenticator to require a /// > user verification: If true, instructs the authenticator to require a
/// > user-verifying gesture in order to complete the request. Examples of /// > user-verifying gesture in order to complete the request. Examples of
/// > such gestures are fingerprint scan or a PIN. /// > such gestures are fingerprint scan or a PIN.
#[cfg_attr(feature = "serde", serde(rename = "uv"))]
UserVerification, UserVerification,
} }

Loading…
Cancel
Save