Merge pull request #479 from ia0/no_eq

Only derive PartialEq and Eq for PrivateKey for tests
This commit is contained in:
Julien Cretin
2022-05-17 23:48:24 +02:00
committed by GitHub
2 changed files with 5 additions and 2 deletions

View File

@@ -89,7 +89,9 @@ pub fn aes256_cbc_decrypt(
} }
/// An asymmetric private key that can sign messages. /// An asymmetric private key that can sign messages.
#[derive(Clone, Debug, PartialEq, Eq)] #[derive(Clone, Debug)]
// We shouldn't compare private keys in prod without constant-time operations.
#[cfg_attr(test, derive(PartialEq, Eq))]
pub enum PrivateKey { pub enum PrivateKey {
Ecdsa(ecdsa::SecKey), Ecdsa(ecdsa::SecKey),
} }

View File

@@ -571,7 +571,8 @@ impl TryFrom<cbor::Value> for CredentialProtectionPolicy {
// //
// Note that we only use the WebAuthn definition as an example. This data-structure is not specified // Note that we only use the WebAuthn definition as an example. This data-structure is not specified
// by FIDO. In particular we may choose how we serialize and deserialize it. // by FIDO. In particular we may choose how we serialize and deserialize it.
#[derive(Clone, Debug, PartialEq, Eq)] #[derive(Clone, Debug)]
#[cfg_attr(test, derive(PartialEq, Eq))]
pub struct PublicKeyCredentialSource { pub struct PublicKeyCredentialSource {
pub key_type: PublicKeyCredentialType, pub key_type: PublicKeyCredentialType,
pub credential_id: Vec<u8>, pub credential_id: Vec<u8>,