Skip to content

Commit 604b53b

Browse files
msirringhausmikma
andauthored
Implement NFC (#152)
Very heavily based on #105, with the following additions: - Fleshed out the APDU-calls - Added `select_fido2()` to discover both U2F and FIDO2-only devices - Made `NfcDevice` derive `Clone` and other minor tweaks, so we can easily use it in `credentialsd` - Added the build with both NFC-features to the github CI (including the installation of libnfc et al.). I kept this separate from the original, un-featured build, so we can be sure the former works even without libnfc installed. Open questions: - Biggest question to me is, how to handle the multiple backends and multiple devices. Since we can't run the "blink and wait for user presence"-scheme with NFC as we do with USB, I'm leaning towards simply always returning the very first found NFC-device instead of a list of found devices and use that. With this, we could get rid of the duplication-problem. I'm not sure many setups would include more than one NFC-reader (with different devices on there). - The cancel-handle is currently unused, and I'm not sure if we can use it anywhere at all. - No testing yet. Not sure how easy that would be to add. - Given that `credentialsd` uses a poll-mechanism to find USB-devices (simply looping over `list_devices()`) as well, I did not investigate to get a blocking device discovery. - For testing, I hacked my local credentialsd-repo by simply replacing `hid` with `nfc` in the USB-handler. Thus, I needed a dummy `blink_and_wait_for_user_presence()`-implementation. This should probably be removed, esp. if we go for the "return first device"-scheme mentioned above. But doing that, I was able to successfully use NFC-devices with Firefox. --------- Co-authored-by: Mikael Magnusson <[email protected]>
1 parent c0e4a86 commit 604b53b

File tree

21 files changed

+1660
-203
lines changed

21 files changed

+1660
-203
lines changed

.github/workflows/rust.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,7 @@ jobs:
2323
run: cargo build
2424
- name: Run tests
2525
run: cargo test --verbose
26+
- name: Install nfc dependencies
27+
run: sudo apt-get install libnfc-dev libpcsclite-dev
28+
- name: Build with nfc-support
29+
run: cargo build --features libnfc,pcsc

0 commit comments

Comments
 (0)