From d5a4a03c0dc7a73e15fbf76261386753843917c9 Mon Sep 17 00:00:00 2001 From: Nick Zana Date: Thu, 25 May 2023 23:33:13 -0400 Subject: [PATCH] fido-common: derives comparison traits for several types Derives PartialOrd and Ord for credential::public_key::Parameters Derives PartialEq, Eq, PartialOrd and Ord for credential::public_key::UserEntity Also derives clone and copy for some types. --- crates/fido-common/src/credential/public_key.rs | 6 +++--- crates/fido-common/src/extensions.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/fido-common/src/credential/public_key.rs b/crates/fido-common/src/credential/public_key.rs index 75b2699..66e98e4 100644 --- a/crates/fido-common/src/credential/public_key.rs +++ b/crates/fido-common/src/credential/public_key.rs @@ -34,7 +34,7 @@ pub(crate) mod algorithm { /// > This dictionary is used to supply additional parameters when /// > creating a new credential. #[cfg_eval] -#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct Parameters { /// > This member specifies the type of credential to be @@ -52,7 +52,7 @@ pub struct Parameters { /// > This dictionary identifies a specific public key credential. #[cfg_eval] -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr( feature = "serde", serde_as, @@ -118,7 +118,7 @@ pub struct UserEntity { /// > This `PublicKeyCredentialRpEntity` data structure describes a Relying /// > Party with which the new public key credential will be associated. -#[derive(Debug)] +#[derive(Debug, Clone)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct RelyingPartyEntity { /// > A unique identifier for the Relying Party entity. diff --git a/crates/fido-common/src/extensions.rs b/crates/fido-common/src/extensions.rs index e124dfb..9a1a23c 100644 --- a/crates/fido-common/src/extensions.rs +++ b/crates/fido-common/src/extensions.rs @@ -21,7 +21,7 @@ use serde::{Deserialize, Serialize}; /// > Extensions that may exist in multiple versions should take care to include /// > a version in their identifier. In effect, different versions are thus /// > treated as different extensions, e.g., `myCompany_extension_01` -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub enum Identifier { #[cfg_attr(feature = "serde", serde(rename = "appid"))]