MCPcopy Index your code
hub / github.com/danstiner/rust-u2f

github.com/danstiner/rust-u2f @v0.4.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.4.2 ↗ · + Follow
388 symbols 943 edges 48 files 17 documented · 4%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Rust U2F

Build Status

A software-only Universal 2nd Factor token. Supports Google Chrome and Firefox on Linux. Written in Rust.

This program is basically complete, I am not currently planning to add new features like passwordless login the newer FIDO2 standard supports.

Security

Disclaimer: This is a personal project, I am not a security expert and make no guarantee of security.

Like any U2F authenticator this program provides a degree of protection against phishing and poorly chosen passwords. It does not provide the same level of protection against malware that a hardware authenticator does.

If your machine is compromised by malware, the attacker could steal a copy of the secret keys stored by this authenticator. In this situation you should immediately unregister this authenticator anywhere it is registered in addition to changing the passwords of any potentially compromised accounts. With a hardware authenticator secret keys never leave the device, so in the case of malware you can simply unplug from the infected machine and be confident your accounts are safe from further compromise.

Installation

After installing, test your new virtual U2F device on a site supporting it such as: https://demo.yubico.com/webauthn-technical/registration

Arch

Install the AUR package maintained by @grawity: https://aur.archlinux.org/packages/softu2f/

Then enable and start the installed services:

systemctl --system enable softu2f.socket
systemctl --user   enable softu2f.service
systemctl --system start softu2f.socket
systemctl --user   start softu2f.service

Fedora

curl -s https://packagecloud.io/install/repositories/danstiner/softu2f/script.rpm.sh | sudo bash
sudo dnf install softu2f
systemctl --user start softu2f

Ubuntu

sudo apt install -y curl
curl -s https://packagecloud.io/install/repositories/danstiner/softu2f/script.deb.sh | sudo bash
sudo apt install -y softu2f
systemctl --user start softu2f

Building

See Dockerfile.debian or Dockerfile.fedora for pre-requisite packages that must be installed.

Then run cd linux && make.

To install run cd linux && make install. The install target uses sudo so you will be prompted for your password.

Bump version

  • Run bumpversion --no-tag patch
  • Update linux/meta-package/debian/changelog and amend the commit
  • Push and manually tag the release
  • Package for all platforms and upload package files

License

This project is licensed under either of

  • Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
  • MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Extension points exported contracts — how you extend this code

SecretStore (Interface)
(no doc) [3 implementers]
u2f-core/src/lib.rs
Decoder (Interface)
Decoding of items in buffers. An implementation of `Decoder` takes a buffer of bytes and is expected to decode exactly [1 …
linux/uhid-tokio/src/transport.rs
UserSecretStore (Interface)
(no doc) [2 implementers]
linux/user-daemon/src/stores/mod.rs
Segmenter (Interface)
(no doc) [1 implementers]
u2fhid-protocol/src/segmenting_sink.rs
Pipe (Interface)
(no doc) [1 implementers]
linux/system-daemon/src/device.rs
UserPresence (Interface)
(no doc) [2 implementers]
u2f-core/src/lib.rs
Encoder (Interface)
Trait of helper objects to write out items as bytes. [1 implementers]
linux/uhid-tokio/src/transport.rs
Pipe (Interface)
(no doc) [1 implementers]
linux/user-daemon/src/main.rs

Core symbols most depended-on inside this repo

new
called by 214
u2fhid-protocol/src/send_all.rs
clone
called by 39
u2f-core/src/private_key.rs
into
called by 25
u2f-core/src/response.rs
push
called by 21
linux/user-daemon/src/stores/file_store_v2.rs
take
called by 17
u2fhid-protocol/src/protocol_state_machine.rs
as_ref
called by 16
u2f-core/src/lib.rs
write
called by 8
u2f-core/src/lib.rs
get_test_attestation
called by 8
u2f-core/src/lib.rs

Shape

Method 205
Function 87
Class 60
Enum 24
Interface 12

Languages

Rust98%
C2%

Modules by API surface

u2f-core/src/lib.rs52 symbols
u2fhid-protocol/src/protocol_state_machine.rs31 symbols
u2fhid-protocol/src/definitions.rs21 symbols
linux/uhid-tokio/src/codec.rs20 symbols
linux/user-daemon/src/stores/file_store_v2.rs19 symbols
linux/user-daemon/src/stores/secret_service_store.rs15 symbols
linux/system-daemon/src/device.rs14 symbols
linux/user-daemon/src/main.rs13 symbols
u2fhid-protocol/src/segmenting_sink.rs12 symbols
linux/user-daemon/src/config.rs12 symbols
u2fhid-protocol/src/buffer_one.rs11 symbols
linux/uhid-tokio/src/uhid_device.rs11 symbols

For agents

$ claude mcp add rust-u2f \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact