This document describes how to build and package Yubico Authenticator from source.
|
Note
|
Yubico Authenticator 6+ uses a new codebase built using the Flutter
framework. The previous Qt codebase can be found in the legacy branch. |
You will need the Flutter SDK with enabled desktop support, see: https://flutter.dev/desktop
Development has been done using the "Install from git" method of installing the SDK, from the "stable" channel.
This project uses dependencies specified in pubspec.yaml and
helper/Cargo.toml. The corresponding pubspec.lock and
helper/Cargo.lock files pin the versions used when building the app.
The Rust helper also uses crates from the yubikey-manager Git submodule.
Helper builds use --locked; when updating Rust dependencies, run
cargo update --manifest-path helper/Cargo.toml and commit the updated lockfile.
Desktop helper build-cache keys include the lockfile through helper/**.
Rust dependency checks use cargo-deny with the policy in
helper/deny.toml. Install it with cargo install cargo-deny --locked
and run pre-commit run cargo-deny-helper --all-files from the repository root.
The hook checks Linux, macOS, and Windows on x64 and ARM64 separately to avoid
including dependencies from incompatible platform branches. It runs when helper
manifests, the lockfile, the policy, its check scripts, or the SDK submodule
revision change. The policy follows the SDK’s baseline, additionally allows ISC
for rqrr, and leaves duplicate dependency versions as warnings.
The Clippy hook also runs when the SDK submodule revision changes to check
API compatibility.
We recommend bundling this application with all its dependencies, using the versions specified in the lock files and the submodule revision pinned by this repository.
The GUI requires a compiled version of Helper to run, which is built from the
sources in helper/ in this repository. Install Rust and Cargo and initialize the
YubiKey Manager submodule from the
repository root:
git submodule update --init --recursive
Alternatively, clone this repository with git clone --recurse-submodules.
Install cargo-about with
cargo install cargo-about --version 0.9.2 --locked --features cli.
Build the helper before running flutter build or flutter run.
For Windows packaging, also build ykman-svc from the submodule:
cargo build --release --manifest-path yubikey-manager\Cargo.toml -p ykman-svc
The local resources/win/release-win.ps1 packaging script expects the resulting
ykman-svc.exe next to the unpacked Windows build artifact.
The MSI and MSIX packages both install ykman-svc as an automatic LocalSystem
service. Before installing either package, uninstall any independently installed
ykman-svc (for example, one installed by YubiKey Manager CLI); both packages
use the same Windows service name. Installing a package that contains a service
requires administrator privileges. The MSIX requires Windows 10 version 2004
or later and declares the restricted packagedServices and
localSystemServices capabilities; publishing it to the Microsoft Store may
require approval for these capabilities.
Install the Rust targets aarch64-apple-darwin and x86_64-apple-darwin
to build the universal helper.
sudo apt install libu2f-udev pcscd libpcsclite-dev libudev-dev libdbus-1-dev pkg-config libssl-dev
Tested on Fedora 34 sudo dnf install pcsc-lite-devel systemd-devel dbus-devel pkgconf-pkg-config openssl-devel
When prerequisites are installed you build the helper by running build-helper.sh
(or build-helper.bat on Windows).
|
Note
|
You will need to re-run the build script if changes have been made to
Helper’s code, or if flutter clean has been run. |
Before you can build or run the app using the flutter command you need to build the helper, as described in the previous section!
To start the app, run:
flutter run -d <os>
where <os> is "windows", "macos", "linux", or an attached Android device name.
use flutter devices to list available devices.
You can add the --release flag to run a release build instead of debug.
To build the app without running it, use:
flutter build <os>
where <os> is "windows", "macos", "linux", or "apk".
Builds of the app will be create under build/<os>/ for desktop, or
build/app/ for Android.
This project uses both unit tests and integration tests.
The unit tests can be run with the command:
flutter test
These do not require a YubiKey, and are relatively quick to run.
Desktop USB integration tests wait up to five seconds for a YubiKey before each test, then fail with a device-availability error instead of the usual 30-second wait. Android and NFC tests retain a 30-second wait to allow manual presentation. This does not shorten explicit removal, reinsertion, or touch waits within tests.
The integration tests are slower but cover more end-to-end functionality. The require an attached YubiKey to run, and will make modifications to the data stored on that YubiKey. For instructions on running these tests, see these instructions.
The Python integration-test runner uses uv and the native yubikit package
from the SDK revision pinned in integration_test/runner.py. Keep that pin
aligned with the build workflows. The first invocation builds the Python
extension and requires Rust and the helper’s native build dependencies:
uv run --script integration_test/runner.py --help
Device discovery and scripting use yubikit.device and yubikit.scripting;
the legacy ykman Python modules are no longer used.
See MacOS Packaging.