Skip to content

Commit 94ee46d

Browse files
Switch to fido-authenticator from Nitrokey for virtual HID device (#143)
A few things happening here. Please excuse the mess of a commit-history. Best to ignore it and squash 😅 - Removed solo-key and switched to fido-authenticator (for both ctap1 and ctap2) - Removed top-level Cargo-workspace, as we only have one crate now - Removed the basically unused `hid-device-tests` feature - Adjusted github CI to also run the webauthn_hid example Implementation details: - The trussed-ecosystem is a bit of a mess, so very special versions are required for this to work. So we have to patch crates.io in the Cargo.toml file. This is based on the way fido-authenticator is using it in it's testsuite. - Introduced a new `VirtHidDevice` that is only a stub without the feature flag to avoid the cfg-checks all over the place, and have them bundled in one file, instead. - `libwebauthn/src/transport/virt/pipe.rs` was copied from fido-authenticator, which in turn copied it from trussed. I kept the original pointer to trussed in the header. - `libwebauthn/src/transport/virt/device.rs` was copied from fido-authenticator and slightly modified (see below). Both files are MIT, so including it with source-links should be fine, I think? - Used certificate and key are copied from nitrokey-3-firmware (also MIT). We could potentially look into generating them ourselves, instead. Maybe even during compilation, to avoid inclusion of binary files in git. - fido-authenticator is using it with a RAM-storage implementation, which is lightweight, but not suitable for our usage, as we want to run our examples, that chain multiple commands and expect state to be kept. Due to the code structure of trussed, RAM-storage would have been wiped with each command, so I opted for a simple temporary filesystem storage instead, which gets removed, when the virtual device is dropped. Not yet done (probably something for future PRs): - Make all examples work with the virtual device. Most of the examples don't dynamically adjust their command usage (e.g. extensions) based on the capability of the device, but do a battery of commands hardcoded. Some of those fail due to lack of support in the virtual device. - Create an extensive testsuite that runs a lot of variations to cover as much of the feature set as possible. --------- Co-authored-by: Alfie Fresta <afresta@noentropy.org>
1 parent dd194a0 commit 94ee46d

File tree

26 files changed

+1802
-546
lines changed

26 files changed

+1802
-546
lines changed

.github/workflows/rust.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ jobs:
77
RUST_LOG: debug
88
name: Build and run tests
99
runs-on: ubuntu-latest
10+
# Set the default working directory for all 'run' steps in this job
11+
defaults:
12+
run:
13+
working-directory: libwebauthn/
1014
steps:
1115
- uses: actions/checkout@v2
1216
- name: Checkout submodules
@@ -18,8 +22,4 @@ jobs:
1822
- name: Build
1923
run: cargo build
2024
- name: Run tests
21-
run: cargo test --verbose --features hid-device-tests
22-
- name: Run u2f_hid example (virtual key)
23-
run: cargo run --example u2f_hid --features virtual-hid-device
24-
# - name: Run webauthn_hid example (virtual key)
25-
# run: cargo run --example webauthn_hid --features virtual-hid-device
25+
run: cargo test --verbose

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
[submodule "solo-virtual-key/src/ext"]
2-
path = solo-virtual-key/src/ext
3-
url = https://github.com/AlfioEmanueleFresta/solo.git

Cargo.toml

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)