From ae534a3128651a6ea860acdae43a2aa252d59ded Mon Sep 17 00:00:00 2001 From: Bernd Schoolmann Date: Mon, 17 Nov 2025 02:39:45 +0100 Subject: [PATCH] Windows --- apps/desktop/desktop_native/Cargo.lock | 781 +----------------- .../desktop_native/fido2_client/Cargo.toml | 11 +- .../desktop_native/fido2_client/src/lib.rs | 20 +- .../fido2_client/src/windows.rs | 81 ++ .../src/services/jslib-services.module.ts | 1 + 5 files changed, 116 insertions(+), 778 deletions(-) create mode 100644 apps/desktop/desktop_native/fido2_client/src/windows.rs diff --git a/apps/desktop/desktop_native/Cargo.lock b/apps/desktop/desktop_native/Cargo.lock index 8105b840244..69e798b8edc 100644 --- a/apps/desktop/desktop_native/Cargo.lock +++ b/apps/desktop/desktop_native/Cargo.lock @@ -453,8 +453,6 @@ checksum = "89e25b6adfb930f02d1981565a6e5d9c547ac15a96606256d3b59040e5cd4ca3" [[package]] name = "base64urlsafedata" version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "215ee31f8a88f588c349ce2d20108b2ed96089b96b9c2b03775dc35dd72938e8" dependencies = [ "base64 0.21.7", "pastey", @@ -490,29 +488,6 @@ dependencies = [ "serde", ] -[[package]] -name = "bindgen" -version = "0.65.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5" -dependencies = [ - "bitflags 1.3.2", - "cexpr", - "clang-sys", - "lazy_static", - "lazycell", - "log", - "peeking_take_while", - "prettyplease", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "syn", - "which", -] - [[package]] name = "bitflags" version = "1.3.2" @@ -566,12 +541,6 @@ dependencies = [ "windows 0.61.1", ] -[[package]] -name = "block" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" - [[package]] name = "block-buffer" version = "0.10.4" @@ -613,63 +582,6 @@ dependencies = [ "cipher", ] -[[package]] -name = "bluez-async" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ce7d4413c940e8e3cb6afc122d3f4a07096aca259d286781128683fc9f39d9b" -dependencies = [ - "async-trait", - "bitflags 2.9.0", - "bluez-generated", - "dbus", - "dbus-tokio", - "futures", - "itertools", - "log", - "serde", - "serde-xml-rs", - "thiserror 1.0.69", - "tokio", - "uuid", -] - -[[package]] -name = "bluez-generated" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d1c659dbc82f0b8ca75606c91a371e763589b7f6acf36858eeed0c705afe367" -dependencies = [ - "dbus", -] - -[[package]] -name = "btleplug" -version = "0.11.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba345f9db94939c72959b2008abe1ffcdbcaa235243fd92ad12436532ff199cf" -dependencies = [ - "async-trait", - "bitflags 2.9.0", - "bluez-async", - "cocoa", - "dashmap", - "dbus", - "futures", - "jni", - "jni-utils", - "libc", - "log", - "objc", - "once_cell", - "static_assertions", - "thiserror 1.0.69", - "tokio", - "tokio-stream", - "uuid", - "windows 0.52.0", -] - [[package]] name = "bumpalo" version = "3.19.0" @@ -738,21 +650,6 @@ dependencies = [ "shlex", ] -[[package]] -name = "cesu8" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" - -[[package]] -name = "cexpr" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" -dependencies = [ - "nom", -] - [[package]] name = "cfg-if" version = "1.0.0" @@ -805,7 +702,7 @@ dependencies = [ "pbkdf2", "rand 0.9.1", "rusqlite", - "security-framework 3.5.0", + "security-framework", "serde", "serde_json", "sha1", @@ -826,17 +723,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "clang-sys" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" -dependencies = [ - "glob", - "libc", - "libloading", -] - [[package]] name = "clap" version = "4.5.40" @@ -886,36 +772,6 @@ dependencies = [ "error-code", ] -[[package]] -name = "cocoa" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6140449f97a6e97f9511815c5632d84c8aacf8ac271ad77c559218161a1373c" -dependencies = [ - "bitflags 1.3.2", - "block", - "cocoa-foundation", - "core-foundation 0.9.4", - "core-graphics", - "foreign-types 0.5.0", - "libc", - "objc", -] - -[[package]] -name = "cocoa-foundation" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c6234cbb2e4c785b456c0644748b1ac416dd045799740356f8363dfe00c93f7" -dependencies = [ - "bitflags 1.3.2", - "block", - "core-foundation 0.9.4", - "core-graphics-types", - "libc", - "objc", -] - [[package]] name = "codespan-reporting" version = "0.12.0" @@ -933,16 +789,6 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" -[[package]] -name = "combine" -version = "4.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" -dependencies = [ - "bytes", - "memchr", -] - [[package]] name = "concurrent-queue" version = "2.5.0" @@ -967,16 +813,6 @@ dependencies = [ "unicode-segmentation", ] -[[package]] -name = "core-foundation" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "core-foundation" version = "0.10.1" @@ -993,30 +829,6 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" -[[package]] -name = "core-graphics" -version = "0.23.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081" -dependencies = [ - "bitflags 1.3.2", - "core-foundation 0.9.4", - "core-graphics-types", - "foreign-types 0.5.0", - "libc", -] - -[[package]] -name = "core-graphics-types" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" -dependencies = [ - "bitflags 1.3.2", - "core-foundation 0.9.4", - "libc", -] - [[package]] name = "cpufeatures" version = "0.2.17" @@ -1205,49 +1017,12 @@ dependencies = [ "syn", ] -[[package]] -name = "dashmap" -version = "5.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" -dependencies = [ - "cfg-if", - "hashbrown 0.14.5", - "lock_api", - "once_cell", - "parking_lot_core", -] - [[package]] name = "data-encoding" version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476" -[[package]] -name = "dbus" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190b6255e8ab55a7b568df5a883e9497edc3e4821c06396612048b430e5ad1e9" -dependencies = [ - "futures-channel", - "futures-util", - "libc", - "libdbus-sys", - "windows-sys 0.59.0", -] - -[[package]] -name = "dbus-tokio" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "007688d459bc677131c063a3a77fb899526e17b7980f390b69644bdbc41fad13" -dependencies = [ - "dbus", - "libc", - "tokio", -] - [[package]] name = "der" version = "0.7.10" @@ -1296,7 +1071,7 @@ dependencies = [ "bytes", "cbc", "chacha20poly1305", - "core-foundation 0.10.1", + "core-foundation", "desktop_objc", "dirs 6.0.0", "ed25519", @@ -1315,7 +1090,7 @@ dependencies = [ "russh-cryptovec", "scopeguard", "secmem-proc", - "security-framework 3.5.0", + "security-framework", "security-framework-sys", "serde", "serde_json", @@ -1368,7 +1143,7 @@ version = "0.0.0" dependencies = [ "anyhow", "cc", - "core-foundation 0.10.1", + "core-foundation", "glob", "thiserror 2.0.12", "tokio", @@ -1687,36 +1462,12 @@ version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" -[[package]] -name = "fido-hid-rs" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a8766c4600034812553d02c28dde631d51cad03c3ad1372ef7824c9627aabc8" -dependencies = [ - "async-trait", - "bindgen", - "bitflags 1.3.2", - "core-foundation 0.9.4", - "futures", - "lazy_static", - "libc", - "mach2", - "nix 0.26.4", - "num-derive", - "num-traits", - "thiserror 1.0.69", - "tokio", - "tokio-stream", - "tracing", - "udev", - "windows 0.41.0", -] - [[package]] name = "fido2_client" version = "0.0.0" dependencies = [ "base64 0.22.1", + "base64urlsafedata", "ctap-hid-fido2", "futures-util", "hex", @@ -1749,48 +1500,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared 0.1.1", -] - -[[package]] -name = "foreign-types" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" -dependencies = [ - "foreign-types-macros", - "foreign-types-shared 0.3.1", -] - -[[package]] -name = "foreign-types-macros" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - -[[package]] -name = "foreign-types-shared" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" - [[package]] name = "form_urlencoded" version = "1.2.1" @@ -2021,12 +1730,6 @@ dependencies = [ "crunchy", ] -[[package]] -name = "hashbrown" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" - [[package]] name = "hashbrown" version = "0.15.3" @@ -2042,7 +1745,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" dependencies = [ - "hashbrown 0.15.3", + "hashbrown", ] [[package]] @@ -2115,23 +1818,6 @@ dependencies = [ "windows 0.57.0", ] -[[package]] -name = "http" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "httparse" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" - [[package]] name = "icu_collections" version = "2.0.0" @@ -2246,7 +1932,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" dependencies = [ "equivalent", - "hashbrown 0.15.3", + "hashbrown", ] [[package]] @@ -2280,56 +1966,12 @@ version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - [[package]] name = "itoa" version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" -[[package]] -name = "jni" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6df18c2e3db7e453d3c6ac5b3e9d5182664d28788126d39b91f2d1e22b017ec" -dependencies = [ - "cesu8", - "combine", - "jni-sys", - "log", - "thiserror 1.0.69", - "walkdir", -] - -[[package]] -name = "jni-sys" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" - -[[package]] -name = "jni-utils" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "259e9f2c3ead61de911f147000660511f07ab00adeed1d84f5ac4d0386e7a6c4" -dependencies = [ - "dashmap", - "futures", - "jni", - "log", - "once_cell", - "static_assertions", - "uuid", -] - [[package]] name = "js-sys" version = "0.3.82" @@ -2370,27 +2012,12 @@ dependencies = [ "spin", ] -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - [[package]] name = "libc" version = "0.2.172" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" -[[package]] -name = "libdbus-sys" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cbe856efeb50e4681f010e9aaa2bf0a644e10139e54cde10fc83a307c23bd9f" -dependencies = [ - "pkg-config", -] - [[package]] name = "libloading" version = "0.8.7" @@ -2428,16 +2055,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "libudev-sys" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c8469b4a23b962c1396b9b451dda50ef5b283e8dd309d69033475fa9b334324" -dependencies = [ - "libc", - "pkg-config", -] - [[package]] name = "link-cplusplus" version = "1.0.10" @@ -2491,15 +2108,6 @@ version = "0.4.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" -[[package]] -name = "mach2" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d640282b302c0bb0a2a8e0233ead9035e3bed871f0b7e81fe4a1ec829765db44" -dependencies = [ - "libc", -] - [[package]] name = "macos_provider" version = "0.0.0" @@ -2516,15 +2124,6 @@ dependencies = [ "uniffi", ] -[[package]] -name = "malloc_buf" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" -dependencies = [ - "libc", -] - [[package]] name = "matchers" version = "0.2.0" @@ -2550,15 +2149,6 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" -[[package]] -name = "memoffset" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" -dependencies = [ - "autocfg", -] - [[package]] name = "memoffset" version = "0.9.1" @@ -2705,36 +2295,6 @@ dependencies = [ "libloading", ] -[[package]] -name = "native-tls" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" -dependencies = [ - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework 2.11.1", - "security-framework-sys", - "tempfile", -] - -[[package]] -name = "nix" -version = "0.26.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" -dependencies = [ - "bitflags 1.3.2", - "cfg-if", - "libc", - "memoffset 0.7.1", - "pin-utils", -] - [[package]] name = "nix" version = "0.29.0" @@ -2757,7 +2317,7 @@ dependencies = [ "cfg-if", "cfg_aliases", "libc", - "memoffset 0.9.1", + "memoffset", ] [[package]] @@ -2897,15 +2457,6 @@ dependencies = [ "libm", ] -[[package]] -name = "objc" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" -dependencies = [ - "malloc_buf", -] - [[package]] name = "objc2" version = "0.6.1" @@ -3050,50 +2601,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" -[[package]] -name = "openssl" -version = "0.10.75" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08838db121398ad17ab8531ce9de97b244589089e290a384c900cb9ff7434328" -dependencies = [ - "bitflags 2.9.0", - "cfg-if", - "foreign-types 0.3.2", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "openssl-probe" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" - -[[package]] -name = "openssl-sys" -version = "0.9.111" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82cab2d520aa75e3c58898289429321eb788c3106963d0dc886ec7a5f4adc321" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "option-ext" version = "0.2.0" @@ -3218,12 +2725,6 @@ dependencies = [ "hmac", ] -[[package]] -name = "peeking_take_while" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" - [[package]] name = "pem-rfc7468" version = "0.7.0" @@ -3444,16 +2945,6 @@ dependencies = [ "termtree", ] -[[package]] -name = "prettyplease" -version = "0.2.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6837b9e10d61f45f987d50808f83d1ee3d206c66acf650c3e4ae2e1f6ddedf55" -dependencies = [ - "proc-macro2", - "syn", -] - [[package]] name = "primeorder" version = "0.13.6" @@ -3715,12 +3206,6 @@ version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - [[package]] name = "rustc_version" version = "0.4.1" @@ -3796,15 +3281,6 @@ dependencies = [ "cipher", ] -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - [[package]] name = "scc" version = "2.4.0" @@ -3814,15 +3290,6 @@ dependencies = [ "sdd", ] -[[package]] -name = "schannel" -version = "0.1.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891d81b926048e76efe18581bf793546b4c0eaf8448d72be8de2bbee5fd166e1" -dependencies = [ - "windows-sys 0.61.2", -] - [[package]] name = "scopeguard" version = "1.2.0" @@ -3910,19 +3377,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "security-framework" -version = "2.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" -dependencies = [ - "bitflags 2.9.0", - "core-foundation 0.9.4", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - [[package]] name = "security-framework" version = "3.5.0" @@ -3930,7 +3384,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc198e42d9b7510827939c9a15f5062a0c913f3371d765977e586d2fe6c16f4a" dependencies = [ "bitflags 2.9.0", - "core-foundation 0.10.1", + "core-foundation", "core-foundation-sys", "libc", "security-framework-sys", @@ -3964,27 +3418,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde-xml-rs" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb3aa78ecda1ebc9ec9847d5d3aba7d618823446a049ba2491940506da6e2782" -dependencies = [ - "log", - "serde", - "thiserror 1.0.69", - "xml-rs", -] - -[[package]] -name = "serde_bytes" -version = "0.11.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8437fd221bde2d4ca316d61b90e337e9e702b3820b87d63caa9ba6c02bd06d96" -dependencies = [ - "serde", -] - [[package]] name = "serde_cbor" version = "0.11.2" @@ -4481,16 +3914,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-native-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" -dependencies = [ - "native-tls", - "tokio", -] - [[package]] name = "tokio-stream" version = "0.1.15" @@ -4500,21 +3923,6 @@ dependencies = [ "futures-core", "pin-project-lite", "tokio", - "tokio-util", -] - -[[package]] -name = "tokio-tungstenite" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edc5f74e248dc973e0dbb7b74c7e0d6fcc301c694ff50049504004ef4d0cdcd9" -dependencies = [ - "futures-util", - "log", - "native-tls", - "tokio", - "tokio-native-tls", - "tungstenite", ] [[package]] @@ -4681,49 +4089,19 @@ dependencies = [ "petgraph", ] -[[package]] -name = "tungstenite" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18e5b8366ee7a95b16d32197d0b2604b43a0be89dc5fac9f8e96ccafbaedda8a" -dependencies = [ - "byteorder", - "bytes", - "data-encoding", - "http", - "httparse", - "log", - "native-tls", - "rand 0.8.5", - "sha1", - "thiserror 1.0.69", - "utf-8", -] - [[package]] name = "typenum" version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" -[[package]] -name = "udev" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebdbbd670373442a12fe9ef7aeb53aec4147a5a27a00bbc3ab639f08f48191a" -dependencies = [ - "libc", - "libudev-sys", - "pkg-config", -] - [[package]] name = "uds_windows" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89daebc3e6fd160ac4aa9fc8b3bf71e1f74fbf92367ae71fb83a037e8bf164b9" dependencies = [ - "memoffset 0.9.1", + "memoffset", "tempfile", "winapi", ] @@ -4925,12 +4303,6 @@ dependencies = [ "serde", ] -[[package]] -name = "utf-8" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" - [[package]] name = "utf8_iter" version = "1.0.4" @@ -4951,7 +4323,6 @@ checksum = "2f87b8aa10b915a06587d0dec516c282ff295b475d94abf425d62b57710070a2" dependencies = [ "getrandom 0.3.3", "js-sys", - "serde", "wasm-bindgen", ] @@ -4973,7 +4344,7 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2ebfe12e38930c3b851aea35e93fab1a6c29279cad7e8e273f29a21678fee8c0" dependencies = [ - "core-foundation 0.10.1", + "core-foundation", "sha1", "sha2", "windows-sys 0.61.2", @@ -5005,16 +4376,6 @@ dependencies = [ "libc", ] -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -5145,88 +4506,35 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "webauthn-attestation-ca" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f77a2892ec44032e6c48dad9aad1b05fada09c346ada11d8d32db119b4b4f205" -dependencies = [ - "base64urlsafedata", - "openssl", - "openssl-sys", - "serde", - "tracing", - "uuid", -] - [[package]] name = "webauthn-authenticator-rs" version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45f8fe3811c8d6c6830d263452670a608fd4dcdfc481349bd4d1e6a46d6c7a0f" dependencies = [ "async-stream", "async-trait", "base64 0.21.7", "base64urlsafedata", "bitflags 1.3.2", - "btleplug", - "fido-hid-rs", "futures", - "hex", "nom", "num-derive", "num-traits", - "openssl", - "openssl-sys", + "once_cell", "serde", - "serde_bytes", "serde_cbor_2", "serde_json", "thiserror 1.0.69", - "tokio", - "tokio-stream", - "tokio-tungstenite", "tracing", "unicode-normalization", "url", "uuid", - "webauthn-rs-core", "webauthn-rs-proto", -] - -[[package]] -name = "webauthn-rs-core" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19f1d80f3146382529fe70a3ab5d0feb2413a015204ed7843f9377cd39357fc4" -dependencies = [ - "base64 0.21.7", - "base64urlsafedata", - "der-parser", - "hex", - "nom", - "openssl", - "openssl-sys", - "rand 0.8.5", - "rand_chacha 0.3.1", - "serde", - "serde_cbor_2", - "serde_json", - "thiserror 1.0.69", - "tracing", - "url", - "uuid", - "webauthn-attestation-ca", - "webauthn-rs-proto", - "x509-parser", + "windows 0.52.0", ] [[package]] name = "webauthn-rs-proto" version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e786894f89facb9aaf1c5f6559670236723c98382e045521c76f3d5ca5047bd" dependencies = [ "base64 0.21.7", "base64urlsafedata", @@ -5293,21 +4601,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows" -version = "0.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3ed69de2c1f8d0524a8a3417a80a85dd316a071745fbfdf5eb028b310058ab" -dependencies = [ - "windows_aarch64_gnullvm 0.41.0", - "windows_aarch64_msvc 0.41.0", - "windows_i686_gnu 0.41.0", - "windows_i686_msvc 0.41.0", - "windows_x86_64_gnu 0.41.0", - "windows_x86_64_gnullvm 0.41.0", - "windows_x86_64_msvc 0.41.0", -] - [[package]] name = "windows" version = "0.52.0" @@ -5633,12 +4926,6 @@ dependencies = [ "windows_x86_64_msvc 0.53.0", ] -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "163d2761774f2278ecb4e6719e80b2b5e92e5a2be73a7bcd3ef624dd5e3091fd" - [[package]] name = "windows_aarch64_gnullvm" version = "0.42.2" @@ -5663,12 +4950,6 @@ version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" -[[package]] -name = "windows_aarch64_msvc" -version = "0.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef005ff2bceb00d3b84166a359cc19084f9459754fd3fe5a504dee3dddcd0a0c" - [[package]] name = "windows_aarch64_msvc" version = "0.42.2" @@ -5693,12 +4974,6 @@ version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" -[[package]] -name = "windows_i686_gnu" -version = "0.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b4df2d51e32f03f8b4b228e487828c03bcb36d97b216fc5463bcea5bb1440b" - [[package]] name = "windows_i686_gnu" version = "0.42.2" @@ -5735,12 +5010,6 @@ version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" -[[package]] -name = "windows_i686_msvc" -version = "0.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "568a966834571f2f3267f07dd72b4d8507381f25e53d056808483b2637385ef7" - [[package]] name = "windows_i686_msvc" version = "0.42.2" @@ -5774,12 +5043,6 @@ dependencies = [ "windows-core 0.61.0", ] -[[package]] -name = "windows_x86_64_gnu" -version = "0.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc395dac1adf444e276d096d933ae7961361c8cda3245cffef7a9b3a70a8f994" - [[package]] name = "windows_x86_64_gnu" version = "0.42.2" @@ -5804,12 +5067,6 @@ version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90e8ec22b715d5b436e1d59c8adad6c744dc20cd984710121d5836b4e8dbb5e0" - [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" @@ -5834,12 +5091,6 @@ version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" -[[package]] -name = "windows_x86_64_msvc" -version = "0.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b9761f0216b669019df1512f6e25e5ee779bf61c5cdc43c7293858e7efd7926" - [[package]] name = "windows_x86_64_msvc" version = "0.42.2" @@ -5951,12 +5202,6 @@ dependencies = [ "time", ] -[[package]] -name = "xml-rs" -version = "0.8.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ae8337f8a065cfc972643663ea4279e04e7256de865aa66fe25cec5fb912d3f" - [[package]] name = "yoke" version = "0.8.0" diff --git a/apps/desktop/desktop_native/fido2_client/Cargo.toml b/apps/desktop/desktop_native/fido2_client/Cargo.toml index fdf2c0e2799..f1a8f6e2f05 100644 --- a/apps/desktop/desktop_native/fido2_client/Cargo.toml +++ b/apps/desktop/desktop_native/fido2_client/Cargo.toml @@ -11,12 +11,13 @@ ctap-hid-fido2 = "3.5.1" pinentry = "0.5.0" home = "=0.5.0" serde = { workspace = true, features = ["derive"] } -serde_json.workspace = true +serde_json = { workspace = true } secrecy = "0.8.0" -hex.workspace = true -webauthn-authenticator-rs = { version = "0.5.3", features = ["ctap2", "cable", "usb"] } +hex = { workspace = true } +webauthn-authenticator-rs = { path = "../../../../../webauthn-rs/webauthn-authenticator-rs/", features = ["win10"] } tokio.workspace = true futures-util = "0.3.31" -webauthn-rs-proto = "0.5.3" -sha2.workspace = true +sha2 = { workspace = true } +webauthn-rs-proto = { path = "../../../../../webauthn-rs/webauthn-rs-proto" } +base64urlsafedata = { path= "../../../../../webauthn-rs/base64urlsafedata" } diff --git a/apps/desktop/desktop_native/fido2_client/src/lib.rs b/apps/desktop/desktop_native/fido2_client/src/lib.rs index e489d5672b1..d8110a631a7 100644 --- a/apps/desktop/desktop_native/fido2_client/src/lib.rs +++ b/apps/desktop/desktop_native/fido2_client/src/lib.rs @@ -3,11 +3,13 @@ mod ctap_hid_fido2; #[cfg(all(target_os = "linux", target_env = "gnu"))] use ctap_hid_fido2::*; -#[cfg(not(all(target_os = "linux", target_env = "gnu")))] -mod unimplemented; -#[cfg(not(all(target_os = "linux", target_env = "gnu")))] -use unimplemented::*; +#[cfg(target_os = "windows")] +mod windows; +#[cfg(target_os = "windows")] +use windows::*; +#[cfg(all(target_os = "linux", target_env = "gnu"))] +/// Depending on the platform API, the platform MAY do this for you, or may require you to do it manually. fn prf_to_hmac(prf_salt: &[u8]) -> [u8; 32] { use sha2::Digest; sha2::Sha256::digest(&[b"WebAuthn PRF".as_slice(), &[0], prf_salt].concat()).into() @@ -31,6 +33,7 @@ pub struct AssertionOptions { pub prf_eval_second: Option<[u8; 32]>, } +#[derive(Debug)] pub struct AuthenticatorAssertionResponse { pub authenticator_data: Vec, pub client_data_json: Vec, @@ -38,6 +41,7 @@ pub struct AuthenticatorAssertionResponse { pub user_handle: Vec, } +#[derive(Debug)] pub struct PublicKeyCredential { pub authenticator_attachment: String, pub id: String, @@ -60,7 +64,13 @@ pub mod fido2_client { pub fn get( assertion_options: super::AssertionOptions, ) -> Result { - super::get(assertion_options) + println!("Calling Windows FIDO2 client get()"); + // run in new thread + std::thread::spawn(move || { + super::get(assertion_options) + }) + .join() + .unwrap() } pub fn available() -> bool { diff --git a/apps/desktop/desktop_native/fido2_client/src/windows.rs b/apps/desktop/desktop_native/fido2_client/src/windows.rs new file mode 100644 index 00000000000..ad369ef6b0d --- /dev/null +++ b/apps/desktop/desktop_native/fido2_client/src/windows.rs @@ -0,0 +1,81 @@ +use webauthn_authenticator_rs::{AuthenticatorBackend, prelude::Url, win10::Win10}; +use webauthn_rs_proto::{HmacGetSecretInput, PublicKeyCredentialRequestOptions, RequestAuthenticationExtensions}; + +use crate::{AssertionOptions, Fido2ClientError, PublicKeyCredential}; + +pub fn get(options: AssertionOptions) -> Result { + let uv = match options.user_verification { + crate::UserVerification::Required => webauthn_rs_proto::UserVerificationPolicy::Required, + crate::UserVerification::Preferred => webauthn_rs_proto::UserVerificationPolicy::Preferred, + crate::UserVerification::Discouraged => webauthn_rs_proto::UserVerificationPolicy::Discouraged_DO_NOT_USE, + }; + println!("User verification policy: {:?}", uv); + + let opts = PublicKeyCredentialRequestOptions { + challenge: base64urlsafedata::Base64UrlSafeData::from(options.challenge), + timeout: Some(options.timeout as u32), + rp_id: options.rpid, + allow_credentials: vec![], + user_verification: uv, + hints: None, + extensions: Some(RequestAuthenticationExtensions { + hmac_get_secret: Some(HmacGetSecretInput { + output1: base64urlsafedata::Base64UrlSafeData::from(&options.prf_eval_first), + output2: None, + }), + appid: None, + uvm: None, + }) + }; + println!("Prepared PublicKeyCredentialRequestOptions: {:?}", opts); + let public_key_credential = Win10::default().perform_auth(Url::parse( + "https://vault.usdev.bitwarden.pw", + ).unwrap(), opts, 60000) + .map_err(|_e| Fido2ClientError::AssertionError)?; + println!("PublicKeyCredential: {:?}", public_key_credential); + + Ok(PublicKeyCredential { + id: public_key_credential.id, + raw_id: public_key_credential.raw_id.to_vec(), + response: crate::AuthenticatorAssertionResponse { + authenticator_data: public_key_credential.response.authenticator_data.to_vec(), + client_data_json: public_key_credential.response.client_data_json.to_vec(), + signature: public_key_credential.response.signature.to_vec(), + user_handle: public_key_credential.response.user_handle.map(|h| h.to_vec()).unwrap_or_default(), + }, + prf: public_key_credential.extensions.hmac_get_secret.map(|hmac| { + let mut prf_bytes = [0u8; 32]; + prf_bytes.copy_from_slice(&hmac.output1.to_vec().as_slice()[..32]); + prf_bytes + }), + authenticator_attachment: "cross-platform".to_string(), + r#type: public_key_credential.type_, + }) +} + +pub fn available() -> bool { + false +} + +#[cfg(test)] +mod tests { + use crate::AssertionOptions; + + use super::*; + + #[test] + fn test_get() { + let options = +AssertionOptions { + challenge: vec![0u8; 32], + timeout: 0, + rpid: "vault.usdev.bitwarden.pw".to_string(), + user_verification: crate::UserVerification::Required, + allow_credentials: vec![], + prf_eval_first: [0u8; 32], + prf_eval_second: None, + }; + let result = get(options); + println!("{:?}", result.unwrap()); + } +} \ No newline at end of file diff --git a/libs/angular/src/services/jslib-services.module.ts b/libs/angular/src/services/jslib-services.module.ts index 0d1e9eb653c..98a70e91eac 100644 --- a/libs/angular/src/services/jslib-services.module.ts +++ b/libs/angular/src/services/jslib-services.module.ts @@ -129,6 +129,7 @@ import { UserVerificationApiService } from "@bitwarden/common/auth/services/user import { UserVerificationService } from "@bitwarden/common/auth/services/user-verification/user-verification.service"; import { WebAuthnLoginApiService } from "@bitwarden/common/auth/services/webauthn-login/webauthn-login-api.service"; import { WebAuthnLoginPrfKeyService } from "@bitwarden/common/auth/services/webauthn-login/webauthn-login-prf-key.service"; +import { DefaultTwoFactorApiService, TwoFactorApiService } from "@bitwarden/common/auth/two-factor"; import { AutofillSettingsService, AutofillSettingsServiceAbstraction,