Repository: google/OpenSK
File: src/ctap/response.rs (Rust)

Code before:
            0x04 => user,
            0x05 => number_of_credentials,
            0x07 => large_blob_key,
        }
    }
}

#[derive(Debug, PartialEq)]
pub struct AuthenticatorGetInfoResponse {
    pub versions: Vec<String>,
    pub extensions: Option<Vec<String>>,
    pub aaguid: [u8; 16],
    pub options: Option<BTreeMap<String, bool>>,
    pub max_msg_size: Option<u64>,
    pub pin_protocols: Option<Vec<u64>>,
    pub max_credential_count_in_list: Option<u64>,
    pub max_credential_id_length: Option<u64>,
    pub transports: Option<Vec<AuthenticatorTransport>>,
    pub algorithms: Option<Vec<PublicKeyCredentialParameter>>,
    pub max_serialized_large_blob_array: Option<u64>,
    pub force_pin_change: Option<bool>,
    pub min_pin_length: u8,
    pub firmware_version: Option<u64>,
    pub max_cred_blob_length: Option<u64>,
    pub max_rp_ids_for_set_min_pin_length: Option<u64>,
    // Missing response fields as they are only relevant for internal UV:
    // - 0x11: preferredPlatformUvAttempts
    // - 0x12: uvModality
    pub certifications: Option<BTreeMap<String, i64>>,
    pub remaining_discoverable_credentials: Option<u64>,
    // - 0x15: vendorPrototypeConfigCommands missing as we don't support it.
}

impl From<AuthenticatorGetInfoResponse> for cbor::Value {
    fn from(get_info_response: AuthenticatorGetInfoResponse) -> Self {
        let AuthenticatorGetInfoResponse {
            versions,
            extensions,
            aaguid,
            options,
            max_msg_size,
            pin_protocols,
            max_credential_count_in_list,
            max_credential_id_length,
            transports,
            algorithms,
            max_serialized_large_blob_array,
            force_pin_change,
            min_pin_length,
            firmware_version,
            max_cred_blob_length,

Review comment (security):
nit: I found the "internal" here a bit confusing even though that's the term used in FIDO Registry. But I can't think about an ideal adjective. Maybe "built-in" would more reflect that UV is fully executed within the authenticator boundaries?

Code after:
            0x04 => user,
            0x05 => number_of_credentials,
            0x07 => large_blob_key,
        }
    }
}

#[derive(Debug, PartialEq)]
pub struct AuthenticatorGetInfoResponse {
    pub versions: Vec<String>,
    pub extensions: Option<Vec<String>>,
    pub aaguid: [u8; 16],
    pub options: Option<BTreeMap<String, bool>>,
    pub max_msg_size: Option<u64>,
    pub pin_protocols: Option<Vec<u64>>,
    pub max_credential_count_in_list: Option<u64>,
    pub max_credential_id_length: Option<u64>,
    pub transports: Option<Vec<AuthenticatorTransport>>,
    pub algorithms: Option<Vec<PublicKeyCredentialParameter>>,
    pub max_serialized_large_blob_array: Option<u64>,
    pub force_pin_change: Option<bool>,
    pub min_pin_length: u8,
    pub firmware_version: Option<u64>,
    pub max_cred_blob_length: Option<u64>,
    pub max_rp_ids_for_set_min_pin_length: Option<u64>,
    // Missing response fields as they are only relevant for internal UV:
    // - 0x11: preferredPlatformUvAttempts
    // - 0x12: uvModality
    // Add them when your hardware supports any kind of user verification within
    // the boundary of the device, e.g. fingerprint or built-in keyboard.
    pub certifications: Option<BTreeMap<String, i64>>,
    pub remaining_discoverable_credentials: Option<u64>,
    // - 0x15: vendorPrototypeConfigCommands missing as we don't support it.
}

impl From<AuthenticatorGetInfoResponse> for cbor::Value {
    fn from(get_info_response: AuthenticatorGetInfoResponse) -> Self {
        let AuthenticatorGetInfoResponse {
            versions,
            extensions,
            aaguid,
            options,
            max_msg_size,
            pin_protocols,
            max_credential_count_in_list,
            max_credential_id_length,
            transports,
            algorithms,
            max_serialized_large_blob_array,
            force_pin_change,
            min_pin_length,