diff --git a/libwebauthn/src/proto/ctap1/model.rs b/libwebauthn/src/proto/ctap1/model.rs index 8919e467..ff6e12b1 100644 --- a/libwebauthn/src/proto/ctap1/model.rs +++ b/libwebauthn/src/proto/ctap1/model.rs @@ -12,20 +12,21 @@ use crate::webauthn::CtapError; #[derive(Debug, Clone, Copy)] pub enum Ctap1Transport { - BT, - BLE, - NFC, - USB, + Bt, + Ble, + Nfc, + Usb, } impl TryFrom<&Ctap2Transport> for Ctap1Transport { type Error = CtapError; fn try_from(ctap2: &Ctap2Transport) -> Result { match ctap2 { - Ctap2Transport::BLE => Ok(Ctap1Transport::BLE), - Ctap2Transport::USB => Ok(Ctap1Transport::USB), - Ctap2Transport::NFC => Ok(Ctap1Transport::NFC), - Ctap2Transport::INTERNAL => Err(CtapError::UnsupportedOption), + Ctap2Transport::Ble => Ok(Ctap1Transport::Ble), + Ctap2Transport::Usb => Ok(Ctap1Transport::Usb), + Ctap2Transport::Nfc => Ok(Ctap1Transport::Nfc), + Ctap2Transport::Internal => Err(CtapError::UnsupportedOption), + Ctap2Transport::Hybrid => Err(CtapError::UnsupportedOption), } } } diff --git a/libwebauthn/src/proto/ctap2/model.rs b/libwebauthn/src/proto/ctap2/model.rs index aad10b4c..a6bfa768 100644 --- a/libwebauthn/src/proto/ctap2/model.rs +++ b/libwebauthn/src/proto/ctap2/model.rs @@ -121,19 +121,20 @@ pub enum Ctap2PublicKeyCredentialType { #[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "lowercase")] pub enum Ctap2Transport { - BLE, - NFC, - USB, - INTERNAL, + Ble, + Nfc, + Usb, + Internal, + Hybrid, } impl From<&Ctap1Transport> for Ctap2Transport { fn from(ctap1: &Ctap1Transport) -> Ctap2Transport { match ctap1 { - Ctap1Transport::BT => Ctap2Transport::BLE, - Ctap1Transport::BLE => Ctap2Transport::BLE, - Ctap1Transport::USB => Ctap2Transport::USB, - Ctap1Transport::NFC => Ctap2Transport::NFC, + Ctap1Transport::Bt => Ctap2Transport::Ble, + Ctap1Transport::Ble => Ctap2Transport::Ble, + Ctap1Transport::Usb => Ctap2Transport::Usb, + Ctap1Transport::Nfc => Ctap2Transport::Nfc, } } } @@ -211,13 +212,13 @@ pub enum Ctap2UserVerificationOperation { mod tests { use crate::proto::ctap2::Ctap2PublicKeyCredentialDescriptor; - use super::{Ctap2CredentialType, Ctap2COSEAlgorithmIdentifier, Ctap2PublicKeyCredentialType}; + use super::{Ctap2COSEAlgorithmIdentifier, Ctap2CredentialType, Ctap2PublicKeyCredentialType}; + use hex; use serde_bytes::ByteBuf; use serde_cbor; - use hex; #[test] - /// Verify CBOR serialization conforms to CTAP canonical standard, including ordering (see #95) + /// Verify CBOR serialization conforms to CTAP canonical standard, including ordering (see #95) pub fn credential_type_field_serialization() { let credential_type = Ctap2CredentialType { algorithm: Ctap2COSEAlgorithmIdentifier::ES256, @@ -230,7 +231,7 @@ mod tests { } #[test] - /// Verify CBOR serialization conforms to CTAP canonical standard, including ordering (see #95) + /// Verify CBOR serialization conforms to CTAP canonical standard, including ordering (see #95) pub fn credential_descriptor_serialization() { let credential_descriptor = Ctap2PublicKeyCredentialDescriptor { id: ByteBuf::from(vec![0x42]), @@ -242,4 +243,4 @@ mod tests { let expected = hex::decode("a2626964414264747970656a7075626c69632d6b6579").unwrap(); assert_eq!(serialized, expected); } -} \ No newline at end of file +}