adds Eq to PartialEq (#477)
This commit is contained in:
@@ -29,7 +29,7 @@ use sk_cbor::{cbor_array_vec, cbor_map, cbor_map_options, destructure_cbor_map};
|
||||
const ES256_ALGORITHM: i64 = -7;
|
||||
|
||||
// https://www.w3.org/TR/webauthn/#dictdef-publickeycredentialrpentity
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "fuzz", derive(Arbitrary))]
|
||||
pub struct PublicKeyCredentialRpEntity {
|
||||
pub rp_id: String,
|
||||
@@ -72,7 +72,7 @@ impl From<PublicKeyCredentialRpEntity> for cbor::Value {
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/webauthn/#dictdef-publickeycredentialuserentity
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "fuzz", derive(Arbitrary))]
|
||||
pub struct PublicKeyCredentialUserEntity {
|
||||
pub user_id: Vec<u8>,
|
||||
@@ -120,7 +120,7 @@ impl From<PublicKeyCredentialUserEntity> for cbor::Value {
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/webauthn/#enumdef-publickeycredentialtype
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "fuzz", derive(Arbitrary))]
|
||||
pub enum PublicKeyCredentialType {
|
||||
PublicKey,
|
||||
@@ -153,7 +153,7 @@ impl TryFrom<cbor::Value> for PublicKeyCredentialType {
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/webauthn/#dictdef-publickeycredentialparameters
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "fuzz", derive(Arbitrary))]
|
||||
pub struct PublicKeyCredentialParameter {
|
||||
pub cred_type: PublicKeyCredentialType,
|
||||
@@ -187,7 +187,7 @@ impl From<PublicKeyCredentialParameter> for cbor::Value {
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/webauthn/#enumdef-authenticatortransport
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
#[cfg_attr(test, derive(IntoEnumIterator))]
|
||||
#[cfg_attr(feature = "fuzz", derive(Arbitrary))]
|
||||
pub enum AuthenticatorTransport {
|
||||
@@ -225,7 +225,7 @@ impl TryFrom<cbor::Value> for AuthenticatorTransport {
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/webauthn/#dictdef-publickeycredentialdescriptor
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "fuzz", derive(Arbitrary))]
|
||||
pub struct PublicKeyCredentialDescriptor {
|
||||
pub key_type: PublicKeyCredentialType,
|
||||
@@ -277,7 +277,7 @@ impl From<PublicKeyCredentialDescriptor> for cbor::Value {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq)]
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "fuzz", derive(Arbitrary))]
|
||||
pub struct MakeCredentialExtensions {
|
||||
pub hmac_secret: bool,
|
||||
@@ -323,7 +323,7 @@ impl TryFrom<cbor::Value> for MakeCredentialExtensions {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq)]
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
||||
pub struct GetAssertionExtensions {
|
||||
pub hmac_secret: Option<GetAssertionHmacSecretInput>,
|
||||
pub cred_blob: bool,
|
||||
@@ -360,7 +360,7 @@ impl TryFrom<cbor::Value> for GetAssertionExtensions {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct GetAssertionHmacSecretInput {
|
||||
pub key_agreement: CoseKey,
|
||||
pub salt_enc: Vec<u8>,
|
||||
@@ -396,7 +396,7 @@ impl TryFrom<cbor::Value> for GetAssertionHmacSecretInput {
|
||||
}
|
||||
|
||||
// Even though options are optional, we can use the default if not present.
|
||||
#[derive(Clone, Debug, Default, PartialEq)]
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "fuzz", derive(Arbitrary))]
|
||||
pub struct MakeCredentialOptions {
|
||||
pub rk: bool,
|
||||
@@ -433,7 +433,7 @@ impl TryFrom<cbor::Value> for MakeCredentialOptions {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub struct GetAssertionOptions {
|
||||
pub up: bool,
|
||||
pub uv: bool,
|
||||
@@ -478,7 +478,7 @@ impl TryFrom<cbor::Value> for GetAssertionOptions {
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/webauthn/#packed-attestation
|
||||
#[derive(Debug, PartialEq)]
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub struct PackedAttestationStatement {
|
||||
pub alg: i64,
|
||||
pub sig: Vec<u8>,
|
||||
@@ -497,7 +497,7 @@ impl From<PackedAttestationStatement> for cbor::Value {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "fuzz", derive(Arbitrary))]
|
||||
pub enum SignatureAlgorithm {
|
||||
ES256 = ES256_ALGORITHM as isize,
|
||||
@@ -524,7 +524,7 @@ impl TryFrom<cbor::Value> for SignatureAlgorithm {
|
||||
}
|
||||
|
||||
/// The credProtect extension's policies for resident credentials.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd)]
|
||||
#[cfg_attr(test, derive(IntoEnumIterator))]
|
||||
#[allow(clippy::enum_variant_names)]
|
||||
#[cfg_attr(feature = "fuzz", derive(Arbitrary))]
|
||||
@@ -563,7 +563,7 @@ impl TryFrom<cbor::Value> for CredentialProtectionPolicy {
|
||||
//
|
||||
// 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.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct PublicKeyCredentialSource {
|
||||
// TODO function to convert to / from Vec<u8>
|
||||
pub key_type: PublicKeyCredentialType,
|
||||
@@ -701,7 +701,7 @@ impl PublicKeyCredentialSource {
|
||||
}
|
||||
|
||||
// The COSE key is used for both ECDH and ECDSA public keys for transmission.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct CoseKey {
|
||||
x_bytes: [u8; ecdh::NBYTES],
|
||||
y_bytes: [u8; ecdh::NBYTES],
|
||||
@@ -853,7 +853,7 @@ impl TryFrom<CoseKey> for ecdsa::PubKey {
|
||||
/// Data structure for receiving a signature.
|
||||
///
|
||||
/// See https://datatracker.ietf.org/doc/html/rfc8152#appendix-C.1.1 for reference.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct CoseSignature {
|
||||
pub algorithm: SignatureAlgorithm,
|
||||
pub bytes: [u8; ecdsa::Signature::BYTES_LENGTH],
|
||||
@@ -895,7 +895,7 @@ impl TryFrom<CoseSignature> for ecdsa::Signature {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "fuzz", derive(Arbitrary))]
|
||||
pub enum PinUvAuthProtocol {
|
||||
V1 = 1,
|
||||
@@ -914,7 +914,7 @@ impl TryFrom<cbor::Value> for PinUvAuthProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
#[cfg_attr(test, derive(IntoEnumIterator))]
|
||||
pub enum ClientPinSubCommand {
|
||||
GetPinRetries = 0x01,
|
||||
@@ -952,7 +952,7 @@ impl TryFrom<cbor::Value> for ClientPinSubCommand {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
#[cfg_attr(test, derive(IntoEnumIterator))]
|
||||
pub enum ConfigSubCommand {
|
||||
EnableEnterpriseAttestation = 0x01,
|
||||
@@ -982,7 +982,7 @@ impl TryFrom<cbor::Value> for ConfigSubCommand {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub enum ConfigSubCommandParams {
|
||||
SetMinPinLength(SetMinPinLengthParams),
|
||||
}
|
||||
@@ -997,7 +997,7 @@ impl From<ConfigSubCommandParams> for cbor::Value {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct SetMinPinLengthParams {
|
||||
pub new_min_pin_length: Option<u8>,
|
||||
pub min_pin_length_rp_ids: Option<Vec<String>>,
|
||||
@@ -1052,7 +1052,7 @@ impl From<SetMinPinLengthParams> for cbor::Value {
|
||||
}
|
||||
|
||||
/// The level of enterprise attestation allowed in MakeCredential.
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum EnterpriseAttestationMode {
|
||||
/// Enterprise attestation is restricted to a list of RP IDs. Add your
|
||||
/// enterprises domain, e.g. "example.com", to the list below.
|
||||
@@ -1074,7 +1074,7 @@ impl TryFrom<u64> for EnterpriseAttestationMode {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
#[cfg_attr(test, derive(IntoEnumIterator))]
|
||||
pub enum CredentialManagementSubCommand {
|
||||
GetCredsMetadata = 0x01,
|
||||
@@ -1110,7 +1110,7 @@ impl TryFrom<cbor::Value> for CredentialManagementSubCommand {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct CredentialManagementSubCommandParameters {
|
||||
pub rp_id_hash: Option<Vec<u8>>,
|
||||
pub credential_id: Option<PublicKeyCredentialDescriptor>,
|
||||
|
||||
Reference in New Issue
Block a user