keyroost 0.13.0

Desktop GUI for managing hardware security keys: FIDO2, OATH, OpenPGP, PIV, and Token2 programmable TOTP tokens.
// crates/keyroost/src/ui/aaguid.rs
//
// AAGUID -> authenticator model name, for the FIDO hardware-key vendors keyroost
// targets (Yubico, Feitian, Nitrokey, SoloKeys/Somu, Token2, Google, OnlyKey).
//
// An AAGUID identifies a FIDO authenticator *series/profile*, not an exact SKU,
// so e.g. every YubiKey 5 with NFC reports "YubiKey 5 Series with NFC" rather
// than "5C NFC". The 16-byte AAGUID comes from authenticatorGetInfo; we refine
// a device's model with it once the key is read.
//
// Data is taken verbatim from the community-maintained FIDO AAGUID list
// (passkeydeveloper/passkey-authenticator-aaguids, combined_aaguid.json),
// filtered to the vendors above. Not exhaustive across all vendors by design.

/// Look up a model name for a 16-byte AAGUID (all-zero AAGUID => `None`).
pub fn model_for_aaguid(aaguid: &[u8; 16]) -> Option<&'static str> {
    if aaguid.iter().all(|&b| b == 0) {
        return None;
    }
    let key = format_aaguid(aaguid);
    MODELS
        .iter()
        .find(|(k, _)| *k == key)
        .map(|&(_, name)| name)
}

/// Format a 16-byte AAGUID as canonical lowercase `8-4-4-4-12` hex.
fn format_aaguid(a: &[u8; 16]) -> String {
    format_aaguid_pub(a)
}

/// Public canonical AAGUID formatter (lowercase `8-4-4-4-12`), shared with the
/// MDS lookup so both key on the identical string form.
pub fn format_aaguid_pub(a: &[u8; 16]) -> String {
    let mut s = String::with_capacity(36);
    for (i, b) in a.iter().enumerate() {
        if matches!(i, 4 | 6 | 8 | 10) {
            s.push('-');
        }
        s.push_str(&format!("{b:02x}"));
    }
    s
}

