Bento, the office suite that fits in a file
TypeScript mit-licenseofficeoffice-365office-suiteoffice-toolsoffice365open-sourcepowerpointself-hostedsingle-page-appslidesslideshareslideshowslideshow-galleryslideshow-makerslideshows
home/desktop: security-key ceremony via libfido2, libsecret keyring, supply-chain checks and a PRF interop rig (bento/connect H1d) (#823)
nyblnetaab31c23a477
diff --git a/.github/workflows/ci-home-desktop.yml b/.github/workflows/ci-home-desktop.ymlindex eee675fb..f0c1a8d1 100644--- a/.github/workflows/ci-home-desktop.yml+++ b/.github/workflows/ci-home-desktop.yml@@ -56,5 +56,42 @@ jobs:# no prompt once the keyring is unlocked.working-directory: home/desktop/agentrun: |- sudo apt-get install -y -qq gnome-keyring dbus >/dev/null+ sudo apt-get install -y -qq gnome-keyring dbus libsecret-1-dev >/dev/null./keyring-rig.sh+ - name: Desktop agent supply chain (cargo-deny, test-only crates absent)+ # The SHIPPED agent's graph: a permissive-only licence allow-list,+ # RustSec advisories, crates.io-only sources; and the test-only virtual+ # authenticator (agent-testkit / OpenSK) must not be in it. Each check+ # has a positive control (an LGPL crate, the testkit as a normal+ # dependency) that must be refused.+ working-directory: home/desktop/agent+ run: |+ cargo install -q cargo-deny --locked --version 0.18.9+ ./supply-chain-check.sh+ - name: Desktop agent PRF interop rig (virtual security key)+ # One virtual FIDO2 key (Google OpenSK, Apache-2.0, test-only, over+ # uhid), an independent WebAuthn client (Yubico python-fido2, BSD-2,+ # hash-pinned) and the agent's libfido2 layer must produce the SAME PRF+ # output for the same credential; two mutant builds (double hash, raw+ # input hash) must each fail that comparison.+ working-directory: home/desktop/agent+ run: |+ sudo apt-get install -y -qq libfido2-dev python3-cryptography python3-venv >/dev/null+ # uhid (the virtual key's transport) moves between the runner kernels'+ # packages: in linux-modules-extra on 6.17 Azure kernels, in the base+ # linux-modules (always installed) on 7.0. Install -extra only when the+ # running kernel has one; the rig's `modprobe uhid` still fails loudly+ # if the module is missing.+ if apt-cache show "linux-modules-extra-$(uname -r)" >/dev/null 2>&1; then+ sudo apt-get install -y -qq "linux-modules-extra-$(uname -r)" >/dev/null+ fi+ # python-fido2 1.2.0, hash-pinned, in a venv: the rig runs Python+ # isolated (-I), which ignores a user-site install. The venv sees+ # apt's cryptography (system site) but always installs its own pinned+ # fido2 (--ignore-installed), whatever else is on the machine.+ printf 'fido2==1.2.0 --hash=sha256:f7c8ee62e359aa980a45773f9493965bb29ede1b237a9218169dbfe60c80e130\n' > "$RUNNER_TEMP/fido2-req.txt"+ python3 -m venv --system-site-packages "$RUNNER_TEMP/rigvenv"+ "$RUNNER_TEMP/rigvenv/bin/python" -m pip install --ignore-installed --no-deps --require-hashes -r "$RUNNER_TEMP/fido2-req.txt"+ export BENTO_RIG_PYTHON="$RUNNER_TEMP/rigvenv/bin/python"+ rustup toolchain install nightly-2026-06-03 --profile minimal+ ./fido-rig.shdiff --git a/docs/DECISIONS.md b/docs/DECISIONS.mdindex c5ff439c..80db1e79 100644--- a/docs/DECISIONS.md+++ b/docs/DECISIONS.md@@ -11841,3 +11841,44 @@ type-stripped into `id/gen/` like the statements, and the hand-writtenmodules are gone: one implementation, held to `recovery-v1.json` by kernel'sown rig run against the extension's copy.+## 2026-10-18 — bento/connect: the desktop agent's security-key ceremony, and one rule for C libraries (home/desktop/agent)++- **One authenticator stack per platform.**+ - **Linux** uses the distribution's **libfido2** (Yubico, BSD-2-Clause,+ minimum 1.12). **Windows** will use only the platform WebAuthn API+ (`webauthn.dll`), which covers security keys, Windows Hello and phone+ hybrid: non-admin apps can't reach CTAP-HID keys directly there. libfido2 is+ never shipped on Windows.+ - **The PRF → CTAP hmac-secret transform**, SHA-256("WebAuthn PRF" ‖ 0x00 ‖+ input), is applied exactly once. On Linux the agent applies it before+ libfido2. On Windows the raw input goes to `webauthn.dll`'s PRF path, which+ applies it itself. Applying it twice still gives deterministic output, but+ it never matches what the same key gives on the web.+- **The desktop's clientDataJSON origin** is exactly `bento-desktop:linux` or+ `bento-desktop:windows`, never `https://bento.page`. A native app+ self-asserts its origin; on the web the browser vouches for it, which is where+ phishing resistance comes from. The fields are type, challenge, origin and+ crossOrigin, in spec order, with CCDToString escaping and no topOrigin.+- **C libraries are the distribution's, behind a thin in-tree FFI.** That+ applies to libfido2 and to the keyring. The keyring moved from the+ secret-service crate to libsecret, which removed a zbus tree carrying three+ RustSec "unmaintained" notices. There are no binding crates, no bundled+ copies and no OpenSSL crate in the shipped graph. Any future bundled build+ must say so and pin and checksum its source.+- **Supply chain (`supply-chain-check.sh`).** cargo-deny runs over the shipped+ graph: a permissive-only licence allow-list, RustSec advisories and+ crates.io-only sources. A second check proves the test-only authenticator is+ absent from that graph. Each has a positive control: an LGPL crate, and the+ testkit as a normal dependency, must both be refused.+- **The test authenticator is Google's OpenSK** (Apache-2.0, pinned commit and+ nightly), in a separate test-only crate with our own MIT uhid adapter. An+ AGPL alternative was rejected even for tests.+- **The PRF interop rig.** One virtual key and one credential, with an+ independent WebAuthn client (Yubico python-fido2, BSD-2, hash-pinned) that+ applies the PRF transform itself, as a browser does. The agent's output must+ be byte-equal to it. Two mutant builds, double-hash and raw-input-hash, must+ each fail ON THAT COMPARISON, not by failing to build or to reach the key.+- **The no-TPM store's wipe** re-counts every item, locked or not, after+ clearing. Measured: libsecret's clear silently skips items in a locked+ keyring, so the re-count is what keeps a wipe from reporting success while+ keys remain.diff --git a/home/desktop/agent-testkit/.gitignore b/home/desktop/agent-testkit/.gitignorenew file mode 100644index 00000000..2f7896d1--- /dev/null+++ b/home/desktop/agent-testkit/.gitignore@@ -0,0 +1 @@+target/diff --git a/home/desktop/agent-testkit/Cargo.lock b/home/desktop/agent-testkit/Cargo.locknew file mode 100644index 00000000..fabd250f--- /dev/null+++ b/home/desktop/agent-testkit/Cargo.lock@@ -0,0 +1,610 @@+# This file is automatically @generated by Cargo.+# It is not intended for manual editing.+version = 4++[[package]]+name = "aes"+version = "0.8.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"+dependencies = [+ "cfg-if",+ "cipher",+ "cpufeatures",+]++[[package]]+name = "arrayref"+version = "0.3.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb"++[[package]]+name = "base16ct"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf"++[[package]]+name = "base64ct"+version = "1.8.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06"++[[package]]+name = "bento-agent-testkit"+version = "0.0.0"+dependencies = [+ "opensk",+]++[[package]]+name = "bitflags"+version = "2.13.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"++[[package]]+name = "block-buffer"+version = "0.10.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"+dependencies = [+ "generic-array",+]++[[package]]+name = "byteorder"+version = "1.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"++[[package]]+name = "cbc"+version = "0.1.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6"+dependencies = [+ "cipher",+]++[[package]]+name = "cc"+version = "1.8.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6651c9ed80effdc7db0ff72512157f901af5e3549e341e24b1dd4887d836d838"+dependencies = [+ "find-msvc-tools",+ "shlex",+]++[[package]]+name = "cfg-if"+version = "1.0.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"++[[package]]+name = "cipher"+version = "0.4.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"+dependencies = [+ "crypto-common",+ "inout",+]++[[package]]+name = "const-oid"+version = "0.9.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"++[[package]]+name = "cpufeatures"+version = "0.2.17"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"+dependencies = [+ "libc",+]++[[package]]+name = "crypto-bigint"+version = "0.5.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76"+dependencies = [+ "generic-array",+ "rand_core",+ "subtle",+ "zeroize",+]++[[package]]+name = "crypto-common"+version = "0.1.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"+dependencies = [+ "generic-array",+ "typenum",+]++[[package]]+name = "der"+version = "0.7.10"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb"+dependencies = [+ "const-oid",+ "zeroize",+]++[[package]]+name = "digest"+version = "0.10.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"+dependencies = [+ "block-buffer",+ "const-oid",+ "crypto-common",+ "subtle",+]++[[package]]+name = "ecdsa"+version = "0.16.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca"+dependencies = [+ "der",+ "digest",+ "elliptic-curve",+ "rfc6979",+ "signature",+ "spki",+]++[[package]]+name = "ed25519-compact"+version = "1.0.16"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e18997d4604542d0736fae2c5ad6de987f0a50530cbcc14a7ce5a685328a252d"++[[package]]+name = "elliptic-curve"+version = "0.13.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47"+dependencies = [+ "base16ct",+ "crypto-bigint",+ "digest",+ "ff",+ "generic-array",+ "group",+ "hkdf",+ "pkcs8",+ "rand_core",+ "sec1",+ "subtle",+ "zeroize",+]++[[package]]+name = "ff"+version = "0.13.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393"+dependencies = [+ "rand_core",+ "subtle",+]++[[package]]+name = "find-msvc-tools"+version = "0.1.14"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "aedcfb3409746eddb02b9e19ebda1c3394f759a152e48ee875a0844d1b955484"++[[package]]+name = "foreign-types"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"+dependencies = [+ "foreign-types-shared",+]++[[package]]+name = "foreign-types-shared"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"++[[package]]+name = "generic-array"+version = "0.14.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"+dependencies = [+ "typenum",+ "version_check",+ "zeroize",+]++[[package]]+name = "getrandom"+version = "0.2.17"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"+dependencies = [+ "cfg-if",+ "libc",+ "wasi",+]++[[package]]+name = "group"+version = "0.13.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63"+dependencies = [+ "ff",+ "rand_core",+ "subtle",+]++[[package]]+name = "hkdf"+version = "0.12.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7"+dependencies = [+ "hmac",+]++[[package]]+name = "hmac"+version = "0.12.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"+dependencies = [+ "digest",+]++[[package]]+name = "inout"+version = "0.1.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01"+dependencies = [+ "generic-array",+]++[[package]]+name = "libc"+version = "0.2.191"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"++[[package]]+name = "opensk"+version = "1.0.0"+source = "git+https://github.com/google/OpenSK?rev=636d85b8ae492f30157cb38d9d84c3c40b9f1f0c#636d85b8ae492f30157cb38d9d84c3c40b9f1f0c"+dependencies = [+ "aes",+ "arrayref",+ "byteorder",+ "cbc",+ "ed25519-compact",+ "hkdf",+ "hmac",+ "openssl",+ "p256",+ "rand",+ "rand_core",+ "sha2",+ "sk-cbor",+ "subtle",+ "uuid",+ "wasefire-store",+ "zeroize",+]++[[package]]+name = "openssl"+version = "0.10.81"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "77823a27f0babb03091cb9ed9ef80af3b39dbc82f97e8fa530374b7dafd87a45"+dependencies = [+ "bitflags",+ "cfg-if",+ "foreign-types",+ "libc",+ "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-sys"+version = "0.9.117"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b47e7e6bb2c38cd930d25a23b40fa52e068c10e85f3e03a7f5ba5aaca5713695"+dependencies = [+ "cc",+ "libc",+ "pkg-config",+ "vcpkg",+]++[[package]]+name = "p256"+version = "0.13.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b"+dependencies = [+ "ecdsa",+ "elliptic-curve",+ "primeorder",+ "sha2",+]++[[package]]+name = "pkcs8"+version = "0.10.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7"+dependencies = [+ "der",+ "spki",+]++[[package]]+name = "pkg-config"+version = "0.3.34"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548"++[[package]]+name = "ppv-lite86"+version = "0.2.21"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"+dependencies = [+ "zerocopy",+]++[[package]]+name = "primeorder"+version = "0.13.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6"+dependencies = [+ "elliptic-curve",+]++[[package]]+name = "proc-macro2"+version = "1.0.107"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"+dependencies = [+ "unicode-ident",+]++[[package]]+name = "quote"+version = "1.0.47"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"+dependencies = [+ "proc-macro2",+]++[[package]]+name = "rand"+version = "0.8.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c"+dependencies = [+ "rand_chacha",+ "rand_core",+]++[[package]]+name = "rand_chacha"+version = "0.3.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"+dependencies = [+ "ppv-lite86",+ "rand_core",+]++[[package]]+name = "rand_core"+version = "0.6.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"++[[package]]+name = "rfc6979"+version = "0.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2"+dependencies = [+ "hmac",+ "subtle",+]++[[package]]+name = "sec1"+version = "0.7.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc"+dependencies = [+ "base16ct",+ "der",+ "generic-array",+ "pkcs8",+ "subtle",+ "zeroize",+]++[[package]]+name = "sha2"+version = "0.10.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"+dependencies = [+ "cfg-if",+ "cpufeatures",+ "digest",+]++[[package]]+name = "shlex"+version = "2.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"++[[package]]+name = "signature"+version = "2.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de"+dependencies = [+ "digest",+ "rand_core",+]++[[package]]+name = "sk-cbor"+version = "0.1.2"+source = "git+https://github.com/google/OpenSK?rev=636d85b8ae492f30157cb38d9d84c3c40b9f1f0c#636d85b8ae492f30157cb38d9d84c3c40b9f1f0c"++[[package]]+name = "spki"+version = "0.7.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d"+dependencies = [+ "base64ct",+ "der",+]++[[package]]+name = "subtle"+version = "2.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"++[[package]]+name = "syn"+version = "2.0.119"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"+dependencies = [+ "proc-macro2",+ "quote",+ "unicode-ident",+]++[[package]]+name = "typenum"+version = "1.20.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"++[[package]]+name = "unicode-ident"+version = "1.0.27"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"++[[package]]+name = "uuid"+version = "0.8.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7"+dependencies = [+ "getrandom",+]++[[package]]+name = "vcpkg"+version = "0.2.15"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"++[[package]]+name = "version_check"+version = "0.9.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"++[[package]]+name = "wasefire-store"+version = "0.2.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f49afdab5206771f6d7ad85b556fcd6255004485b704f0f5c084335c5fae3238"++[[package]]+name = "wasi"+version = "0.11.1+wasi-snapshot-preview1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"++[[package]]+name = "zerocopy"+version = "0.8.63"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e5fe1f8f1b06191a00962174c61aa5005e0bb391a6d80d07e24d115c01a92ed8"+dependencies = [+ "zerocopy-derive",+]++[[package]]+name = "zerocopy-derive"+version = "0.8.63"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "863ad3ac83293fb4d740aedbfdc9240dd8d1a50c1099acd76ce80ce7c7230c7f"+dependencies = [+ "proc-macro2",+ "quote",+ "syn",+]++[[package]]+name = "zeroize"+version = "1.9.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879"+dependencies = [+ "zeroize_derive",+]++[[package]]+name = "zeroize_derive"+version = "1.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3c50655cbb0fe3fc43170059e702f1ce5e19b84cec58dc87b037a09935c2f328"+dependencies = [+ "proc-macro2",+ "quote",+ "syn",+]diff --git a/home/desktop/agent-testkit/Cargo.toml b/home/desktop/agent-testkit/Cargo.tomlnew file mode 100644index 00000000..b8068d7f--- /dev/null+++ b/home/desktop/agent-testkit/Cargo.toml@@ -0,0 +1,13 @@+[package]+name = "bento-agent-testkit"+version = "0.0.0"+edition = "2021"+license = "MIT"+publish = false+description = "TEST-ONLY: a virtual FIDO2 authenticator (Google OpenSK, Apache-2.0) over Linux uhid, for the desktop agent's CI rigs. Never a dependency of the shipped agent."++# OpenSK is not on crates.io: pinned to an exact commit. Apache-2.0.+[dependencies]+opensk = { git = "https://github.com/google/OpenSK", rev = "636d85b8ae492f30157cb38d9d84c3c40b9f1f0c", features = ["std"] }++[workspace]diff --git a/home/desktop/agent-testkit/prf_client.py b/home/desktop/agent-testkit/prf_client.pynew file mode 100644index 00000000..fe4991cc--- /dev/null+++ b/home/desktop/agent-testkit/prf_client.py@@ -0,0 +1,65 @@+# SPDX-License-Identifier: MIT+# Copyright (c) 2026 The Bento authors+#+# TEST-ONLY. The INDEPENDENT WebAuthn client for the PRF interop rig:+# Yubico's python-fido2 (BSD-2, pinned with a hash) applies the WebAuthn PRF ->+# CTAP hmac-secret transform itself, the way a browser does. It sets a PIN on+# the virtual key, creates a discoverable credential for rp bento.page with PRF+# enabled, evaluates PRF on the agent's fixed input, and writes the result for+# the Rust side to compare byte for byte.+import json, os, sys+from fido2.hid import CtapHidDevice+from fido2.client import Fido2Client, UserInteraction+from fido2.ctap2 import Ctap2+from fido2.ctap2.pin import ClientPin+from fido2.utils import websafe_decode++PIN = "4711-rig"+PRF_INPUT = b"bento/id/prf/v1"+out_path = sys.argv[1]++dev = next(CtapHidDevice.list_devices(), None)+if dev is None:+ sys.exit("no FIDO device")+ctap = Ctap2(dev)+if not ctap.info.options.get("clientPin"):+ ClientPin(ctap).set_pin(PIN)++class UI(UserInteraction):+ def request_pin(self, permissions, rp_id):+ return PIN+ def request_uv(self, permissions, rp_id):+ return True++client = Fido2Client(dev, "https://bento.page", user_interaction=UI())+client.make_credential({+ "rp": {"id": "bento.page", "name": "bento"},+ "user": {"id": b"rig-user", "name": "[email protected]", "displayName": "Rig"},+ "challenge": os.urandom(32),+ "pubKeyCredParams": [{"type": "public-key", "alg": -7}],+ "authenticatorSelection": {"residentKey": "required", "userVerification": "required"},+ "extensions": {"prf": {}},+})++def prf(first):+ sel = client.get_assertion({+ "rpId": "bento.page",+ "challenge": os.urandom(32),+ "userVerification": "required",+ "extensions": {"prf": {"eval": {"first": first}}},+ })+ r = sel.get_response(0)+ res = r.extension_results+ first = res["prf"]["results"]["first"]+ # python-fido2 1.2 returns the PRF result base64url-encoded (JSON form)+ raw = websafe_decode(first) if isinstance(first, str) else bytes(first)+ assert len(raw) == 32, len(raw)+ return raw.hex()++json.dump({+ "device": dev.descriptor.path,+ "pin": PIN,+ "prfInput": PRF_INPUT.decode(),+ "prf": prf(PRF_INPUT),+}, open(out_path, "w"))+print("python-fido2 PRF:", json.load(open(out_path))["prf"])diff --git a/home/desktop/agent-testkit/rust-toolchain.toml b/home/desktop/agent-testkit/rust-toolchain.tomlnew file mode 100644index 00000000..cb3c4ca6--- /dev/null+++ b/home/desktop/agent-testkit/rust-toolchain.toml@@ -0,0 +1,4 @@+# OpenSK needs nightly (subtle's "nightly" feature); pinned to OpenSK's own+# toolchain. Test-only: the shipped agent builds on stable.+[toolchain]+channel = "nightly-2026-06-03"diff --git a/home/desktop/agent-testkit/src/main.rs b/home/desktop/agent-testkit/src/main.rsnew file mode 100644index 00000000..fa37c1e9--- /dev/null+++ b/home/desktop/agent-testkit/src/main.rs@@ -0,0 +1,96 @@+// SPDX-License-Identifier: MIT+// Copyright (c) 2026 The Bento authors+//+// TEST-ONLY. A virtual FIDO2 security key for the desktop agent's rigs:+// Google's OpenSK CTAP2 implementation (Apache-2.0, pinned commit) behind a+// Linux uhid device, so libfido2 (the agent) and an independent WebAuthn client+// can talk to the SAME authenticator over /dev/hidrawN.+//+// This is our own uhid adapter (MIT). It is never linked into the shipped+// agent; CI asserts the shipped dependency graph does not contain it.++use opensk::ctap::hid::HidPacket;+use opensk::env::test::TestEnv;+use opensk::{Ctap, Transport};+use std::fs::OpenOptions;+use std::io::{Read, Write};++const UHID_DESTROY: u32 = 1;+const UHID_OUTPUT: u32 = 6;+const UHID_CREATE2: u32 = 11;+const UHID_INPUT2: u32 = 12;+const EVENT_SIZE: usize = 4380;++/// CTAP-HID report descriptor: FIDO usage page 0xF1D0, 64-byte reports.+const REPORT_DESCRIPTOR: [u8; 34] = [+ 0x06, 0xD0, 0xF1, 0x09, 0x01, 0xA1, 0x01, 0x09, 0x20, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, 0x40,+ 0x81, 0x02, 0x09, 0x21, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, 0x40, 0x91, 0x02, 0xC0,+];++fn create_event() -> Vec<u8> {+ let mut ev = Vec::with_capacity(EVENT_SIZE);+ ev.extend_from_slice(&UHID_CREATE2.to_le_bytes());+ let mut name = b"bento-agent-testkit (OpenSK)".to_vec();+ name.resize(128, 0);+ ev.extend_from_slice(&name);+ ev.extend_from_slice(&[0u8; 64]); // phys+ ev.extend_from_slice(&[0u8; 64]); // uniq+ ev.extend_from_slice(&(REPORT_DESCRIPTOR.len() as u16).to_le_bytes());+ ev.extend_from_slice(&0x03u16.to_le_bytes()); // BUS_USB+ ev.extend_from_slice(&0x1209u32.to_le_bytes()); // pid.codes test VID+ ev.extend_from_slice(&0xbe71u32.to_le_bytes());+ ev.extend_from_slice(&0u32.to_le_bytes()); // version+ ev.extend_from_slice(&0u32.to_le_bytes()); // country+ ev.extend_from_slice(&REPORT_DESCRIPTOR);+ ev.resize(EVENT_SIZE, 0);+ ev+}++fn input_event(packet: &HidPacket) -> Vec<u8> {+ let mut ev = Vec::with_capacity(EVENT_SIZE);+ ev.extend_from_slice(&UHID_INPUT2.to_le_bytes());+ ev.extend_from_slice(&(packet.len() as u16).to_le_bytes());+ ev.extend_from_slice(packet);+ ev.resize(EVENT_SIZE, 0);+ ev+}++fn main() {+ let mut uhid = OpenOptions::new().read(true).write(true).open("/dev/uhid").expect("open /dev/uhid (privileged, uhid module)");+ uhid.write_all(&create_event()).expect("UHID_CREATE2");+ let mut ctap = Ctap::new(TestEnv::default());+ eprintln!("bento-agent-testkit: virtual OpenSK authenticator up");+ let mut buf = vec![0u8; EVENT_SIZE];+ loop {+ let n = match uhid.read(&mut buf) {+ Ok(n) => n,+ Err(e) => {+ eprintln!("uhid read: {e}");+ break;+ }+ };+ if n < 4 {+ continue;+ }+ let ty = u32::from_le_bytes(buf[0..4].try_into().unwrap());+ if ty != UHID_OUTPUT {+ continue;+ }+ // struct uhid_output_req { __u8 data[4096]; __u16 size; __u8 rtype; }+ let size = u16::from_le_bytes(buf[4 + 4096..4 + 4098].try_into().unwrap()) as usize;+ let data = &buf[4..4 + size.min(4096)];+ // hidraw writes carry a leading report number (0) for devices without+ // report IDs; strip it so OpenSK sees the 64-byte CTAP-HID packet.+ let report = if data.len() == 65 { &data[1..] } else { data };+ if report.len() != 64 {+ continue;+ }+ let packet: HidPacket = report.try_into().unwrap();+ for reply in ctap.process_hid_packet(&packet, Transport::MainHid) {+ uhid.write_all(&input_event(&reply)).expect("UHID_INPUT2");+ }+ }+ let mut destroy = UHID_DESTROY.to_le_bytes().to_vec();+ destroy.resize(EVENT_SIZE, 0);+ let _ = uhid.write_all(&destroy);+}diff --git a/home/desktop/agent/Cargo.lock b/home/desktop/agent/Cargo.lockindex a416a329..dcc33c28 100644--- a/home/desktop/agent/Cargo.lock+++ b/home/desktop/agent/Cargo.lock@@ -8,7 +8,7 @@ version = "0.5.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0"dependencies = [- "crypto-common 0.1.6",+ "crypto-common","generic-array",]@@ -19,19 +19,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"dependencies = ["cfg-if",- "cipher 0.4.4",- "cpufeatures 0.2.17",-]--[[package]]-name = "aes"-version = "0.9.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "35f0f96ce78e38c3dc6d8948aa8163d06385be74000f3c7a95bf1eef35d3ea32"-dependencies = [- "cipher 0.5.2",- "cpubits",- "cpufeatures 0.3.1",+ "cipher",+ "cpufeatures",][[package]]@@ -41,8 +30,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1"dependencies = ["aead",- "aes 0.8.4",- "cipher 0.4.4",+ "aes",+ "cipher","ctr","ghash","subtle",@@ -65,148 +54,11 @@ checksum = "3c3610892ee6e0cbce8ae2700349fcf8f98adb0dbfbee85aec3c9179d29cc072"dependencies = ["base64ct","blake2",- "cpufeatures 0.2.17",+ "cpufeatures","password-hash","zeroize",]-[[package]]-name = "async-broadcast"-version = "0.7.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532"-dependencies = [- "event-listener",- "event-listener-strategy",- "futures-core",- "pin-project-lite",-]--[[package]]-name = "async-channel"-version = "2.5.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2"-dependencies = [- "concurrent-queue",- "event-listener-strategy",- "futures-core",- "pin-project-lite",-]--[[package]]-name = "async-executor"-version = "1.14.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "c96bf972d85afc50bf5ab8fe2d54d1586b4e0b46c97c50a0c9e71e2f7bcd812a"-dependencies = [- "async-task",- "concurrent-queue",- "fastrand",- "futures-lite",- "pin-project-lite",- "slab",-]--[[package]]-name = "async-io"-version = "2.6.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc"-dependencies = [- "autocfg",- "cfg-if",- "concurrent-queue",- "futures-io",- "futures-lite",- "parking",- "polling",- "rustix",- "slab",- "windows-sys",-]--[[package]]-name = "async-lock"-version = "3.4.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "290f7f2596bd5b78a9fec8088ccd89180d7f9f55b94b0576823bbbdc72ee8311"-dependencies = [- "event-listener",- "event-listener-strategy",- "pin-project-lite",-]--[[package]]-name = "async-process"-version = "2.5.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75"-dependencies = [- "async-channel",- "async-io",- "async-lock",- "async-signal",- "async-task",- "blocking",- "cfg-if",- "event-listener",- "futures-lite",- "rustix",-]--[[package]]-name = "async-recursion"-version = "1.2.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "4f8abc12baad266b1c8cec146854c195b5864b4221d4b2ca7296a7ae82d9e451"-dependencies = [- "proc-macro2",- "quote",- "syn 3.0.9",-]--[[package]]-name = "async-signal"-version = "0.2.14"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "52b5aaafa020cf5053a01f2a60e8ff5dccf550f0f77ec54a4e47285ac2bab485"-dependencies = [- "async-io",- "async-lock",- "atomic-waker",- "cfg-if",- "futures-core",- "futures-io",- "rustix",- "signal-hook-registry",- "slab",- "windows-sys",-]--[[package]]-name = "async-task"-version = "4.7.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de"--[[package]]-name = "async-trait"-version = "0.1.92"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667"-dependencies = [- "proc-macro2",- "quote",- "syn 3.0.9",-]--[[package]]-name = "atomic-waker"-version = "1.1.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"-[[package]]name = "autocfg"version = "1.5.1"@@ -244,12 +96,11 @@ dependencies = ["aes-gcm","argon2","base64 0.22.1",- "hkdf 0.12.4",- "hmac 0.12.1",+ "hkdf",+ "hmac","p256",- "secret-service","serde_json",- "sha2 0.10.9",+ "sha2","tss-esapi","unicode-normalization","zeroize",@@ -275,19 +126,13 @@ dependencies = ["syn 3.0.9",]-[[package]]-name = "bitflags"-version = "2.13.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"-[[package]]name = "blake2"version = "0.10.6"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe"dependencies = [- "digest 0.10.7",+ "digest",][[package]]@@ -299,52 +144,6 @@ dependencies = ["generic-array",]-[[package]]-name = "block-buffer"-version = "0.12.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa"-dependencies = [- "hybrid-array",-]--[[package]]-name = "block-padding"-version = "0.4.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "710f1dd022ef4e93f8a438b4ba958de7f64308434fa6a87104481645cc30068b"-dependencies = [- "hybrid-array",-]--[[package]]-name = "blocking"-version = "1.7.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "a70e4329df6cb94385eed412ec92375c3cdd8a6e502493d1229b6414e4036dfa"-dependencies = [- "async-channel",- "async-task",- "futures-io",- "futures-lite",- "piper",-]--[[package]]-name = "bumpalo"-version = "3.20.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"--[[package]]-name = "cbc"-version = "0.2.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ce2dc9ee5f88d11e0beb842c88b33c8a5cf0d1329c4b19494af42b07dbfe8896"-dependencies = [- "cipher 0.5.2",-]-[[package]]name = "cfg-if"version = "1.0.5"@@ -357,33 +156,8 @@ version = "0.4.4"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"dependencies = [- "crypto-common 0.1.6",- "inout 0.1.4",-]--[[package]]-name = "cipher"-version = "0.5.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e8cf2a2c93cd704877c0858356ed03480ff301ee950b43f1cbe4573b088bfa6c"-dependencies = [- "crypto-common 0.2.2",- "inout 0.2.4",-]--[[package]]-name = "cmov"-version = "0.5.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0c9ea0ac24bc397ab3c98583a3c9ba74fa56b09a4449bbe172b9b1ddb016027a"--[[package]]-name = "concurrent-queue"-version = "2.5.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973"-dependencies = [- "crossbeam-utils",+ "crypto-common",+ "inout",][[package]]@@ -392,18 +166,6 @@ version = "0.9.6"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"-[[package]]-name = "const-oid"-version = "0.10.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "a6ef517f0926dd24a1582492c791b6a4818a4d94e789a334894aa15b0d12f55c"--[[package]]-name = "cpubits"-version = "0.1.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "15b85f9c39137c3a891689859392b1bd49812121d0d61c9caf00d46ed5ce06ae"-[[package]]name = "cpufeatures"version = "0.2.17"@@ -413,21 +175,6 @@ dependencies = ["libc",]-[[package]]-name = "cpufeatures"-version = "0.3.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566"-dependencies = [- "libc",-]--[[package]]-name = "crossbeam-utils"-version = "0.8.23"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6"-[[package]]name = "crypto-bigint"version = "0.5.5"@@ -451,31 +198,13 @@ dependencies = ["typenum",]-[[package]]-name = "crypto-common"-version = "0.2.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453"-dependencies = [- "hybrid-array",-]-[[package]]name = "ctr"version = "0.9.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835"dependencies = [- "cipher 0.4.4",-]--[[package]]-name = "ctutils"-version = "0.4.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "03bb0e1cc970d482d121d9a1744999169b69a07470b3d644a7894e53fcaf4574"-dependencies = [- "cmov",+ "cipher",][[package]]@@ -484,7 +213,7 @@ version = "0.7.10"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb"dependencies = [- "const-oid 0.9.6",+ "const-oid","pem-rfc7468","zeroize",]@@ -495,24 +224,12 @@ version = "0.10.7"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"dependencies = [- "block-buffer 0.10.4",- "const-oid 0.9.6",- "crypto-common 0.1.6",+ "block-buffer",+ "const-oid",+ "crypto-common","subtle",]-[[package]]-name = "digest"-version = "0.11.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2"-dependencies = [- "block-buffer 0.12.1",- "const-oid 0.10.2",- "crypto-common 0.2.2",- "ctutils",-]-[[package]]name = "ecdsa"version = "0.16.9"@@ -520,7 +237,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca"dependencies = ["der",- "digest 0.10.7",+ "digest","elliptic-curve","rfc6979","signature",@@ -535,7 +252,7 @@ checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47"dependencies = ["base16ct","crypto-bigint",- "digest 0.10.7",+ "digest","ff","generic-array","group",@@ -547,12 +264,6 @@ dependencies = ["zeroize",]-[[package]]-name = "endi"-version = "1.1.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099"-[[package]]name = "enumflags2"version = "0.7.12"@@ -560,7 +271,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef"dependencies = ["enumflags2_derive",- "serde",][[package]]@@ -574,48 +284,6 @@ dependencies = ["syn 2.0.119",]-[[package]]-name = "equivalent"-version = "1.0.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826"--[[package]]-name = "errno"-version = "0.3.14"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"-dependencies = [- "libc",- "windows-sys",-]--[[package]]-name = "event-listener"-version = "5.4.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "5a23add41df1562121a9393cb065eab5146a1242410f23a644851e90cfd669d2"-dependencies = [- "parking",- "pin-project-lite",-]--[[package]]-name = "event-listener-strategy"-version = "0.5.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93"-dependencies = [- "event-listener",- "pin-project-lite",-]--[[package]]-name = "fastrand"-version = "2.5.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223"-[[package]]name = "ff"version = "0.13.1"@@ -626,61 +294,6 @@ dependencies = ["subtle",]-[[package]]-name = "futures-core"-version = "0.3.34"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e"--[[package]]-name = "futures-io"-version = "0.3.34"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed"--[[package]]-name = "futures-lite"-version = "2.6.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad"-dependencies = [- "fastrand",- "futures-core",- "futures-io",- "parking",- "pin-project-lite",-]--[[package]]-name = "futures-macro"-version = "0.3.34"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44"-dependencies = [- "proc-macro2",- "quote",- "syn 3.0.9",-]--[[package]]-name = "futures-task"-version = "0.3.34"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd"--[[package]]-name = "futures-util"-version = "0.3.34"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc"-dependencies = [- "futures-core",- "futures-macro",- "futures-task",- "pin-project-lite",- "slab",-]-[[package]]name = "generic-array"version = "0.14.9"@@ -735,40 +348,13 @@ dependencies = ["subtle",]-[[package]]-name = "hashbrown"-version = "0.17.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"--[[package]]-name = "hermit-abi"-version = "0.5.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284"--[[package]]-name = "hex"-version = "0.4.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"-[[package]]name = "hkdf"version = "0.12.4"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7"dependencies = [- "hmac 0.12.1",-]--[[package]]-name = "hkdf"-version = "0.13.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "4aaa26c720c68b866f2c96ef5c1264b3e6f473fe5d4ce61cd44bbe913e553018"-dependencies = [- "hmac 0.13.0",+ "hmac",][[package]]@@ -777,16 +363,7 @@ version = "0.12.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"dependencies = [- "digest 0.10.7",-]--[[package]]-name = "hmac"-version = "0.13.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "6303bc9732ae41b04cb554b844a762b4115a61bfaa81e3e83050991eeb56863f"-dependencies = [- "digest 0.11.3",+ "digest",][[package]]@@ -795,25 +372,6 @@ version = "1.1.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "f558a64ac9af88b5ba400d99b579451af0d39c6d360980045b91aac966d705e2"-[[package]]-name = "hybrid-array"-version = "0.4.15"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "27f864f10dfb56725ce5ce5472bc52252c8f93a4ab86327122cebf62c5f59a17"-dependencies = [- "typenum",-]--[[package]]-name = "indexmap"-version = "2.14.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855"-dependencies = [- "equivalent",- "hashbrown",-]-[[package]]name = "inout"version = "0.1.4"@@ -823,148 +381,49 @@ dependencies = ["generic-array",]-[[package]]-name = "inout"-version = "0.2.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "3ce983bb6fb399067d101fbfc9e74174e07e9f29a2bc679efefeb8c645819c3f"-dependencies = [- "block-padding",- "hybrid-array",-]-[[package]]name = "itoa"version = "1.0.18"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"--[[package]]-name = "js-sys"-version = "0.3.106"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5"-dependencies = [- "cfg-if",- "futures-util",- "wasm-bindgen",-]--[[package]]-name = "libc"-version = "0.2.191"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"--[[package]]-name = "linux-raw-sys"-version = "0.12.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"--[[package]]-name = "log"-version = "0.4.34"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6"--[[package]]-name = "mbox"-version = "0.7.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "26d142aeadbc4e8c679fc6d93fbe7efe1c021fa7d80629e615915b519e3bc6de"-dependencies = [- "libc",- "stable_deref_trait",-]--[[package]]-name = "memchr"-version = "2.8.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"--[[package]]-name = "memoffset"-version = "0.9.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"-dependencies = [- "autocfg",-]--[[package]]-name = "num"-version = "0.4.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23"-dependencies = [- "num-bigint",- "num-complex",- "num-integer",- "num-iter",- "num-rational",- "num-traits",-]--[[package]]-name = "num-bigint"-version = "0.4.8"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367"-dependencies = [- "num-integer",- "num-traits",-]+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"[[package]]-name = "num-complex"-version = "0.4.6"+name = "libc"+version = "0.2.191"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495"-dependencies = [- "num-traits",-]+checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"[[package]]-name = "num-derive"-version = "0.4.2"+name = "log"+version = "0.4.34"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202"-dependencies = [- "proc-macro2",- "quote",- "syn 2.0.119",-]+checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6"[[package]]-name = "num-integer"-version = "0.1.47"+name = "mbox"+version = "0.7.1"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b"+checksum = "26d142aeadbc4e8c679fc6d93fbe7efe1c021fa7d80629e615915b519e3bc6de"dependencies = [- "num-traits",+ "libc",+ "stable_deref_trait",][[package]]-name = "num-iter"-version = "0.1.46"+name = "memchr"+version = "2.8.3"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "c92800bd69a1eac91786bcfe9da64a897eb72911b8dc3095decbd07429e8048b"-dependencies = [- "num-integer",- "num-traits",-]+checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"[[package]]-name = "num-rational"+name = "num-derive"version = "0.4.2"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824"+checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202"dependencies = [- "num-bigint",- "num-integer",- "num-traits",+ "proc-macro2",+ "quote",+ "syn 2.0.119",][[package]]@@ -985,28 +444,12 @@ dependencies = ["serde",]-[[package]]-name = "once_cell"-version = "1.21.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"-[[package]]name = "opaque-debug"version = "0.3.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"-[[package]]-name = "ordered-stream"-version = "0.2.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50"-dependencies = [- "futures-core",- "pin-project-lite",-]-[[package]]name = "p256"version = "0.13.2"@@ -1016,15 +459,9 @@ dependencies = ["ecdsa","elliptic-curve","primeorder",- "sha2 0.10.9",+ "sha2",]-[[package]]-name = "parking"-version = "2.2.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba"-[[package]]name = "password-hash"version = "0.5.0"@@ -1080,23 +517,6 @@ dependencies = ["serde",]-[[package]]-name = "pin-project-lite"-version = "0.2.17"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"--[[package]]-name = "piper"-version = "0.2.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "c835479a4443ded371d6c535cbfd8d31ad92c5d23ae9770a61bc155e4992a3c1"-dependencies = [- "atomic-waker",- "fastrand",- "futures-io",-]-[[package]]name = "pkcs8"version = "0.10.2"@@ -1113,20 +533,6 @@ version = "0.3.34"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548"-[[package]]-name = "polling"-version = "3.11.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218"-dependencies = [- "cfg-if",- "concurrent-queue",- "hermit-abi",- "pin-project-lite",- "rustix",- "windows-sys",-]-[[package]]name = "polyval"version = "0.6.2"@@ -1134,7 +540,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25"dependencies = ["cfg-if",- "cpufeatures 0.2.17",+ "cpufeatures","opaque-debug","universal-hash",]@@ -1148,15 +554,6 @@ dependencies = ["elliptic-curve",]-[[package]]-name = "proc-macro-crate"-version = "3.5.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f"-dependencies = [- "toml_edit",-]-[[package]]name = "proc-macro2"version = "1.0.107"@@ -1225,29 +622,10 @@ version = "0.4.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2"dependencies = [- "hmac 0.12.1",+ "hmac","subtle",]-[[package]]-name = "rustix"-version = "1.1.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "891efababe418670775f199f0d233d84843c227a0949a883ce15b37c78d6629d"-dependencies = [- "bitflags",- "errno",- "libc",- "linux-raw-sys",- "windows-sys",-]--[[package]]-name = "rustversion"-version = "1.0.23"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"-[[package]]name = "sec1"version = "0.7.3"@@ -1262,25 +640,6 @@ dependencies = ["zeroize",]-[[package]]-name = "secret-service"-version = "5.2.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "5107b24b91445dd2aa449a258a1807b63240942157292354dc5bfdbeb8bc6db8"-dependencies = [- "aes 0.9.3",- "cbc",- "futures-util",- "getrandom 0.4.3",- "hkdf 0.13.0",- "hybrid-array",- "num",- "once_cell",- "serde",- "sha2 0.11.1",- "zbus",-]-[[package]]name = "serde"version = "1.0.229"@@ -1334,17 +693,6 @@ dependencies = ["zmij",]-[[package]]-name = "serde_repr"-version = "0.1.21"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "8d3b1629de253c70a0508c3899572da79ca359fdab27c7920ff00406df418906"-dependencies = [- "proc-macro2",- "quote",- "syn 3.0.9",-]-[[package]]name = "sha2"version = "0.10.9"@@ -1352,29 +700,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"dependencies = ["cfg-if",- "cpufeatures 0.2.17",- "digest 0.10.7",-]--[[package]]-name = "sha2"-version = "0.11.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "47d7069beb7d6ac7b9acd1039986e73443f24234f41074da099d6f994ac9ad19"-dependencies = [- "cfg-if",- "cpufeatures 0.3.1",- "digest 0.11.3",-]--[[package]]-name = "signal-hook-registry"-version = "1.4.8"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b"-dependencies = [- "errno",- "libc",+ "cpufeatures",+ "digest",][[package]]@@ -1383,16 +710,10 @@ version = "2.2.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de"dependencies = [- "digest 0.10.7",+ "digest","rand_core",]-[[package]]-name = "slab"-version = "0.4.12"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"-[[package]]name = "spki"version = "0.7.3"@@ -1443,86 +764,12 @@ version = "0.12.16"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"-[[package]]-name = "tempfile"-version = "3.27.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"-dependencies = [- "fastrand",- "getrandom 0.4.3",- "once_cell",- "rustix",- "windows-sys",-]-[[package]]name = "tinyvec"version = "1.13.3"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee"-[[package]]-name = "toml_datetime"-version = "1.1.2+spec-1.1.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "2b86d767906c6c42421dcba507eb9d203e779497710a47782a224bb871653053"-dependencies = [- "serde_core",-]--[[package]]-name = "toml_edit"-version = "0.25.17+spec-1.1.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e3641d5bbb5349a79e1020a242d251efbc546ad8048d133958323ce9c40a9c9c"-dependencies = [- "indexmap",- "toml_datetime",- "toml_parser",- "winnow",-]--[[package]]-name = "toml_parser"-version = "1.1.5+spec-1.1.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c"-dependencies = [- "winnow",-]--[[package]]-name = "tracing"-version = "0.1.44"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"-dependencies = [- "pin-project-lite",- "tracing-attributes",- "tracing-core",-]--[[package]]-name = "tracing-attributes"-version = "0.1.31"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"-dependencies = [- "proc-macro2",- "quote",- "syn 2.0.119",-]--[[package]]-name = "tracing-core"-version = "0.1.36"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a"-dependencies = [- "once_cell",-]-[[package]]name = "tss-esapi"version = "7.7.0"@@ -1562,17 +809,6 @@ version = "1.20.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"-[[package]]-name = "uds_windows"-version = "1.2.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e"-dependencies = [- "memoffset",- "tempfile",- "windows-sys",-]-[[package]]name = "unicode-ident"version = "1.0.27"@@ -1594,21 +830,10 @@ version = "0.5.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea"dependencies = [- "crypto-common 0.1.6",+ "crypto-common","subtle",]-[[package]]-name = "uuid"-version = "1.28.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7cc1186384beb7dd8eedea376413fd654937285ea6c9cfbb928dc3043ea4b606"-dependencies = [- "js-sys",- "serde_core",- "wasm-bindgen",-]-[[package]]name = "version_check"version = "0.9.5"@@ -1621,145 +846,6 @@ version = "0.11.1+wasi-snapshot-preview1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"-[[package]]-name = "wasm-bindgen"-version = "0.2.129"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409"-dependencies = [- "cfg-if",- "once_cell",- "rustversion",- "wasm-bindgen-macro",- "wasm-bindgen-shared",-]--[[package]]-name = "wasm-bindgen-macro"-version = "0.2.129"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535"-dependencies = [- "quote",- "wasm-bindgen-macro-support",-]--[[package]]-name = "wasm-bindgen-macro-support"-version = "0.2.129"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7"-dependencies = [- "bumpalo",- "proc-macro2",- "quote",- "syn 3.0.9",- "wasm-bindgen-shared",-]--[[package]]-name = "wasm-bindgen-shared"-version = "0.2.129"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6"-dependencies = [- "unicode-ident",-]--[[package]]-name = "windows-link"-version = "0.2.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"--[[package]]-name = "windows-sys"-version = "0.61.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"-dependencies = [- "windows-link",-]--[[package]]-name = "winnow"-version = "1.0.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81"-dependencies = [- "memchr",-]--[[package]]-name = "zbus"-version = "5.19.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "5db4be7c075cb421e4b7ee645541604239bd243ba7c357511f4ff3a74b555907"-dependencies = [- "async-broadcast",- "async-executor",- "async-io",- "async-lock",- "async-process",- "async-recursion",- "async-task",- "async-trait",- "blocking",- "enumflags2",- "event-listener",- "futures-core",- "futures-lite",- "hex",- "libc",- "ordered-stream",- "rustix",- "serde",- "serde_repr",- "tracing",- "uds_windows",- "uuid",- "windows-sys",- "winnow",- "zbus_macros",- "zbus_names",- "zvariant",-]--[[package]]-name = "zbus_macros"-version = "5.19.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "2990635d09ade6df1868f72f8cac69a876a90981e8bd3c40b1be413f8dc88f40"-dependencies = [- "proc-macro-crate",- "proc-macro2",- "quote",- "syn 3.0.9",- "zbus_names",- "zvariant",- "zvariant_utils",-]--[[package]]-name = "zbus_names"-version = "4.3.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "812a12be4ead7a59e18ea8f047d08add0066b73bc62fc1467066a2472ae088dd"-dependencies = [- "serde",- "winnow",- "zvariant",-]--[[package]]-name = "zcheapstr"-version = "1.1.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d1afec51604565183aeb5c54c20aeab286120d4e4460f7f76e3e8bb8c0d99473"-dependencies = [- "serde",-]-[[package]]name = "zeroize"version = "1.9.1"@@ -1785,44 +871,3 @@ name = "zmij"version = "1.0.23"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"--[[package]]-name = "zvariant"-version = "5.15.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "80bf6d6cd6a4b601acb64cfb8284cdc643fcfa75ef26ae3c46ec8aa4e8a1fbb7"-dependencies = [- "endi",- "enumflags2",- "serde",- "winnow",- "zcheapstr",- "zvariant_derive",- "zvariant_utils",-]--[[package]]-name = "zvariant_derive"-version = "5.15.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ef2672456ba1cb54b5eaec136e63135b3c7495fb938e53b28a62e633496d486d"-dependencies = [- "proc-macro-crate",- "proc-macro2",- "quote",- "syn 3.0.9",- "zvariant_utils",-]--[[package]]-name = "zvariant_utils"-version = "4.2.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "bad0294361a320b694a328460dc73add56c306150f5cb6bfafc44446120008a3"-dependencies = [- "proc-macro2",- "quote",- "serde",- "syn 3.0.9",- "winnow",-]diff --git a/home/desktop/agent/Cargo.toml b/home/desktop/agent/Cargo.tomlindex 4fef2807..17854576 100644--- a/home/desktop/agent/Cargo.toml+++ b/home/desktop/agent/Cargo.toml@@ -4,7 +4,7 @@ version = "0.1.0"edition = "2021"license = "MIT"publish = false-description = "bento/id agent core for the desktop host (Windows, Linux): the signed statements, key storage and the agent contract"+description = "bento/connect agent core for the desktop host (Windows, Linux): the signed statements, key storage and the agent contract"[dependencies]p256 = { version = "0.13", features = ["ecdsa"] }@@ -19,13 +19,18 @@ unicode-normalization = "0.1"[target.'cfg(target_os = "linux")'.dependencies]tss-esapi = { version = "7", optional = true }-secret-service = { version = "5", features = ["rt-async-io-crypto-rust"], optional = true }[features]# the Linux TPM key store (needs libtss2)tpm = ["dep:tss-esapi"]-# the Linux no-TPM key store (freedesktop Secret Service)-keyring = ["dep:secret-service"]+# the Linux no-TPM key store: the DISTRIBUTION libsecret (thin in-tree FFI)+keyring = []+# security keys through the DISTRIBUTION libfido2 (>= 1.12), Linux only+fido = []+# TEST-ONLY mutants for the PRF interop rig (fido-rig.sh): each must make+# tests/fido_interop.rs FAIL. Never enabled in a shipped build.+rig-mutant-double-hash = ["fido"]+rig-mutant-raw-hash = ["fido"]# the in-memory software key store: tests and rigs only, never a shipped pathtest-store = []diff --git a/home/desktop/agent/deny.toml b/home/desktop/agent/deny.tomlnew file mode 100644index 00000000..a7ee09da--- /dev/null+++ b/home/desktop/agent/deny.toml@@ -0,0 +1,40 @@+# cargo-deny policy for the SHIPPED desktop agent (security §34). Test-only+# crates (agent-testkit) are separate crates with their own policy and are+# proven absent from this graph by supply-chain-check.sh.+[graph]+all-features = true+targets = [+ { triple = "x86_64-unknown-linux-gnu" },+ { triple = "aarch64-unknown-linux-gnu" },+ { triple = "x86_64-pc-windows-msvc" },+]++[advisories]+version = 2+yanked = "deny"++[licenses]+version = 2+# Permissive only: no GPL/LGPL/AGPL/MPL can enter the shipped graph unnoticed.+allow = [+ "MIT",+ "Apache-2.0",+ "Apache-2.0 WITH LLVM-exception",+ "BSD-2-Clause",+ "BSD-3-Clause",+ "ISC",+ "Zlib",+ "Unicode-3.0",+ "Unicode-DFS-2016",+ "CC0-1.0",+]+confidence-threshold = 0.9++[bans]+multiple-versions = "allow"+wildcards = "deny"++[sources]+unknown-registry = "deny"+unknown-git = "deny"+allow-registry = ["https://github.com/rust-lang/crates.io-index"]diff --git a/home/desktop/agent/fido-rig.sh b/home/desktop/agent/fido-rig.shnew file mode 100755index 00000000..8b50d744--- /dev/null+++ b/home/desktop/agent/fido-rig.sh@@ -0,0 +1,45 @@+#!/usr/bin/env bash+# The PRF interop rig (security §34), Linux. One virtual OpenSK key+# (agent-testkit, test-only), an independent WebAuthn client (python-fido2),+# and the agent's libfido2 layer must agree byte for byte; then each mutant+# build must FAIL that test ON THE COMPARISON.+#+# BENTO_RIG_IN_CONTAINER=1: a privileged container (mount devtmpfs, start+# udevd, run as root). Otherwise a CI VM with sudo: load uhid, run only the+# virtual key as root, and open its hidraw node to this user.+set -euo pipefail+cd "$(dirname "$0")"+if [ "${BENTO_RIG_IN_CONTAINER:-}" = 1 ]; then+ mount -t devtmpfs none /dev+ /lib/systemd/systemd-udevd --daemon >/dev/null 2>&1+ SUDO=""+else+ sudo modprobe uhid+ SUDO="sudo"+fi+# Build first (synchronously: a cold nightly build outlasts any wait).+( cd ../agent-testkit && cargo build -q )+cargo build -q --features fido --tests+$SUDO ../agent-testkit/target/debug/bento-agent-testkit 2>/tmp/kit.log &+dev=""+for i in $(seq 1 30); do+ dev=$(grep -l "HID_ID=0003:00001209:0000BE71" /sys/class/hidraw/*/device/uevent 2>/dev/null | head -1 | sed -E 's#/sys/class/hidraw/([^/]+)/.*#/dev/\1#') || true+ [ -n "$dev" ] && [ -e "$dev" ] && break; sleep 1+done+[ -n "$dev" ] && [ -e "$dev" ] || { cat /tmp/kit.log; echo "FAIL: the virtual key never appeared"; exit 1; }+[ -n "$SUDO" ] && sudo chmod a+rw "$dev"+command -v udevadm >/dev/null && udevadm trigger 2>/dev/null || true; sleep 1+# Isolated (-I): no user site-packages, no PYTHONPATH. On CI the pinned+# python-fido2 lives in a venv (BENTO_RIG_PYTHON), whose own site-packages -I+# keeps; a plain user-site install is invisible to -I (the first CI run failed+# exactly so).+"${BENTO_RIG_PYTHON:-python3}" -I ../agent-testkit/prf_client.py /tmp/rig.json+export BENTO_FIDO_RIG=/tmp/rig.json+out=$(cargo test --features fido --test fido_interop 2>&1) || { echo "$out"; exit 1; }+echo "$out" | grep -qE "test result: ok\. 1 passed" || { echo "$out"; echo "FAIL: the interop test did not run"; exit 1; }+echo "interop: PASS (agent == python-fido2)"+for m in rig-mutant-double-hash rig-mutant-raw-hash; do+ mout=$(cargo test --features "$m" --test fido_interop 2>&1) && { echo "FAIL: mutant $m was NOT caught"; exit 1; }+ echo "$mout" | grep -q "equals the independent WebAuthn client" || { echo "$mout" | tail -20; echo "FAIL: mutant $m failed for the wrong reason"; exit 1; }+ echo "mutant $m: caught on the PRF comparison"+donediff --git a/home/desktop/agent/src/fido_linux.rs b/home/desktop/agent/src/fido_linux.rsnew file mode 100644index 00000000..7a1d88e4--- /dev/null+++ b/home/desktop/agent/src/fido_linux.rs@@ -0,0 +1,348 @@+// SPDX-License-Identifier: MIT+// Copyright (c) 2026 The Bento authors+//+// The Linux authenticator layer (H1d): security keys over CTAP-HID through+// the DISTRIBUTION's libfido2 (Yubico, BSD-2-Clause), declared minimum 1.12.+// A thin in-tree FFI over the ~30 calls we use — no binding crate, no bundled+// libfido2, no OpenSSL crate in the shipped graph (security §34). Windows does+// NOT use this: it goes through webauthn.dll only.+//+// THE PRF TRANSFORM HAPPENS EXACTLY ONCE, HERE. Callers pass the raw PRF input+// (e.g. webauthn::PRF_INPUT); this layer turns it into the CTAP hmac-secret salt+// with webauthn::prf_salt and hands THAT to libfido2, which applies nothing+// further. Passing a pre-hashed salt in would double-hash: deterministic, so+// nothing errors, but never equal to what the same key yields on the web.++use crate::webauthn::{client_data, client_data_hash, prf_salt, Ceremony, Platform};+use std::ffi::{CStr, CString};+use std::os::raw::{c_char, c_int, c_uchar};+use std::ptr;+use zeroize::Zeroizing;++#[allow(non_camel_case_types)]+type fido_dev_t = std::ffi::c_void;+#[allow(non_camel_case_types)]+type fido_assert_t = std::ffi::c_void;+#[allow(non_camel_case_types)]+type fido_cred_t = std::ffi::c_void;+#[allow(non_camel_case_types)]+type fido_dev_info_t = std::ffi::c_void;++const FIDO_OK: c_int = 0;+const FIDO_OPT_TRUE: c_int = 2;+const FIDO_EXT_HMAC_SECRET: c_int = 0x01;+const COSE_ES256: c_int = -7;+const FIDO_ERR_UNSUPPORTED_EXTENSION: c_int = 0x16;+const FIDO_ERR_OPERATION_DENIED: c_int = 0x27;+const FIDO_ERR_NO_CREDENTIALS: c_int = 0x2e;+const FIDO_ERR_PIN_INVALID: c_int = 0x31;+const FIDO_ERR_PIN_BLOCKED: c_int = 0x32;+const FIDO_ERR_PIN_AUTH_BLOCKED: c_int = 0x34;+const FIDO_ERR_PIN_REQUIRED: c_int = 0x36;+const FIDO_ERR_ACTION_TIMEOUT: c_int = 0x3a;+const FIDO_ERR_UV_INVALID: c_int = 0x3f;++#[link(name = "fido2")]+extern "C" {+ fn fido_init(flags: c_int);+ fn fido_strerr(n: c_int) -> *const c_char;+ fn fido_dev_info_new(n: usize) -> *mut fido_dev_info_t;+ fn fido_dev_info_free(di: *mut *mut fido_dev_info_t, n: usize);+ fn fido_dev_info_manifest(di: *mut fido_dev_info_t, ilen: usize, olen: *mut usize) -> c_int;+ fn fido_dev_info_ptr(di: *const fido_dev_info_t, i: usize) -> *const fido_dev_info_t;+ fn fido_dev_info_path(di: *const fido_dev_info_t) -> *const c_char;+ fn fido_dev_new() -> *mut fido_dev_t;+ fn fido_dev_free(d: *mut *mut fido_dev_t);+ fn fido_dev_open(d: *mut fido_dev_t, path: *const c_char) -> c_int;+ fn fido_dev_close(d: *mut fido_dev_t) -> c_int;+ fn fido_dev_get_assert(d: *mut fido_dev_t, a: *mut fido_assert_t, pin: *const c_char) -> c_int;+ fn fido_dev_make_cred(d: *mut fido_dev_t, c: *mut fido_cred_t, pin: *const c_char) -> c_int;+ fn fido_assert_new() -> *mut fido_assert_t;+ fn fido_assert_free(a: *mut *mut fido_assert_t);+ fn fido_assert_set_rp(a: *mut fido_assert_t, id: *const c_char) -> c_int;+ fn fido_assert_set_clientdata_hash(a: *mut fido_assert_t, p: *const c_uchar, n: usize) -> c_int;+ fn fido_assert_set_extensions(a: *mut fido_assert_t, ext: c_int) -> c_int;+ fn fido_assert_set_hmac_salt(a: *mut fido_assert_t, p: *const c_uchar, n: usize) -> c_int;+ fn fido_assert_set_up(a: *mut fido_assert_t, o: c_int) -> c_int;+ fn fido_assert_set_uv(a: *mut fido_assert_t, o: c_int) -> c_int;+ fn fido_assert_count(a: *const fido_assert_t) -> usize;+ fn fido_assert_id_ptr(a: *const fido_assert_t, i: usize) -> *const c_uchar;+ fn fido_assert_id_len(a: *const fido_assert_t, i: usize) -> usize;+ fn fido_assert_authdata_ptr(a: *const fido_assert_t, i: usize) -> *const c_uchar;+ fn fido_assert_authdata_len(a: *const fido_assert_t, i: usize) -> usize;+ fn fido_assert_sig_ptr(a: *const fido_assert_t, i: usize) -> *const c_uchar;+ fn fido_assert_sig_len(a: *const fido_assert_t, i: usize) -> usize;+ fn fido_assert_hmac_secret_ptr(a: *const fido_assert_t, i: usize) -> *const c_uchar;+ fn fido_assert_hmac_secret_len(a: *const fido_assert_t, i: usize) -> usize;+ fn fido_assert_user_id_ptr(a: *const fido_assert_t, i: usize) -> *const c_uchar;+ fn fido_assert_user_id_len(a: *const fido_assert_t, i: usize) -> usize;+ fn fido_cred_new() -> *mut fido_cred_t;+ fn fido_cred_free(c: *mut *mut fido_cred_t);+ fn fido_cred_set_type(c: *mut fido_cred_t, cose: c_int) -> c_int;+ fn fido_cred_set_clientdata_hash(c: *mut fido_cred_t, p: *const c_uchar, n: usize) -> c_int;+ fn fido_cred_set_rp(c: *mut fido_cred_t, id: *const c_char, name: *const c_char) -> c_int;+ fn fido_cred_set_user(+ c: *mut fido_cred_t,+ id: *const c_uchar,+ n: usize,+ name: *const c_char,+ display: *const c_char,+ icon: *const c_char,+ ) -> c_int;+ fn fido_cred_set_rk(c: *mut fido_cred_t, o: c_int) -> c_int;+ fn fido_cred_set_uv(c: *mut fido_cred_t, o: c_int) -> c_int;+ fn fido_cred_set_extensions(c: *mut fido_cred_t, ext: c_int) -> c_int;+ fn fido_cred_id_ptr(c: *const fido_cred_t) -> *const c_uchar;+ fn fido_cred_id_len(c: *const fido_cred_t) -> usize;+ fn fido_cred_authdata_ptr(c: *const fido_cred_t) -> *const c_uchar;+ fn fido_cred_authdata_len(c: *const fido_cred_t) -> usize;+}++/// Why a ceremony gave nothing. Tri-state as everywhere else: the person+/// (declined / wrong PIN / cancelled), no matching credential, or an outage.+#[derive(Debug, Clone, PartialEq, Eq)]+pub enum FidoError {+ Declined(String),+ NoCredential,+ PinRequired,+ Unavailable(String),+}++fn err(code: c_int) -> FidoError {+ let msg = unsafe { CStr::from_ptr(fido_strerr(code)) }.to_string_lossy().into_owned();+ match code {+ FIDO_ERR_OPERATION_DENIED | FIDO_ERR_ACTION_TIMEOUT | FIDO_ERR_PIN_INVALID | FIDO_ERR_PIN_BLOCKED+ | FIDO_ERR_PIN_AUTH_BLOCKED | FIDO_ERR_UV_INVALID => FidoError::Declined(msg),+ FIDO_ERR_NO_CREDENTIALS => FidoError::NoCredential,+ FIDO_ERR_PIN_REQUIRED => FidoError::PinRequired,+ FIDO_ERR_UNSUPPORTED_EXTENSION => FidoError::Unavailable(format!("no hmac-secret: {msg}")),+ _ => FidoError::Unavailable(msg),+ }+}+fn ok(code: c_int) -> Result<(), FidoError> {+ if code == FIDO_OK { Ok(()) } else { Err(err(code)) }+}+unsafe fn bytes(p: *const c_uchar, n: usize) -> Vec<u8> {+ if p.is_null() || n == 0 { Vec::new() } else { std::slice::from_raw_parts(p, n).to_vec() }+}++/// libfido2 returns authenticatorData CBOR-wrapped (a byte string); verifiers+/// want the raw bytes. Unwrap exactly one CBOR major-type-2 header.+pub fn unwrap_cbor_bstr(v: &[u8]) -> Option<Vec<u8>> {+ let (&h, rest) = v.split_first()?;+ if h >> 5 != 2 {+ return None;+ }+ let (len, body) = match h & 0x1f {+ n @ 0..=23 => (n as usize, rest),+ 24 => (*rest.first()? as usize, &rest[1..]),+ 25 => (u16::from_be_bytes([*rest.first()?, *rest.get(1)?]) as usize, &rest[2..]),+ _ => return None,+ };+ (body.len() == len).then(|| body.to_vec())+}++/// The security key's PIN as a NUL-terminated buffer that is zeroized when+/// dropped (the host draws the PIN prompt; it never comes from the page).+fn pin_bytes(pin: Option<&str>) -> Result<Option<Zeroizing<Vec<u8>>>, FidoError> {+ match pin {+ None => Ok(None),+ Some(p) if p.as_bytes().contains(&0) => Err(FidoError::Unavailable("PIN contains NUL".into())),+ Some(p) => {+ let mut v = Zeroizing::new(Vec::with_capacity(p.len() + 1));+ v.extend_from_slice(p.as_bytes());+ v.push(0);+ Ok(Some(v))+ }+ }+}++fn init() {+ static ONCE: std::sync::Once = std::sync::Once::new();+ ONCE.call_once(|| unsafe { fido_init(0) });+}++/// Paths of the FIDO devices present (hidraw on Linux).+pub fn devices() -> Result<Vec<String>, FidoError> {+ init();+ unsafe {+ let mut di = fido_dev_info_new(16);+ if di.is_null() {+ return Err(FidoError::Unavailable("libfido2 could not allocate".into()));+ }+ let mut n = 0usize;+ let r = fido_dev_info_manifest(di, 16, &mut n);+ let out = (0..n)+ .map(|i| CStr::from_ptr(fido_dev_info_path(fido_dev_info_ptr(di, i))).to_string_lossy().into_owned())+ .collect();+ fido_dev_info_free(&mut di, 16);+ ok(r)?;+ Ok(out)+ }+}++struct Dev(*mut fido_dev_t);+impl Dev {+ fn open(path: &str) -> Result<Dev, FidoError> {+ init();+ let c = CString::new(path).map_err(|e| FidoError::Unavailable(e.to_string()))?;+ unsafe {+ let d = fido_dev_new();+ if d.is_null() {+ return Err(FidoError::Unavailable("libfido2 could not allocate".into()));+ }+ let r = fido_dev_open(d, c.as_ptr());+ let dev = Dev(d);+ ok(r)?;+ Ok(dev)+ }+ }+}+impl Drop for Dev {+ fn drop(&mut self) {+ unsafe {+ fido_dev_close(self.0);+ fido_dev_free(&mut self.0);+ }+ }+}++/// One discoverable assertion with the PRF output (§2f step 2).+pub struct Assertion {+ pub credential_id: Vec<u8>,+ pub user_handle: Vec<u8>,+ /// raw authenticatorData (CBOR wrapper removed)+ pub authenticator_data: Vec<u8>,+ /// the authenticator's signature as returned (DER for ES256)+ pub signature: Vec<u8>,+ /// the exact clientDataJSON the signature covers+ pub client_data_json: String,+ /// the PRF output (CTAP hmac-secret output), 32 bytes+ pub prf: Zeroizing<Vec<u8>>,+}++/// The hmac-secret salt for a raw PRF input: prf_salt, ONCE. The two+/// `rig-mutant-*` features exist only so the interop rig can prove it catches+/// the two easy mistakes; a shipped build never enables them.+fn salt_for(prf_input: &[u8]) -> [u8; 32] {+ #[cfg(feature = "rig-mutant-double-hash")]+ return prf_salt(&prf_salt(prf_input));+ #[cfg(all(feature = "rig-mutant-raw-hash", not(feature = "rig-mutant-double-hash")))]+ {+ use sha2::{Digest, Sha256};+ return Sha256::digest(prf_input).into();+ }+ #[allow(unreachable_code)]+ prf_salt(prf_input)+}++/// A discoverable get with UP + UV and the PRF extension. `prf_input` is the+/// RAW PRF input: the salt transform is applied here, once.+pub fn get_assertion(+ path: &str,+ rp_id: &str,+ challenge: &[u8],+ prf_input: &[u8],+ pin: Option<&str>,+) -> Result<Vec<Assertion>, FidoError> {+ let dev = Dev::open(path)?;+ let cd = client_data(Ceremony::Get, challenge, Platform::Linux);+ let cdh = client_data_hash(&cd);+ let salt = salt_for(prf_input);+ let rp = CString::new(rp_id).map_err(|e| FidoError::Unavailable(e.to_string()))?;+ let pin_c = pin_bytes(pin)?;+ unsafe {+ let mut a = fido_assert_new();+ if a.is_null() {+ return Err(FidoError::Unavailable("libfido2 could not allocate".into()));+ }+ let res = (|| {+ ok(fido_assert_set_rp(a, rp.as_ptr()))?;+ ok(fido_assert_set_clientdata_hash(a, cdh.as_ptr(), cdh.len()))?;+ ok(fido_assert_set_extensions(a, FIDO_EXT_HMAC_SECRET))?;+ ok(fido_assert_set_hmac_salt(a, salt.as_ptr(), salt.len()))?;+ ok(fido_assert_set_up(a, FIDO_OPT_TRUE))?;+ ok(fido_assert_set_uv(a, FIDO_OPT_TRUE))?;+ ok(fido_dev_get_assert(dev.0, a, pin_c.as_ref().map_or(ptr::null(), |p| p.as_ptr() as *const c_char)))?;+ let mut out = vec![];+ for i in 0..fido_assert_count(a) {+ let prf = Zeroizing::new(bytes(fido_assert_hmac_secret_ptr(a, i), fido_assert_hmac_secret_len(a, i)));+ if prf.len() != 32 {+ return Err(FidoError::Unavailable("authenticator returned no hmac-secret output".into()));+ }+ let ad = bytes(fido_assert_authdata_ptr(a, i), fido_assert_authdata_len(a, i));+ out.push(Assertion {+ credential_id: bytes(fido_assert_id_ptr(a, i), fido_assert_id_len(a, i)),+ user_handle: bytes(fido_assert_user_id_ptr(a, i), fido_assert_user_id_len(a, i)),+ authenticator_data: unwrap_cbor_bstr(&ad).ok_or(FidoError::Unavailable("authdata".into()))?,+ signature: bytes(fido_assert_sig_ptr(a, i), fido_assert_sig_len(a, i)),+ client_data_json: cd.clone(),+ prf,+ });+ }+ Ok(out)+ })();+ fido_assert_free(&mut a);+ res+ }+}++pub struct Credential {+ pub credential_id: Vec<u8>,+ pub authenticator_data: Vec<u8>,+ pub client_data_json: String,+}++/// Create a discoverable ES256 credential with hmac-secret (needed for PRF).+pub fn make_credential(+ path: &str,+ rp_id: &str,+ challenge: &[u8],+ user_id: &[u8],+ user_name: &str,+ pin: Option<&str>,+) -> Result<Credential, FidoError> {+ let dev = Dev::open(path)?;+ let cd = client_data(Ceremony::Create, challenge, Platform::Linux);+ let cdh = client_data_hash(&cd);+ let c = |s: &str| CString::new(s).map_err(|e| FidoError::Unavailable(e.to_string()));+ let (rp, name) = (c(rp_id)?, c(user_name)?);+ let pin_c = pin_bytes(pin)?;+ unsafe {+ let mut cr = fido_cred_new();+ if cr.is_null() {+ return Err(FidoError::Unavailable("libfido2 could not allocate".into()));+ }+ let res = (|| {+ ok(fido_cred_set_type(cr, COSE_ES256))?;+ ok(fido_cred_set_clientdata_hash(cr, cdh.as_ptr(), cdh.len()))?;+ ok(fido_cred_set_rp(cr, rp.as_ptr(), rp.as_ptr()))?;+ ok(fido_cred_set_user(cr, user_id.as_ptr(), user_id.len(), name.as_ptr(), name.as_ptr(), ptr::null()))?;+ ok(fido_cred_set_rk(cr, FIDO_OPT_TRUE))?;+ ok(fido_cred_set_uv(cr, FIDO_OPT_TRUE))?;+ ok(fido_cred_set_extensions(cr, FIDO_EXT_HMAC_SECRET))?;+ ok(fido_dev_make_cred(dev.0, cr, pin_c.as_ref().map_or(ptr::null(), |p| p.as_ptr() as *const c_char)))?;+ let ad = bytes(fido_cred_authdata_ptr(cr), fido_cred_authdata_len(cr));+ Ok(Credential {+ credential_id: bytes(fido_cred_id_ptr(cr), fido_cred_id_len(cr)),+ authenticator_data: unwrap_cbor_bstr(&ad).ok_or(FidoError::Unavailable("authdata".into()))?,+ client_data_json: cd.clone(),+ })+ })();+ fido_cred_free(&mut cr);+ res+ }+}++#[cfg(test)]+mod tests {+ use super::unwrap_cbor_bstr;+ #[test]+ fn cbor_bstr_unwrap() {+ assert_eq!(unwrap_cbor_bstr(&[0x43, 1, 2, 3]), Some(vec![1, 2, 3]));+ let long: Vec<u8> = std::iter::once(0x58).chain(std::iter::once(37)).chain(vec![9u8; 37]).collect();+ assert_eq!(unwrap_cbor_bstr(&long).map(|v| v.len()), Some(37));+ assert_eq!(unwrap_cbor_bstr(&[0x43, 1, 2]), None, "length mismatch refused");+ assert_eq!(unwrap_cbor_bstr(&[0x63, 1, 2, 3]), None, "a text string is not a byte string");+ }+}diff --git a/home/desktop/agent/src/lib.rs b/home/desktop/agent/src/lib.rsindex 861c2570..54129a1b 100644--- a/home/desktop/agent/src/lib.rs+++ b/home/desktop/agent/src/lib.rs@@ -1,7 +1,7 @@// SPDX-License-Identifier: MIT// Copyright (c) 2026 The Bento authors//-// bento/id — the desktop agent core (Windows, Linux).+// bento/connect — the desktop agent core (Windows, Linux).//// The reference for every byte is kernel/src/statements.ts and// kernel/src/address.ts; the CONTRACT is kernel/fixtures/identity-v1.json,@@ -13,6 +13,7 @@ pub mod address;pub mod agent;pub mod b64u;pub mod device_list;+pub mod webauthn;pub mod recovery;mod display_table;pub mod statements;@@ -22,3 +23,6 @@ pub mod tpm_linux;#[cfg(all(target_os = "linux", feature = "keyring"))]pub mod secret_linux;++#[cfg(all(target_os = "linux", feature = "fido"))]+pub mod fido_linux;diff --git a/home/desktop/agent/src/recovery.rs b/home/desktop/agent/src/recovery.rsindex 337b4571..f4128898 100644--- a/home/desktop/agent/src/recovery.rs+++ b/home/desktop/agent/src/recovery.rs@@ -1,7 +1,7 @@// SPDX-License-Identifier: MIT// Copyright (c) 2026 The Bento authors//-// bento/id — the recovery code and the key blobs, a port of+// bento/connect — the recovery code and the key blobs, a port of// kernel/src/recovery.ts (identity-design §2f, security §28). Every value is// DETERMINISTIC in kernel/fixtures/recovery-v1.json, so this port reproduces the// exact bytes end to end; tests/recovery.rs runs every row.@@ -30,6 +30,69 @@ pub const ARGON2_TAG_LEN: usize = 32;pub const SALT_LEN: usize = 16;pub const CODE_BYTES: usize = 10;+/// Free memory Argon2id insists on beyond its own working set.+pub const MEMORY_HEADROOM_KIB: u64 = 64 * 1024;++#[cfg(test)]+thread_local! {+ /// Unit tests only: pretend this much memory is available (KiB). Not in+ /// any build but `cargo test` of this crate (security, #823 review).+ static AVAILABLE_OVERRIDE_KIB: std::cell::Cell<Option<u64>> = const { std::cell::Cell::new(None) };+}++/// Physical memory available to THIS process right now, in KiB, where the+/// platform says. Linux: /proc/meminfo MemAvailable, capped by every cgroup v2+/// ancestor's (memory.max − memory.current) — Flatpak, Snap and containers set+/// those, and MemAvailable ignores them. Windows: GlobalMemoryStatusEx (owed+/// with the Windows store). Elsewhere: unknown (None).+pub fn available_memory_kib() -> Option<u64> {+ #[cfg(test)]+ if let Some(v) = AVAILABLE_OVERRIDE_KIB.with(|c| c.get()) {+ return Some(v);+ }+ #[cfg(target_os = "linux")]+ {+ let info = std::fs::read_to_string("/proc/meminfo").ok()?;+ let line = info.lines().find(|l| l.starts_with("MemAvailable:"))?;+ let mem: u64 = line.split_whitespace().nth(1)?.parse().ok()?;+ let cg = std::fs::read_to_string("/proc/self/cgroup").ok();+ return Some(match cg.as_deref().and_then(cgroup_v2_path) {+ Some(path) => mem.min(cgroup_free_kib(std::path::Path::new("/sys/fs/cgroup"), &path).unwrap_or(u64::MAX)),+ None => mem,+ });+ }+ #[allow(unreachable_code)]+ None+}++/// The unified (v2) hierarchy path from /proc/self/cgroup ("0::/a/b").+#[cfg(any(target_os = "linux", test))]+fn cgroup_v2_path(proc_cgroup: &str) -> Option<String> {+ proc_cgroup.lines().find_map(|l| l.strip_prefix("0::")).map(|p| p.trim().to_string())+}++/// The tightest (memory.max − memory.current) from `path` up to the root of+/// the cgroup v2 mount, in KiB; None when no ancestor sets a limit.+#[cfg(any(target_os = "linux", test))]+fn cgroup_free_kib(root: &std::path::Path, path: &str) -> Option<u64> {+ let mut best: Option<u64> = None;+ let mut dir = root.join(path.trim_start_matches('/'));+ loop {+ let max = std::fs::read_to_string(dir.join("memory.max")).ok();+ let cur = std::fs::read_to_string(dir.join("memory.current")).ok();+ if let (Some(max), Some(cur)) = (max, cur) {+ if let (Ok(max), Ok(cur)) = (max.trim().parse::<u64>(), cur.trim().parse::<u64>()) {+ let free = max.saturating_sub(cur) / 1024;+ best = Some(best.map_or(free, |b| b.min(free)));+ }+ }+ if dir == root || !dir.pop() || !dir.starts_with(root) {+ break;+ }+ }+ best+}+/// Raw Argon2id with explicit parameters, an optional secret and associated/// data (the RFC 9106 §5.3 vector needs both). Our derivations use `argon2id`.pub fn argon2id_raw(@@ -53,15 +116,40 @@ pub fn argon2id_raw(Some(s) => Argon2::new_with_secret(s, Algorithm::Argon2id, Version::V0x13, params).map_err(|e| e.to_string())?,None => Argon2::new(Algorithm::Argon2id, Version::V0x13, params),};+ // FAIL CLOSED ON LOW MEMORY. A Rust allocation failure ABORTS the process+ // rather than returning an error (home-android saw the same with+ // OutOfMemoryError: catching it did not fail closed). And a fallible+ // reservation is NOT enough on its own (measured: with overcommit a 4 TiB+ // try_reserve SUCCEEDS, and the process is SIGKILLed later when the pages are+ // touched). So: check the AVAILABLE physical memory first (need + headroom),+ // then reserve fallibly and hand the buffer to the crate, which allocates+ // nothing itself.+ let blocks = a.params().block_count();+ let need_kib = blocks as u64; // one Argon2 block = 1 KiB+ if let Some(avail) = available_memory_kib() {+ if avail < need_kib + MEMORY_HEADROOM_KIB {+ return Err(format!("not enough free memory for Argon2id: need {need_kib} KiB + {MEMORY_HEADROOM_KIB} KiB headroom, {avail} KiB available"));+ }+ }+ let mut memory: Vec<argon2::Block> = Vec::new();+ memory+ .try_reserve_exact(blocks)+ .map_err(|_| format!("not enough memory for Argon2id ({} KiB)", blocks))?;+ memory.resize(blocks, argon2::Block::default());let mut out = Zeroizing::new(vec![0u8; tag_len]);- a.hash_password_into(password, salt, &mut out).map_err(|e| e.to_string())?;+ let r = a.hash_password_into_with_memory(password, salt, &mut out, &mut memory);+ // the working memory held password-derived state: wipe it+ for b in memory.iter_mut() {+ *b = argon2::Block::default();+ }+ r.map_err(|e| e.to_string())?;Ok(out)}/// Argon2id with OUR parameters (v0x13, p=1, 64 MiB, t=3, 32 bytes).-pub fn argon2id(password: &[u8], salt: &[u8]) -> Secret {+/// Err when the 64 MiB cannot be reserved: refuse cleanly, never abort.+pub fn argon2id(password: &[u8], salt: &[u8]) -> Result<Secret, String> {argon2id_raw(password, salt, None, None, ARGON2_MEMORY_KIB, ARGON2_PASSES, ARGON2_PARALLELISM, ARGON2_TAG_LEN)- .expect("fixed Argon2id parameters are valid")}// --- the recovery code: 80 bits, Crockford base32, with a check symbol ----------@@ -151,13 +239,13 @@ fn hkdf(ikm: &[u8], salt: &[u8], info: &str) -> Secret {}/// HKDF-SHA-256(Argon2id(code, salt), empty, "bento/id/rc-wrap/v1").-pub fn recovery_wrap_key(code: &[u8], salt: &[u8]) -> Secret {+pub fn recovery_wrap_key(code: &[u8], salt: &[u8]) -> Result<Secret, String> {assert_eq!((code.len(), salt.len()), (CODE_BYTES, SALT_LEN));- hkdf(&argon2id(code, salt), &[], "bento/id/rc-wrap/v1")+ Ok(hkdf(&argon2id(code, salt)?, &[], "bento/id/rc-wrap/v1"))}/// What the client sends the directory: Argon2id(code, salt_v).-pub fn recovery_verifier(code: &[u8], salt_v: &[u8]) -> Secret {+pub fn recovery_verifier(code: &[u8], salt_v: &[u8]) -> Result<Secret, String> {assert_eq!((code.len(), salt_v.len()), (CODE_BYTES, SALT_LEN));argon2id(code, salt_v)}@@ -329,3 +417,43 @@ pub fn pepper_seal(wrap_key: &[u8], iv: &[u8], inner: &[u8], account_pub: &str)pub fn pepper_open(wrap_key: &[u8], iv: &[u8], outer: &[u8], account_pub: &str) -> Option<Secret> {gcm_open(wrap_key, iv, &format!("bento/id/rc-pepper/v1.{}", account_tag(account_pub)), outer)}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn argon2id_refuses_cleanly_when_memory_is_short() {+ // kernel/home-android finding: low memory must FAIL CLOSED with an Err,+ // never abort or get the process killed. Simulated: 64 MiB needed + 64+ // MiB headroom, only 100 MiB "available".+ AVAILABLE_OVERRIDE_KIB.with(|c| c.set(Some(100 * 1024)));+ let r = argon2id(b"pw", &[0u8; 16]);+ AVAILABLE_OVERRIDE_KIB.with(|c| c.set(None));+ let e = r.err().expect("refused");+ assert!(e.contains("not enough free memory"), "{e}");+ // control: with enough available, it runs+ AVAILABLE_OVERRIDE_KIB.with(|c| c.set(Some(1024 * 1024)));+ assert!(argon2id(b"pw", &[0u8; 16]).is_ok());+ AVAILABLE_OVERRIDE_KIB.with(|c| c.set(None));+ }++ #[test]+ fn cgroup_limits_cap_available_memory() {+ // A fake cgroup v2 tree: the leaf sets no limit, its parent allows 512+ // MiB with 480 MiB used, the grandparent is unlimited ("max").+ let root = std::env::temp_dir().join(format!("bento-cg-{}", std::process::id()));+ let _ = std::fs::remove_dir_all(&root);+ let leaf = root.join("user.slice/app.scope/leaf");+ std::fs::create_dir_all(&leaf).unwrap();+ let w = |d: &std::path::Path, f: &str, v: &str| std::fs::write(d.join(f), v).unwrap();+ w(&root.join("user.slice"), "memory.max", "max\n");+ w(&root.join("user.slice"), "memory.current", "1000\n");+ w(&root.join("user.slice/app.scope"), "memory.max", &format!("{}\n", 512u64 << 20));+ w(&root.join("user.slice/app.scope"), "memory.current", &format!("{}\n", 480u64 << 20));+ assert_eq!(cgroup_free_kib(&root, "/user.slice/app.scope/leaf"), Some(32 * 1024), "the parent's limit binds");+ assert_eq!(cgroup_v2_path("12:pids:/x\n0::/user.slice/app.scope/leaf\n").as_deref(), Some("/user.slice/app.scope/leaf"));+ assert_eq!(cgroup_free_kib(&root, "/nonexistent"), None);+ let _ = std::fs::remove_dir_all(&root);+ }+}diff --git a/home/desktop/agent/src/secret_linux.rs b/home/desktop/agent/src/secret_linux.rsindex 310b7be5..4b8a6d76 100644--- a/home/desktop/agent/src/secret_linux.rs+++ b/home/desktop/agent/src/secret_linux.rs@@ -1,31 +1,141 @@// SPDX-License-Identifier: MIT// Copyright (c) 2026 The Bento authors//-// The Linux key store for a machine WITHOUT a usable TPM (H1b, the no-TPM-// column of the H1 key table): the freedesktop Secret Service (GNOME Keyring,-// KWallet).+// The Linux key store for a machine WITHOUT a usable TPM (the no-TPM column of+// the H1 key table): the freedesktop Secret Service (GNOME Keyring, KWallet),+// reached through the DISTRIBUTION's libsecret over a thin in-tree FFI — the+// same "distro C library + thin FFI" rule as libfido2 (security §34). This+// replaced the secret-service crate, whose zbus 5 tree carried three RustSec+// "unmaintained" notices.//// STATED EXPOSURE (security §26): the keyring is unlocked at login, so ANY// process running as this user can read these keys silently — routine and// account alike. There is no consent key here, so every AAL3 action is refused-// and routed to a phone or a security key (§2e (E)), and an org's attestation-// policy can refuse such machines outright. The host must say all of this to-// the person when it falls back to this store.+// and routed to a phone or a security key (§2e (E)); an org's attestation policy+// can refuse such machines. The host must say this when it falls back here.//-// Keys are software P-256 scalars stored as keyring secrets, loaded only for-// the moment they are used and zeroized after.+// Keys are software P-256 scalars stored as keyring secrets (hex), copied into+// Zeroizing buffers on read; libsecret's own copy is freed with+// secret_password_free, which clears it first. Errors are tri-state: any+// libsecret error is Unavailable; only a successful empty lookup is absent.use crate::agent::{KeyRole, KeyStore, Prompt, StoreError};use p256::ecdsa::{signature::Signer, Signature, SigningKey};-use secret_service::blocking::SecretService;-use secret_service::EncryptionType;-use std::collections::HashMap;+use std::ffi::{CStr, CString};+use std::os::raw::{c_char, c_int, c_uint, c_void};+use std::ptr;use zeroize::Zeroizing;const APP: &str = "page.bento.home";-fn ss_err(e: impl std::fmt::Display) -> StoreError {- StoreError::Unavailable(e.to_string())+#[repr(C)]+struct SecretSchemaAttribute {+ name: *const c_char,+ kind: c_int, // SECRET_SCHEMA_ATTRIBUTE_STRING = 0+}+#[repr(C)]+struct SecretSchema {+ name: *const c_char,+ flags: c_int, // SECRET_SCHEMA_NONE = 0+ attributes: [SecretSchemaAttribute; 32],+ reserved: c_int,+ reserved1: *mut c_void,+ reserved2: *mut c_void,+ reserved3: *mut c_void,+ reserved4: *mut c_void,+ reserved5: *mut c_void,+ reserved6: *mut c_void,+ reserved7: *mut c_void,+}+// Immutable after construction; only pointers to static strings.+unsafe impl Sync for SecretSchema {}+unsafe impl Send for SecretSchema {}++#[repr(C)]+struct GError {+ domain: u32,+ code: c_int,+ message: *const c_char,+}++const SECRET_SEARCH_ALL: c_int = 1 << 1;++#[link(name = "secret-1")]+extern "C" {+ fn secret_password_store_sync(+ schema: *const SecretSchema,+ collection: *const c_char,+ label: *const c_char,+ password: *const c_char,+ cancellable: *mut c_void,+ error: *mut *mut GError,+ ...+ ) -> c_int;+ fn secret_password_lookup_sync(+ schema: *const SecretSchema,+ cancellable: *mut c_void,+ error: *mut *mut GError,+ ...+ ) -> *mut c_char;+ fn secret_password_clear_sync(+ schema: *const SecretSchema,+ cancellable: *mut c_void,+ error: *mut *mut GError,+ ...+ ) -> c_int;+ fn secret_password_search_sync(+ schema: *const SecretSchema,+ flags: c_int,+ cancellable: *mut c_void,+ error: *mut *mut GError,+ ...+ ) -> *mut c_void;+ fn secret_password_free(password: *mut c_char);+}+#[link(name = "glib-2.0")]+extern "C" {+ fn g_error_free(e: *mut GError);+ fn g_list_length(l: *mut c_void) -> c_uint;+ fn g_list_free_full(l: *mut c_void, free: unsafe extern "C" fn(*mut c_void));+}+#[link(name = "gobject-2.0")]+extern "C" {+ fn g_object_unref(o: *mut c_void);+}++fn schema() -> &'static SecretSchema {+ static NAME: &[u8] = b"page.bento.home.Key\0";+ static A: &[u8] = b"application\0";+ static P: &[u8] = b"profile\0";+ static R: &[u8] = b"role\0";+ static SCHEMA: std::sync::OnceLock<SecretSchema> = std::sync::OnceLock::new();+ SCHEMA.get_or_init(|| {+ let empty = || SecretSchemaAttribute { name: ptr::null(), kind: 0 };+ let mut attributes: [SecretSchemaAttribute; 32] = std::array::from_fn(|_| empty());+ attributes[0] = SecretSchemaAttribute { name: A.as_ptr().cast(), kind: 0 };+ attributes[1] = SecretSchemaAttribute { name: P.as_ptr().cast(), kind: 0 };+ attributes[2] = SecretSchemaAttribute { name: R.as_ptr().cast(), kind: 0 };+ SecretSchema {+ name: NAME.as_ptr().cast(),+ flags: 0,+ attributes,+ reserved: 0,+ reserved1: ptr::null_mut(),+ reserved2: ptr::null_mut(),+ reserved3: ptr::null_mut(),+ reserved4: ptr::null_mut(),+ reserved5: ptr::null_mut(),+ reserved6: ptr::null_mut(),+ reserved7: ptr::null_mut(),+ }+ })+}++/// Take ownership of a GError: its message, as Unavailable.+unsafe fn take_err(e: *mut GError) -> StoreError {+ let msg = if (*e).message.is_null() { "libsecret error".into() } else { CStr::from_ptr((*e).message).to_string_lossy().into_owned() };+ g_error_free(e);+ StoreError::Unavailable(msg)}fn role_name(role: &KeyRole) -> &'static str {@@ -36,47 +146,112 @@ fn role_name(role: &KeyRole) -> &'static str {}}+fn hex(b: &[u8]) -> Zeroizing<String> {+ Zeroizing::new(b.iter().map(|x| format!("{x:02x}")).collect())+}+fn unhex(s: &str) -> Option<Zeroizing<Vec<u8>>> {+ if s.len() % 2 != 0 {+ return None;+ }+ let mut out = Zeroizing::new(Vec::with_capacity(s.len() / 2));+ for i in (0..s.len()).step_by(2) {+ out.push(u8::from_str_radix(s.get(i..i + 2)?, 16).ok()?);+ }+ Some(out)+}+pub struct SecretStore {- ss: SecretService<'static>,- /// separates profiles (and test runs) within one keyring- profile: String,+ profile: CString,+}++/// The attribute values for one role, as C strings that outlive the call.+struct Attrs {+ app: CString,+ profile: CString,+ role: CString,}impl SecretStore {pub fn open(profile: &str) -> Result<SecretStore, StoreError> {- let ss = SecretService::connect(EncryptionType::Dh).map_err(ss_err)?;- Ok(SecretStore { ss, profile: profile.to_string() })+ Ok(SecretStore { profile: CString::new(profile).map_err(|e| StoreError::Unavailable(e.to_string()))? })}- fn attrs<'a>(&'a self, role: &'a KeyRole) -> HashMap<&'a str, &'a str> {- HashMap::from([("application", APP), ("profile", self.profile.as_str()), ("role", role_name(role))])+ fn attrs(&self, role: &KeyRole) -> Attrs {+ Attrs { app: CString::new(APP).unwrap(), profile: self.profile.clone(), role: CString::new(role_name(role)).unwrap() }}fn read(&self, role: &KeyRole) -> Result<Option<Zeroizing<Vec<u8>>>, StoreError> {- let items = self.ss.search_items(self.attrs(role)).map_err(ss_err)?;- let item = match (items.unlocked.first(), items.locked.first()) {- (Some(i), _) => i,- (None, Some(i)) => {- i.unlock().map_err(ss_err)?;- i+ let a = self.attrs(role);+ let mut err: *mut GError = ptr::null_mut();+ unsafe {+ let p = secret_password_lookup_sync(+ schema(), ptr::null_mut(), &mut err,+ c"application".as_ptr(), a.app.as_ptr(), c"profile".as_ptr(), a.profile.as_ptr(),+ c"role".as_ptr(), a.role.as_ptr(), ptr::null::<c_char>(),+ );+ if !err.is_null() {+ if !p.is_null() {+ secret_password_free(p);+ }+ return Err(take_err(err));+ }+ if p.is_null() {+ return Ok(None); // a SUCCESSFUL lookup that found nothing}- (None, None) => return Ok(None),- };- Ok(Some(Zeroizing::new(item.get_secret().map_err(ss_err)?)))+ let s = Zeroizing::new(CStr::from_ptr(p).to_string_lossy().into_owned());+ secret_password_free(p); // clears libsecret's copy, then frees it+ unhex(&s).map(Some).ok_or_else(|| StoreError::Unavailable("malformed stored key".into()))+ }}fn write(&self, role: &KeyRole, secret: &[u8]) -> Result<(), StoreError> {- let c = self.ss.get_default_collection().map_err(ss_err)?;- if c.is_locked().map_err(ss_err)? {- c.unlock().map_err(ss_err)?;+ let a = self.attrs(role);+ let label = CString::new(format!("Bento ID {} key", role_name(role))).unwrap();+ let value = hex(secret);+ let value_c = Zeroizing::new(CString::new(value.as_str()).unwrap().into_bytes_with_nul());+ let mut err: *mut GError = ptr::null_mut();+ unsafe {+ let ok = secret_password_store_sync(+ schema(), ptr::null(), label.as_ptr(), value_c.as_ptr().cast(), ptr::null_mut(), &mut err,+ c"application".as_ptr(), a.app.as_ptr(), c"profile".as_ptr(), a.profile.as_ptr(),+ c"role".as_ptr(), a.role.as_ptr(), ptr::null::<c_char>(),+ );+ if !err.is_null() {+ return Err(take_err(err));+ }+ if ok == 0 {+ return Err(StoreError::Unavailable("the keyring refused to store the key".into()));+ }}- c.create_item(&format!("bento/id {} key", role_name(role)), self.attrs(role), secret, true, "application/octet-stream")- .map_err(ss_err)?;Ok(())}- /// Mint the routine device key in software and store it. The consent key- /// is refused: this store has none (AAL3 is routed elsewhere).+ /// Items of one role, locked OR unlocked (SECRET_SEARCH_ALL).+ fn count_role(&self, role: &KeyRole) -> Result<usize, StoreError> {+ let a = self.attrs(role);+ let mut err: *mut GError = ptr::null_mut();+ unsafe {+ let list = secret_password_search_sync(+ schema(), SECRET_SEARCH_ALL, ptr::null_mut(), &mut err,+ c"application".as_ptr(), a.app.as_ptr(), c"profile".as_ptr(), a.profile.as_ptr(),+ c"role".as_ptr(), a.role.as_ptr(), ptr::null::<c_char>(),+ );+ if !err.is_null() {+ if !list.is_null() {+ g_list_free_full(list, g_object_unref);+ }+ return Err(take_err(err));+ }+ let n = if list.is_null() { 0 } else { g_list_length(list) as usize };+ if !list.is_null() {+ g_list_free_full(list, g_object_unref);+ }+ Ok(n)+ }+ }++ /// Mint the routine device key in software and store it. There is no+ /// consent key here (AAL3 is routed elsewhere).pub fn create_device_key(&self) -> Result<[u8; 65], StoreError> {let key = SigningKey::random(&mut p256::elliptic_curve::rand_core::OsRng);let d = Zeroizing::new(key.to_bytes().to_vec());@@ -95,44 +270,37 @@ impl SecretStore {}/// Remove every key of this profile (device retirement, the wipe path).- /// Locked items are unlocked and deleted too, and the store is searched- /// again afterwards: wipe reports success only when NOTHING of this profile- /// remains, locked or not (security, #779 review). A keyring that cannot be- /// unlocked here makes wipe FAIL; it never pretends.+ /// Reports success only when NOTHING of this profile remains, locked or not+ /// (security, #779 review): a keyring that cannot be unlocked here makes+ /// wipe FAIL; it never pretends.pub fn wipe(&self) -> Result<(), StoreError> {for role in [KeyRole::Account, KeyRole::Device, KeyRole::Consent] {- let found = self.ss.search_items(self.attrs(&role)).map_err(ss_err)?;- for item in found.locked.iter() {- item.unlock().map_err(ss_err)?;+ let a = self.attrs(&role);+ let mut err: *mut GError = ptr::null_mut();+ unsafe {+ secret_password_clear_sync(+ schema(), ptr::null_mut(), &mut err,+ c"application".as_ptr(), a.app.as_ptr(), c"profile".as_ptr(), a.profile.as_ptr(),+ c"role".as_ptr(), a.role.as_ptr(), ptr::null::<c_char>(),+ );+ if !err.is_null() {+ return Err(take_err(err));+ }}- for item in found.unlocked.iter().chain(found.locked.iter()) {- item.delete().map_err(ss_err)?;- }- let left = self.ss.search_items(self.attrs(&role)).map_err(ss_err)?;- if !left.unlocked.is_empty() || !left.locked.is_empty() {- return Err(StoreError::Unavailable(format!(- "wipe incomplete: {} {} key item(s) remain",- left.unlocked.len() + left.locked.len(),- role_name(&role)- )));+ let left = self.count_role(&role)?;+ if left > 0 {+ return Err(StoreError::Unavailable(format!("wipe incomplete: {left} {} key item(s) remain", role_name(&role))));}}Ok(())}- /// Lock the default collection (rigs: the wipe-while-locked row).- #[doc(hidden)]- pub fn lock_collection(&self) -> Result<(), StoreError> {- self.ss.get_default_collection().map_err(ss_err)?.lock().map_err(ss_err)- }-/// How many items of this profile exist, locked or not (rigs).#[doc(hidden)]pub fn count_items(&self) -> Result<usize, StoreError> {let mut n = 0;for role in [KeyRole::Account, KeyRole::Device, KeyRole::Consent] {- let f = self.ss.search_items(self.attrs(&role)).map_err(ss_err)?;- n += f.unlocked.len() + f.locked.len();+ n += self.count_role(&role)?;}Ok(n)}@@ -145,7 +313,7 @@ impl KeyStore for SecretStore {}match self.read(role)? {Some(d) => {- let key = SigningKey::from_slice(&d).map_err(ss_err)?;+ let key = SigningKey::from_slice(&d).map_err(|e| StoreError::Unavailable(e.to_string()))?;Ok(Some(key.verifying_key().to_encoded_point(false).as_bytes().try_into().unwrap()))}None => Ok(None),@@ -154,12 +322,12 @@ impl KeyStore for SecretStore {fn sign(&mut self, role: &KeyRole, msg: &[u8], _prompt: Option<&Prompt>) -> Result<[u8; 64], StoreError> {if *role != KeyRole::Device {- // No consent key on a no-TPM machine; the account key is used by- // the account flows via `account()`, never through `sign`.+ // No consent key on a no-TPM machine; the account key is used by the+ // account flows via `account()`, never through `sign`.return Err(StoreError::Unavailable("no hardware consent key on this machine".into()));}let d = self.read(role)?.ok_or(StoreError::NoKey)?;- let key = SigningKey::from_slice(&d).map_err(ss_err)?;+ let key = SigningKey::from_slice(&d).map_err(|e| StoreError::Unavailable(e.to_string()))?;let sig: Signature = key.sign(msg);Ok(sig.to_bytes().into())}diff --git a/home/desktop/agent/src/statements.rs b/home/desktop/agent/src/statements.rsindex a3d12f4c..031ed275 100644--- a/home/desktop/agent/src/statements.rs+++ b/home/desktop/agent/src/statements.rs@@ -1,7 +1,7 @@// SPDX-License-Identifier: MIT// Copyright (c) 2026 The Bento authors//-// bento/id — the signed statements, a port of kernel/src/statements.ts.+// bento/connect — the signed statements, a port of kernel/src/statements.ts.//// The family rules (from the reference, unchanged): dot-joined printable-ASCII// text signed over its EXACT bytes; every field is a closed dot-free token ordiff --git a/home/desktop/agent/src/webauthn.rs b/home/desktop/agent/src/webauthn.rsnew file mode 100644index 00000000..e0f6609d--- /dev/null+++ b/home/desktop/agent/src/webauthn.rs@@ -0,0 +1,143 @@+// SPDX-License-Identifier: MIT+// Copyright (c) 2026 The Bento authors+//+// The native WebAuthn/PRF ceremony's pure parts (H1d, identity-design §2f).+//+// A desktop agent talks to authenticators BELOW the WebAuthn API (CTAP via+// libfido2 on Linux; webauthn.dll on Windows builds clientData itself too), so+// it must reproduce two things a browser does internally, byte for byte, or a+// passkey's blob made in a browser could never be opened here:+// - the PRF extension → CTAP hmac-secret salt mapping (WebAuthn L3 §10.1.4):+// salt = SHA-256(UTF-8("WebAuthn PRF") ‖ 0x00 ‖ input);+// - clientDataJSON, serialised the way the spec's "limited verification"+// algorithm expects: type, challenge, origin, crossOrigin, in that order,+// with the spec's CCDToString string escaping.++use crate::b64u;+use sha2::{Digest, Sha256};++/// The fixed PRF input of the account-key blobs (§2f).+pub const PRF_INPUT: &[u8] = b"bento/id/prf/v1";++/// The CTAP2 hmac-secret salt for a WebAuthn PRF input.+pub fn prf_salt(input: &[u8]) -> [u8; 32] {+ let mut h = Sha256::new();+ h.update(b"WebAuthn PRF");+ h.update([0u8]);+ h.update(input);+ h.finalize().into()+}++/// WebAuthn CCDToString: a JSON string with only `"`, `\` and C0 controls+/// escaped (as \uXXXX, lower-case hex, except none of the short forms).+fn ccd_to_string(s: &str) -> String {+ let mut out = String::from("\"");+ for c in s.chars() {+ match c {+ '"' => out.push_str("\\u0022"),+ '\\' => out.push_str("\\u005c"),+ c if (c as u32) < 0x20 => out.push_str(&format!("\\u{:04x}", c as u32)),+ c => out.push(c),+ }+ }+ out.push('"');+ out+}++/// Where this agent runs. The origin it declares is self-asserted (a native+/// app builds clientDataJSON itself), so it is DISTINCT from every web origin+/// and never `https://bento.page`: on the web the browser vouches for the+/// origin, which is where phishing resistance comes from (security §33). The+/// directory allow-lists these exact strings and names the platform in the+/// fetch notice as self-reported.+#[derive(Debug, Clone, Copy, PartialEq, Eq)]+pub enum Platform {+ Linux,+ Windows,+}+impl Platform {+ pub fn origin(self) -> &'static str {+ match self {+ Platform::Linux => "bento-desktop:linux",+ Platform::Windows => "bento-desktop:windows",+ }+ }+ pub fn current() -> Platform {+ if cfg!(windows) { Platform::Windows } else { Platform::Linux }+ }+}++#[derive(Debug, Clone, Copy, PartialEq, Eq)]+pub enum Ceremony {+ /// navigator.credentials.create+ Create,+ /// navigator.credentials.get+ Get,+}++/// clientDataJSON, serialised in the spec's order: type, challenge, origin,+/// crossOrigin (false). No topOrigin. `challenge` is the raw challenge bytes,+/// emitted as exact base64url.+pub fn client_data(ceremony: Ceremony, challenge: &[u8], platform: Platform) -> String {+ let ty = match ceremony {+ Ceremony::Create => "webauthn.create",+ Ceremony::Get => "webauthn.get",+ };+ format!(+ "{{\"type\":\"{ty}\",\"challenge\":{},\"origin\":{},\"crossOrigin\":false}}",+ ccd_to_string(&b64u::enc(challenge)),+ ccd_to_string(platform.origin())+ )+}++/// What the authenticator signs over: SHA-256(clientDataJSON).+pub fn client_data_hash(client_data_json: &str) -> [u8; 32] {+ Sha256::digest(client_data_json.as_bytes()).into()+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn prf_salt_is_the_webauthn_l3_mapping() {+ // Independent recomputation of the spec's definition, so a forgotten+ // 0x00 separator or a raw-input salt fails here.+ let mut h = Sha256::new();+ h.update(b"WebAuthn PRF\x00bento/id/prf/v1");+ let want: [u8; 32] = h.finalize().into();+ assert_eq!(prf_salt(PRF_INPUT), want);+ assert_ne!(prf_salt(PRF_INPUT), <[u8; 32]>::from(Sha256::digest(PRF_INPUT)), "not the raw input's hash");+ // pinned, so an accidental change to the construction is visible+ assert_eq!(+ prf_salt(PRF_INPUT).iter().map(|b| format!("{b:02x}")).collect::<String>(),+ "f99670d5db28529b25c8a9ec469959b60006b8d6625066cc77f075dab7ea3b77"+ );+ }++ #[test]+ fn client_data_exact_bytes_per_platform() {+ // security §33's rig rows: exact bytes for each platform and ceremony.+ let ch = [1u8, 2, 3];+ assert_eq!(client_data(Ceremony::Get, &ch, Platform::Linux),+ r#"{"type":"webauthn.get","challenge":"AQID","origin":"bento-desktop:linux","crossOrigin":false}"#);+ assert_eq!(client_data(Ceremony::Get, &ch, Platform::Windows),+ r#"{"type":"webauthn.get","challenge":"AQID","origin":"bento-desktop:windows","crossOrigin":false}"#);+ assert_eq!(client_data(Ceremony::Create, &ch, Platform::Linux),+ r#"{"type":"webauthn.create","challenge":"AQID","origin":"bento-desktop:linux","crossOrigin":false}"#);+ for p in [Platform::Linux, Platform::Windows] {+ let cd = client_data(Ceremony::Get, &ch, p);+ assert!(!cd.contains("https://bento.page") && !cd.contains("topOrigin"), "{cd}");+ let v: serde_json::Value = serde_json::from_str(&cd).unwrap();+ assert_eq!(v["crossOrigin"], false);+ }+ }++ #[test]+ fn ccd_escaping_matches_the_spec_and_stays_valid_json() {+ let s = ccd_to_string("a\"b\\c\u{1}");+ assert_eq!(s, r#""a\u0022b\u005cc\u0001""#);+ let back: String = serde_json::from_str(&s).unwrap();+ assert_eq!(back, "a\"b\\c\u{1}");+ }+}diff --git a/home/desktop/agent/supply-chain-check.sh b/home/desktop/agent/supply-chain-check.shnew file mode 100755index 00000000..5659b676--- /dev/null+++ b/home/desktop/agent/supply-chain-check.sh@@ -0,0 +1,34 @@+#!/usr/bin/env bash+# Supply-chain checks for the SHIPPED desktop agent (security §34), each with a+# positive control so a check that silently passes everything is caught:+# 1. cargo-deny: licence allow-list + RustSec advisories + sources.+# Control: an LGPL crate added as a normal dependency must FAIL.+# 2. The test-only authenticator (agent-testkit / OpenSK) is NOT in the+# shipped dependency graph. Control: adding it as a normal dependency must+# make this check FAIL.+set -euo pipefail+here=$(cd "$(dirname "$0")" && pwd)+cd "$here"++cargo deny --all-features check licenses advisories sources bans+echo "cargo-deny: ok"++shipped() { cargo tree -e normal --all-features --prefix none --manifest-path "$1"; }+absent() { ! shipped "$1" | grep -E -q "^(opensk|bento-agent-testkit|sk-cbor|wasefire-store) "; }+absent Cargo.toml || { echo "FAIL: a test-only crate is in the shipped graph"; exit 1; }+echo "shipped graph: no test-only crates"++# --- positive controls, in a scratch copy -----------------------------------+tmp=$(mktemp -d); trap 'rm -rf "$tmp"' EXIT+mkdir -p "$tmp/agent" && cp -R Cargo.toml Cargo.lock deny.toml src "$tmp/agent/"+cp -R ../agent-testkit "$tmp/agent-testkit"+( cd "$tmp/agent" && cargo add -q rug@1 --no-default-features >/dev/null 2>&1 )+if ( cd "$tmp/agent" && cargo deny --all-features check licenses >/dev/null 2>&1 ); then+ echo "FAIL: control — an LGPL crate in the normal graph was NOT refused"; exit 1+fi+echo "control: an LGPL crate in the normal graph is refused"+( cd "$tmp/agent" && git -C . init -q 2>/dev/null; cargo remove -q rug >/dev/null 2>&1; cargo add -q --path ../agent-testkit >/dev/null 2>&1 )+if absent "$tmp/agent/Cargo.toml"; then+ echo "FAIL: control — the testkit as a normal dependency was NOT detected"; exit 1+fi+echo "control: the testkit as a normal dependency is detected"diff --git a/home/desktop/agent/tests/conformance.rs b/home/desktop/agent/tests/conformance.rsindex f3a9e37a..3b384ffb 100644--- a/home/desktop/agent/tests/conformance.rs+++ b/home/desktop/agent/tests/conformance.rs@@ -1,7 +1,7 @@// SPDX-License-Identifier: MIT// Copyright (c) 2026 The Bento authors//-// The desktop agent against the bento/id conformance vectors+// The desktop agent against the bento/connect conformance vectors// (kernel/fixtures/identity-v1.json), mirroring scripts/test-statements.ts:// every row's verdict AND reason, the builder round-trip and three tamperings of// every accepted row, the attack rows' presence, the derivations, low-S, thediff --git a/home/desktop/agent/tests/fido_interop.rs b/home/desktop/agent/tests/fido_interop.rsnew file mode 100644index 00000000..7514282f--- /dev/null+++ b/home/desktop/agent/tests/fido_interop.rs@@ -0,0 +1,35 @@+// SPDX-License-Identifier: MIT+// Copyright (c) 2026 The Bento authors+//+// The PRF interop rig (security §34): ONE credential on ONE authenticator (the+// test-only virtual OpenSK key), the same PRF input through an INDEPENDENT+// WebAuthn client (python-fido2, which applies the PRF transform itself, as a+// browser does) and through the agent's libfido2 layer. The two outputs must be+// byte-equal, or a blob made on the web could never be opened here.+//+// Mutants (run by fido-rig.sh, each must FAIL this test): the agent built with+// `rig-mutant-double-hash` or `rig-mutant-raw-hash`.+#![cfg(all(target_os = "linux", feature = "fido"))]++use bento_id_agent::fido_linux;+use bento_id_agent::webauthn::PRF_INPUT;++#[test]+fn agent_prf_equals_an_independent_webauthn_client_on_the_same_credential() {+ let path = std::env::var("BENTO_FIDO_RIG").expect("BENTO_FIDO_RIG (the python-fido2 result file) is required");+ let rig: serde_json::Value = serde_json::from_str(&std::fs::read_to_string(&path).unwrap()).unwrap();+ assert_eq!(rig["prfInput"].as_str().unwrap().as_bytes(), PRF_INPUT, "both sides evaluate the same PRF input");+ let want = rig["prf"].as_str().unwrap();+ let got = fido_linux::get_assertion(+ rig["device"].as_str().unwrap(),+ "bento.page",+ &[7u8; 32],+ PRF_INPUT,+ Some(rig["pin"].as_str().unwrap()),+ )+ .expect("assertion through libfido2");+ assert_eq!(got.len(), 1, "one discoverable credential for bento.page");+ let hex: String = got[0].prf.iter().map(|b| format!("{b:02x}")).collect();+ assert_eq!(hex, want, "the agent's PRF output equals the independent WebAuthn client's");+ assert_eq!(got[0].client_data_json.contains("\"origin\":\"bento-desktop:linux\""), true);+}diff --git a/home/desktop/agent/tests/recovery.rs b/home/desktop/agent/tests/recovery.rsindex d5a34003..b787de8c 100644--- a/home/desktop/agent/tests/recovery.rs+++ b/home/desktop/agent/tests/recovery.rs@@ -95,9 +95,9 @@ fn derivations() {let f = fixture();let d = &f["derivations"];let (code, salt, salt_v) = (unhex(s(d, "code")), unhex(s(d, "salt")), unhex(s(d, "saltV")));- assert_eq!(hex(&rc::argon2id(&code, &salt)), s(d, "argon2_A"), "A = Argon2id(code bytes, salt)");- assert_eq!(hex(&rc::recovery_wrap_key(&code, &salt)), s(d, "wrapKey"), "wrap key = HKDF(A, empty, rc-wrap)");- assert_eq!(hex(&rc::recovery_verifier(&code, &salt_v)), s(d, "verifier"), "verifier = Argon2id(code, salt_v)");+ assert_eq!(hex(&rc::argon2id(&code, &salt).unwrap()), s(d, "argon2_A"), "A = Argon2id(code bytes, salt)");+ assert_eq!(hex(&rc::recovery_wrap_key(&code, &salt).unwrap()), s(d, "wrapKey"), "wrap key = HKDF(A, empty, rc-wrap)");+ assert_eq!(hex(&rc::recovery_verifier(&code, &salt_v).unwrap()), s(d, "verifier"), "verifier = Argon2id(code, salt_v)");assert_ne!(s(d, "verifier"), s(d, "argon2_A"));assert_eq!(hex(&rc::prf_kek(&unhex(s(&d["prf"], "output")), &unhex(s(&d["prf"], "salt")))), s(d, "prfKek"));}@@ -127,13 +127,13 @@ fn whole_blobs_end_to_end() {assert_eq!(rc::open_prf_blob(&blob(&b["prf"]["unruled"]), &prf, &cred, acct, Some(kx_pub), KxMode::A).err(), Some("length"));let r = &b["recovery"]["inputs"];- let wk = rc::recovery_wrap_key(&unhex(s(r, "code")), &unhex(s(r, "salt")));+ let wk = rc::recovery_wrap_key(&unhex(s(r, "code")), &unhex(s(r, "salt"))).unwrap();let riv = unhex(s(r, "iv"));assert_eq!(hex(&rc::seal_recovery_inner(&wk, &riv, acct, &only, KxMode::Unruled)), s(&b["recovery"], "inner"), "recovery inner re-seals");let inner = unhex(s(&b["recovery"], "inner"));assert_eq!(hex(&rc::open_recovery_inner(&inner, &wk, &riv, acct, None, KxMode::Unruled).unwrap().account[..]), s(k, "accountD"));let other = rc::parse_recovery_code(s(&f["codes"][1], "printed")).unwrap();- let wk2 = rc::recovery_wrap_key(&other[..], &unhex(s(r, "salt")));+ let wk2 = rc::recovery_wrap_key(&other[..], &unhex(s(r, "salt"))).unwrap();assert_eq!(rc::open_recovery_inner(&inner, &wk2, &riv, acct, None, KxMode::Unruled).err(), Some("decrypt"), "another code cannot open it");assert_eq!(rc::open_recovery_inner(&inner, &wk, &riv, kx_pub, None, KxMode::Unruled).err(), Some("decrypt"), "aad binds the account");@@ -141,7 +141,7 @@ fn whole_blobs_end_to_end() {let (vk, wkey) = rc::pepper_keys(&unhex(s(pp, "secret")), acct);assert_eq!((hex(&vk), hex(&wkey)), (s(pp, "verifyKey").to_string(), s(pp, "wrapKey").to_string()));let d = &f["derivations"];- let verifier = rc::recovery_verifier(&unhex(s(d, "code")), &unhex(s(d, "saltV")));+ let verifier = rc::recovery_verifier(&unhex(s(d, "code")), &unhex(s(d, "saltV"))).unwrap();assert_eq!(hex(&rc::pepper_verifier_tag(&vk, &verifier)), s(pp, "verifierTag"));let piv = unhex(s(pp, "iv"));assert_eq!(hex(&rc::pepper_seal(&wkey, &piv, &inner, acct)), s(pp, "outer"));@@ -169,3 +169,4 @@ fn normaliser_is_unicode_17_or_later() {let (major, _, _) = unicode_normalization::UNICODE_VERSION;assert!(major >= 17, "unicode-normalization data is {:?}", unicode_normalization::UNICODE_VERSION);}+diff --git a/home/desktop/agent/tests/secret_linux.rs b/home/desktop/agent/tests/secret_linux.rsindex 80b36b18..61070cb1 100644--- a/home/desktop/agent/tests/secret_linux.rs+++ b/home/desktop/agent/tests/secret_linux.rs@@ -65,7 +65,14 @@ fn wipe_with_a_locked_keyring_never_reports_success_while_keys_remain() {s.create_device_key().unwrap();s.store_account(&[3u8; 32]).unwrap();assert_eq!(s.count_items().unwrap(), 2);- s.lock_collection().unwrap();+ // Lock the default collection (test-only): the Secret Service's own Lock+ // method over D-Bus, on the default alias the store writes to.+ let st = std::process::Command::new("gdbus")+ .args(["call", "--session", "--dest", "org.freedesktop.secrets", "--object-path", "/org/freedesktop/secrets",+ "--method", "org.freedesktop.Secret.Service.Lock", "[\"/org/freedesktop/secrets/aliases/default\"]"])+ .status()+ .unwrap();+ assert!(st.success(), "Secret Service Lock");match s.wipe() {// either it unlocked and removed everything…Ok(()) => assert_eq!(s.count_items().unwrap(), 0, "wipe said Ok, so nothing may remain"),