Skip to content
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
ba3e133
feat: begin migrating PIV operations to libcanokey
dangfan Sep 15, 2026
6620bfc
feat: route all applet protocol operations through libcanokey
dangfan Sep 16, 2026
7085eb7
fix: authenticate pass slot reads on gated firmware
dangfan Sep 16, 2026
ed320c7
fix: authenticate the gated algorithm-extension read on firmware 3.0.x
dangfan Sep 16, 2026
4ca1cc5
feat: adopt upstream CTAP2 client and consolidate card clients
dangfan Sep 16, 2026
69ef2b1
refactor: adopt upstream firmware authentication-gate modeling
dangfan Sep 16, 2026
66271c7
chore: unify wasm-bindgen family at 0.2.128 and refresh dependencies
dangfan Sep 16, 2026
e7f77fa
refactor: adopt libcanokey 41a3ea60 and rewrite the integration doc
dangfan Sep 16, 2026
fd4ebdc
chore: drop the dead resetApdu enum field
dangfan Sep 16, 2026
5e32c7d
fix: dart2js-safe 64-bit decodes and skip redundant Admin SELECTs
dangfan Sep 16, 2026
0b23585
feat: show build commit and build time in the About dialog
dangfan Sep 16, 2026
f7ea0cf
feat: skip the duplicate serial read in probes
dangfan Sep 16, 2026
77a9c97
fix: address review follow-ups
dangfan Sep 16, 2026
b4ec54d
feat: polish the build info in the About dialog
dangfan Sep 16, 2026
1a8cf0e
docs: note the remaining wire redundancies needing upstream support
dangfan Sep 16, 2026
0e3fc3d
fix: use the PR head commit for BUILD_COMMIT
dangfan Sep 16, 2026
c03ea2e
feat: bundle app fonts and subset Noto Sans SC for CJK
dangfan Sep 16, 2026
02f26b7
build: regenerate CJK font subsets as part of the build
dangfan Sep 16, 2026
eb86774
ci: set up an isolated Python for the font subsetting step
dangfan Sep 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ jobs:
run: cargo install flutter_rust_bridge_codegen --version 2.13.0 --locked
- name: Run flutter release build (${{ matrix.target }})
run: |
flutter build ${{ matrix.target }} --release ${{ matrix.build-args }} --verbose
flutter build ${{ matrix.target }} --release ${{ matrix.build-args }} --verbose \
--dart-define=BUILD_COMMIT="${{ github.event.pull_request.head.sha || github.sha }}" \
--dart-define=BUILD_TIME="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
if [ "${{ matrix.target }}" == "linux" ]; then
sudo sh -c 'umask 022; exec /snap/bin/snapcraft pack --destructive-mode --platform "$1"' _ "${{ matrix.arch }}"
sudo chown "$USER:$USER" ./*.snap
Expand Down
16 changes: 1 addition & 15 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,7 @@ jobs:
cargo install wasm-pack --version "$WASM_PACK_VERSION" --locked
flutter_rust_bridge_codegen build-web --release \
--wasm-pack-rustup-toolchain "$RUST_NIGHTLY"
- name: Restore FIDO2 Web backend
id: fido2_web_cache
uses: actions/cache@v5
with:
path: web/fido2
key: fido2-web-v1-${{ runner.os }}-${{ runner.arch }}-${{ env.RUST_NIGHTLY }}-${{ steps.wasm_pack.outputs.version }}-${{ hashFiles('pubspec.lock') }}
- name: Build FIDO2 Web backend
if: steps.fido2_web_cache.outputs.cache-hit != 'true'
env:
RUSTUP_TOOLCHAIN: ${{ env.RUST_NIGHTLY }}
run: |
dart run fido2:setup --web --output=build/fido2
mkdir -p web/fido2
cp build/fido2/web/fido2_crypto* web/fido2/
- run: flutter build web --verbose
- run: flutter build web --verbose --dart-define=BUILD_COMMIT="${{ github.event.pull_request.head.sha || github.sha }}" --dart-define=BUILD_TIME="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
- uses: actions/upload-artifact@v7
with:
name: web-spa
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/usbip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
rust-src-dir: rust
cache-key: usbip-backend

- name: Build FIDO2 backend
- name: Build native backend
if: steps.backend_cache.outputs.cache-hit != 'true'
run: |
cargo build --manifest-path rust/Cargo.toml --release --locked
Expand All @@ -78,10 +78,10 @@ jobs:

- run: flutter pub get

- name: Test FIDO2 backend and client integration
- name: Test native backends and client integration
env:
FIDO2_CRYPTO_LIBRARY: ${{ github.workspace }}/build/usbip-backend/librust_lib_canokey_console.so
run: flutter test --no-pub test/helper/utils/fido2_backend_test.dart
FRB_DART_LOAD_EXTERNAL_LIBRARY_NATIVE_LIB_DIR: ${{ github.workspace }}/build/usbip-backend
run: flutter test --no-pub --tags native

- name: Share native backend with firmware jobs
uses: actions/upload-artifact@v7
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ build
*.iml
.flutter-plugins*
dist/
web/fido2/
app-store-screenshots/
android/fastlane/report.xml
ios/fastlane/report.xml
38 changes: 27 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,30 @@ Visit our web application at [CanoKey Console Web](https://console.canokeys.org)

3. Run the application:
```bash
flutter_rust_bridge_codegen build-web --release # for web only, remove --release for debug Rust build (very slow when decoding qrcode!)
dart run fido2:setup --web --output=build/fido2 # for web only
mkdir -p web/fido2 && cp build/fido2/web/fido2_crypto* web/fido2/ # for web only
flutter_rust_bridge_codegen build-web --release --wasm-pack-rustup-toolchain nightly-2026-09-04 # for web only
flutter run
```

For Chrome development, run `flutter run -d chrome --cross-origin-isolation`
to enable the headers required for shared WASM memory.

The `wasm-bindgen` crate family is pinned in `rust/Cargo.toml` and the
`wasm-bindgen-cli` used by `wasm-pack` must match it (currently 0.2.128).
If `wasm-pack` cannot reuse an installed helper and fails while compiling
`wasm-bindgen-cli` with WASM linker flags on the host, install the matching
helper separately, e.g. `cargo +stable install wasm-bindgen-cli --version 0.2.128 --locked`,
and ensure its `bin` directory is on `PATH` before rebuilding.

After changing Rust code or regenerating Flutter Rust Bridge bindings, rebuild
the web bundle with the `build-web` command above, then stop and relaunch the
Flutter app. Hot restart does not recompile Rust. A content-hash mismatch means
the loaded WASM bundle and generated Dart bindings are out of sync.

If hot restart reports `Identifier 'wasm_bindgen' has already been declared`,
fully reload the browser page or stop and relaunch the app. The bridge's web
loader inserts its script again on hot restart, while the previous script's
global declaration remains in the page.

## Diagnostic Logs

Open **Settings > View Logs** to inspect this session's local logs without a
Expand All @@ -81,24 +99,22 @@ If you change any Rust dependencies (`Cargo.lock`), please run:
cd rust && cargo bundle-licenses -f json | jq '.third_party_libraries | del(.[].licenses)' > THIRD_PARTY_LICENSES.json
```

The fido2 Dart package and native Rust revision are pinned together at 2.0.0.
Its native C ABI is linked into the existing console Rust library. The
wasm-bindgen dependency family is pinned to versions compatible with fido2 2.0.0.
Web uses the separate JS/WASM loader distributed with the Dart package.
PIV selection, version and algorithm-configuration reads now use a pinned
libcanokey Rust dependency through Flutter Rust Bridge. See the
[migration boundary and next steps](docs/libcanokey-migration.md) for the
implemented scope, session requirements and validation commands.

Before running backend or USB/IP tests locally, build the native backend:

```bash
cargo build --manifest-path rust/Cargo.toml --release --locked
flutter test test/helper/utils/fido2_backend_test.dart
flutter test --tags native
```

### Web

```bash
flutter_rust_bridge_codegen build-web --release
dart run fido2:setup --web --output=build/fido2
mkdir -p web/fido2 && cp build/fido2/web/fido2_crypto* web/fido2/
flutter_rust_bridge_codegen build-web --release --wasm-pack-rustup-toolchain nightly-2026-09-04
flutter build web
```

Expand Down
16 changes: 15 additions & 1 deletion android/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,25 @@ AAB_BUILD_PATH = File.join(ROOT_DIR, "build", "app", "outputs", "bundle", "relea
AAB_DIST_PATH = File.join(ROOT_DIR, "dist", "android", "CanoKey-Console.aab")
ANDROID_METADATA_DIR = File.join(__dir__, "metadata", "android")

# Compile-time build metadata shown in the About dialog.
def build_defines
commit =
if ENV["GITHUB_EVENT_NAME"] == "pull_request" && ENV["GITHUB_EVENT_PATH"]
# GITHUB_SHA is a temporary merge commit on pull_request events.
require "json"
JSON.parse(File.read(ENV["GITHUB_EVENT_PATH"])).dig("pull_request", "head", "sha")
else
ENV.fetch("GITHUB_SHA") { `git rev-parse HEAD`.strip }
end
time = Time.now.utc.strftime("%Y-%m-%dT%H:%M:%SZ")
["--dart-define=BUILD_COMMIT=#{commit}", "--dart-define=BUILD_TIME=#{time}"]
end

platform :android do
desc "Build the signed release AAB without uploading it"
lane :build_internal do
Dir.chdir(ROOT_DIR) do
sh("flutter", "build", "appbundle", "--release")
sh("flutter", "build", "appbundle", "--release", *build_defines)
end

UI.user_error!("AAB was not generated at #{AAB_BUILD_PATH}") unless File.exist?(AAB_BUILD_PATH)
Expand Down
Binary file added assets/fonts/ABeeZee-Regular.ttf
Binary file not shown.
Binary file added assets/fonts/Abel-Regular.ttf
Binary file not shown.
Binary file added assets/fonts/CanoKeyCJK-Bold.ttf
Binary file not shown.
Binary file added assets/fonts/CanoKeyCJK-Regular.ttf
Binary file not shown.
93 changes: 93 additions & 0 deletions assets/fonts/GoogleFonts-OFL.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
Copyright © 2017 IBM Corp. with Reserved Font Name "Plex"

This Font Software is licensed under the SIL Open Font License, Version 1.1.

This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL


-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file added assets/fonts/IBMPlexSans-Bold.ttf
Binary file not shown.
Binary file added assets/fonts/IBMPlexSans-Light.ttf
Binary file not shown.
Binary file added assets/fonts/IBMPlexSans-Medium.ttf
Binary file not shown.
Binary file added assets/fonts/IBMPlexSans-Regular.ttf
Binary file not shown.
Binary file added assets/fonts/IBMPlexSans-SemiBold.ttf
Binary file not shown.
93 changes: 93 additions & 0 deletions assets/fonts/NotoSansSC-OFL.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://scripts.sil.org/OFL


-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file added assets/fonts/Poppins-Bold.ttf
Binary file not shown.
Binary file added assets/fonts/Poppins-Light.ttf
Binary file not shown.
Binary file added assets/fonts/Poppins-Medium.ttf
Binary file not shown.
Binary file added assets/fonts/Poppins-Regular.ttf
Binary file not shown.
Binary file added assets/fonts/Poppins-SemiBold.ttf
Binary file not shown.
Binary file added assets/fonts/Raleway-ExtraBold.ttf
Binary file not shown.
Loading