#[rustfmt::skip]
static MODELS: &[(&str, &str)] = &[
    ("12ded745-4bed-47d4-abaa-e713f51d6393", "Feitian AllinOne FIDO2 Authenticator"),
    ("77010bd7-212a-4fc9-b236-d2ca5e9d4084", "Feitian BioPass FIDO2 Authenticator"),
    ("a02140b7-0cbd-42e1-a9b5-a39da2545114", "Feitian BioPass FIDO2 Plus (Enterprise Profile)"),
    ("b6ede29c-3772-412c-8a78-539c1f4c62d2", "Feitian BioPass FIDO2 Plus Authenticator"),
    ("42df17de-06ba-4177-a2bb-6701be1380d6", "Feitian BioPass FIDO2 Plus Authenticator"),
    ("2bff89f2-323a-48fc-b7c8-9ff7fe87c07e", "Feitian BioPass FIDO2 Pro (Enterprise Profile)"),
    ("4c0cf95d-2f40-43b5-ba42-4c83a11c04ba", "Feitian BioPass FIDO2 Pro Authenticator"),
    ("12755c32-8ad1-46eb-881c-e0b38d848b09", "Feitian ePass FIDO Authenticator (CTAP2.1, CTAP2.0, U2F)"),
    ("39589099-9a75-49fc-afaa-801ca211c62a", "Feitian ePass FIDO-NFC (Enterprise Profile) (CTAP2.1, CTAP2.0, U2F)"),
    ("78ba3993-d784-4f44-8d6e-cc0a8ad5230e", "Feitian ePass FIDO-NFC(CTAP2.1, CTAP2.0, U2F)"),
    ("833b721a-ff5f-4d00-bb2e-bdda3ec01e29", "Feitian ePass FIDO2 Authenticator"),
    ("ee041bce-25e5-4cdb-8f86-897fd6418464", "Feitian ePass FIDO2-NFC Authenticator"),
    ("260e3021-482d-442d-838c-7edfbe153b7e", "Feitian ePass FIDO2-NFC Plus Authenticator"),
    ("234cd403-35a2-4cc2-8015-77ea280c77f5", "Feitian ePass FIDO2-NFC Series (CTAP2.1, CTAP2.0, U2F)"),
    ("2c0df832-92de-4be1-8412-88a8f074df4a", "Feitian FIDO Smart Card"),
    ("3e22415d-7fdf-4ea4-8a0c-dd60c4249b9d", "Feitian iePass FIDO Authenticator"),
    ("42b4fb4a-2866-43b2-9bf7-6c6669c2e5d3", "Google Titan Security Key v2"),
    ("2cd2f727-f6ca-44da-8f48-5c2e5da000a2", "Nitrokey 3 AM"),
    ("998f358b-2dd2-4cbe-a43a-e8107438dfb3", "OnlyKey Secp256R1 FIDO2 CTAP2 Authenticator"),
    ("f8a011f3-8c0a-4d15-8006-17111f9edc7d", "Security Key by Yubico"),
    ("b92c3f9a-c014-4056-887f-140a2501163b", "Security Key by Yubico"),
    ("149a2021-8ef6-4133-96b8-81f8d5b7f1f5", "Security Key by Yubico with NFC"),
    ("6d44ba9b-f6ec-2e49-b930-0c8fe920cb73", "Security Key by Yubico with NFC"),
    ("b7d3f68e-88a6-471e-9ecf-2df26d041ede", "Security Key NFC by Yubico"),
    ("a4e9fc6d-4cbe-4758-b8ba-37598bb5bbaa", "Security Key NFC by Yubico"),
    ("e77e3c64-05e3-428b-8824-0cbeb04b829d", "Security Key NFC by Yubico"),
    ("47ab2fb4-66ac-4184-9ae1-86be814012d5", "Security Key NFC by Yubico - Enterprise Edition"),
    ("ed042a3a-4b22-4455-bb69-a267b652ae7e", "Security Key NFC by Yubico - Enterprise Edition"),
    ("0bb43545-fd2c-4185-87dd-feb0b2916ace", "Security Key NFC by Yubico - Enterprise Edition"),
    ("9ff4cc65-6154-4fff-ba09-9e2af7882ad2", "Security Key NFC by Yubico - Enterprise Edition (Enterprise Profile)"),
    ("72c6b72d-8512-4c66-8359-9d3d10d9222f", "Security Key NFC by Yubico - Enterprise Edition (Enterprise Profile)"),
    ("2772ce93-eb4b-4090-8b73-330f48477d73", "Security Key NFC by Yubico - Enterprise Edition Preview"),
    ("760eda36-00aa-4d29-855b-4012a182cdeb", "Security Key NFC by Yubico Preview"),
    ("9876631b-d4a0-427f-5773-0ec71c9e0279", "Somu Secp256R1 FIDO2 CTAP2 Authenticator"),
    ("ab32f0c6-2239-afbb-c470-d2ef4e254db7", "TOKEN2 FIDO2 Security Key"),
    ("eabb46cc-e241-80bf-ae9e-96fa6d2975cf", "TOKEN2 PIN Plus Security Key Series"),
    ("3aa78eb1-ddd8-46a8-a821-8f8ec57a7bd5", "YubiKey 5 CCN Series with NFC"),
    ("eb7ef748-cbe0-4b40-b8f6-07bd2d592d35", "YubiKey 5 CCN Series with NFC (Consumer Profile)"),
    ("3ec9c8d3-a5a7-415b-a7b5-f1d606368d3f", "YubiKey 5 CCN Series with NFC (Enterprise Profile)"),
    ("4fc84f16-2545-4e53-b8fc-7bf4d7282a10", "YubiKey 5 CCN Series with NFC (Enterprise Profile)"),
    ("73bb0cd4-e502-49b8-9c6f-b59445bf720b", "YubiKey 5 FIPS Series"),
    ("57f7de54-c807-4eab-b1c6-1c9be7984e92", "YubiKey 5 FIPS Series"),
    ("905b4cb4-ed6f-4da9-92fc-45e0d4e9b5c7", "YubiKey 5 FIPS Series (Enterprise Profile)"),
    ("d2fbd093-ee62-488d-9dad-1e36389f8826", "YubiKey 5 FIPS Series (RC Preview)"),
    ("85203421-48f9-4355-9bc8-8a53846e5083", "YubiKey 5 FIPS Series with Lightning"),
    ("7b96457d-e3cd-432b-9ceb-c9fdd7ef7432", "YubiKey 5 FIPS Series with Lightning"),
    ("3a662962-c6d4-4023-bebb-98ae92e78e20", "YubiKey 5 FIPS Series with Lightning (Enterprise Profile)"),
    ("9e66c661-e428-452a-a8fb-51f7ed088acf", "YubiKey 5 FIPS Series with Lightning (RC Preview)"),
    ("5b0e46ba-db02-44ac-b979-ca9b84f5e335", "YubiKey 5 FIPS Series with Lightning Preview"),
    ("fcc0118f-cd45-435b-8da1-9782b2da0715", "YubiKey 5 FIPS Series with NFC"),
    ("c1f9a0bc-1dd2-404a-b27f-8e29047a43fd", "YubiKey 5 FIPS Series with NFC"),
    ("79f3c8ba-9e35-484b-8f47-53a5a0f5c630", "YubiKey 5 FIPS Series with NFC (Enterprise Profile)"),
    ("ce6bf97f-9f69-4ba7-9032-97adc6ca5cf1", "YubiKey 5 FIPS Series with NFC (RC Preview)"),
    ("62e54e98-c209-4df3-b692-de71bb6a8528", "YubiKey 5 FIPS Series with NFC Preview"),
    ("19083c3d-8383-4b18-bc03-8f1c9ab2fd1b", "YubiKey 5 Series"),
    ("cb69481e-8ff7-4039-93ec-0a2729a154a8", "YubiKey 5 Series"),
    ("ee882879-721c-4913-9775-3dfcce97072a", "YubiKey 5 Series"),
    ("ff4dac45-ede8-4ec2-aced-cf66103f4335", "YubiKey 5 Series"),
    ("0a357157-9b18-4c8a-920e-d156e972b2f8", "YubiKey 5 Series (Consumer Profile)"),
    ("4599062e-6926-4fe7-9566-9e8fb1aedaa0", "YubiKey 5 Series (Enterprise Profile)"),
    ("524de2de-982f-49b4-a769-2b5e3b73ad79", "YubiKey 5 Series (Enterprise Profile)"),
    ("20ac7a17-c814-4833-93fe-539f0d5e3389", "YubiKey 5 Series (Enterprise Profile)"),
    ("c5ef55ff-ad9a-4b9f-b580-adebafe026d0", "YubiKey 5 Series with Lightning"),
    ("a02167b9-ae71-4ac7-9a07-06432ebb6f1c", "YubiKey 5 Series with Lightning"),
    ("24673149-6c86-42e7-98d9-433fb5b73296", "YubiKey 5 Series with Lightning"),
    ("03012cb7-4fb2-42e7-9e8d-a81f10e2a5e9", "YubiKey 5 Series with Lightning (Consumer Profile)"),
    ("b90e7dc1-316e-4fee-a25a-56a666a670fe", "YubiKey 5 Series with Lightning (Enterprise Profile)"),
    ("3b24bf49-1d45-4484-a917-13175df0867b", "YubiKey 5 Series with Lightning (Enterprise Profile)"),
    ("c3479970-e58a-4f70-836f-853bf42fb063", "YubiKey 5 Series with Lightning (Enterprise Profile)"),
    ("3124e301-f14e-4e38-876d-fbeeb090e7bf", "YubiKey 5 Series with Lightning Preview"),
    ("fa2b99dc-9e39-4257-8f92-4a30d23c4118", "YubiKey 5 Series with NFC"),
    ("2fc0579f-8113-47ea-b116-bb5a8db9202a", "YubiKey 5 Series with NFC"),
    ("d7781e5d-e353-46aa-afe2-3ca49f13332a", "YubiKey 5 Series with NFC"),
    ("a25342c0-3cdc-4414-8e46-f4807fca511c", "YubiKey 5 Series with NFC"),
    ("662ef48a-95e2-4aaa-a6c1-5b9c40375824", "YubiKey 5 Series with NFC - Enhanced PIN"),
    ("b2c1a50b-dad8-4dc7-ba4d-0ce9597904bc", "YubiKey 5 Series with NFC - Enhanced PIN (Enterprise Profile)"),
    ("f4ce5fc0-57d3-46f5-a736-efb7d5bc63b5", "YubiKey 5 Series with NFC (Consumer Profile)"),
    ("7dab85a5-d16d-4eaf-a7ef-4c1385b151c5", "YubiKey 5 Series with NFC (Consumer Profile) KVZR57-2"),
    ("41e39911-c669-4811-b860-c6ad0b411b96", "YubiKey 5 Series with NFC (Enterprise Profile)"),
    ("1ac71f64-468d-4fe0-bef1-0e5f2f551f18", "YubiKey 5 Series with NFC (Enterprise Profile)"),
    ("6ab56fad-881f-4a43-acb2-0be065924522", "YubiKey 5 Series with NFC (Enterprise Profile)"),
    ("0ebd9f2c-f685-441c-8c3e-a02a234a840a", "YubiKey 5 Series with NFC Enhanced PIN (Consumer Profile)"),
    ("9a3f2abd-a73d-439c-9ee7-1b53a857eaa7", "YubiKey 5 Series with NFC Enhanced PIN (Enterprise Profile)"),
    ("9eb7eabc-9db5-49a1-b6c3-555a802093f4", "YubiKey 5 Series with NFC KVZR57"),
    ("34f5766d-1536-4a24-9033-0e294e510fb0", "YubiKey 5 Series with NFC Preview"),
    ("9dd8d593-2213-438a-97f8-d6b813d51c27", "YubiKey Bio Fido Edition (Consumer Profile)"),
    ("add92433-0d69-4026-8166-29b25bce64e9", "YubiKey Bio Fido Edition (Enterprise Profile)"),
    ("ba0a9266-40d8-4048-9786-d710b5474752", "YubiKey Bio Multi-protocol Edition (Consumer Profile)"),
    ("9806a2c8-c0da-478e-b4ca-620005d34182", "YubiKey Bio Multi-protocol Edition (Consumer Profile) 1VDJSN-2"),
    ("dc5e949d-f939-43b3-9877-a85c7186b753", "YubiKey Bio Multi-protocol Edition (Enterprise Profile)"),
    ("d8522d9f-575b-4866-88a9-ba99fa02f35b", "YubiKey Bio Series - FIDO Edition"),
    ("dd86a2da-86a0-4cbe-b462-4bd31f57bc6f", "YubiKey Bio Series - FIDO Edition"),
    ("7409272d-1ff9-4e10-9fc9-ac0019c124fd", "YubiKey Bio Series - FIDO Edition"),
    ("ad08c78a-4e41-49b9-86a2-ac15b06899e2", "YubiKey Bio Series - FIDO Edition (Enterprise Profile)"),
    ("8c39ee86-7f9a-4a95-9ba3-f6b097e5c2ee", "YubiKey Bio Series - FIDO Edition (Enterprise Profile)"),
    ("83c47309-aabb-4108-8470-8be838b573cb", "YubiKey Bio Series - FIDO Edition (Enterprise Profile)"),
    ("90636e1f-ef82-43bf-bdcf-5255f139d12f", "YubiKey Bio Series - Multi-protocol Edition"),
    ("34744913-4f57-4e6e-a527-e9ec3c4b94e6", "YubiKey Bio Series - Multi-protocol Edition"),
    ("7d1351a6-e097-4852-b8bf-c9ac5c9ce4a3", "YubiKey Bio Series - Multi-protocol Edition"),
    ("6ec5cff2-a0f9-4169-945b-f33b563f7b99", "YubiKey Bio Series - Multi-protocol Edition (Enterprise Profile)"),
    ("97e6a830-c952-4740-95fc-7c78dc97ce47", "YubiKey Bio Series - Multi-protocol Edition (Enterprise Profile)"),
    ("58276709-bb4b-4bb3-baf1-60eea99282a7", "YubiKey Bio Series - Multi-protocol Edition 1VDJSN"),
];