#security #web #firefox #keys #authenticator


Library for interacting with CTAP1/2 security keys for Web Authentication. Used by Firefox.

8 releases

new 0.2.13 Jun 29, 2020
0.2.12 Apr 8, 2020
0.2.10 Mar 10, 2020
0.2.9 Jan 22, 2020
0.2.6 May 22, 2019
Download history 63/week @ 2020-03-11 65/week @ 2020-03-18 38/week @ 2020-03-25 36/week @ 2020-04-01 91/week @ 2020-04-08 64/week @ 2020-04-15 40/week @ 2020-04-22 32/week @ 2020-04-29 9/week @ 2020-05-06 19/week @ 2020-05-13 35/week @ 2020-05-20 44/week @ 2020-05-27 39/week @ 2020-06-03 29/week @ 2020-06-10 42/week @ 2020-06-17 67/week @ 2020-06-24

172 downloads per month

MPL-2.0 license


A Rust library for interacting with CTAP1/CTAP2 Security Keys

Build Status Maturity Level

This is a cross-platform library for interacting with Security Key-type devices via Rust.

  • Supported Platforms: Windows, Linux, FreeBSD, OpenBSD, and macOS.
  • Supported Transports: USB HID.
  • Supported Protocols: FIDO U2F over USB. CTAP2 support is forthcoming, with work being done in the unstable ctap2 branch.

This library currently focuses on USB security keys, but is expected to be extended to support additional transports.


There's only a simple example function that tries to register and sign right now. It uses env_logger for logging, which you configure with the RUST_LOG environment variable:

cargo build --example main
RUST_LOG=debug cargo run --example main

Proper usage should be to call into this library from something else - e.g., Firefox. There are some C headers exposed for the purpose.


There are some tests of the cross-platform runloop logic and the protocol decoder:

cargo test


There are fuzzers for the USB protocol reader, basically fuzzing inputs from the HID layer. There are not (yet) fuzzers for the C API used by callers (such as Gecko).

To fuzz, you will need cargo-fuzz (the latest version from GitHub) as well as Rust Nightly.

rustup install nightly
cargo install --git https://github.com/rust-fuzz/cargo-fuzz/

cargo +nightly fuzz run u2f_read -- -max_len=512
cargo +nightly fuzz run u2f_read_write -- -max_len=512


~14K SLoC