-
Notifications
You must be signed in to change notification settings - Fork 3
Installation
pqcrypto is a pure Dart package with zero runtime dependencies. It works in
any Dart or Flutter project and on every Dart target.
dart pub add pqcryptoor for a Flutter project:
flutter pub add pqcryptoThis adds the latest version to your pubspec.yaml:
dependencies:
pqcrypto: ^0.4.0Then import the single public library:
import 'package:pqcrypto/pqcrypto.dart';That import exposes the entire public API: PqcKem / KyberKem (ML-KEM),
MlDsa / DilithiumParams (ML-DSA), and SlhDsa / SlhDsaParams (SLH-DSA).
-
Dart SDK:
^3.10.0(records and pattern destructuring are used in the public API). - No native toolchain, no FFI, no C libraries. The FIPS 202 (SHA-3/SHAKE) and FIPS 180-4 (SHA-2) primitives are vendored in pure Dart.
| Target | Supported | Notes |
|---|---|---|
| Dart VM (JIT/AOT) | Yes | Fastest path; ideal for servers and CLIs. |
| Flutter — iOS / Android | Yes | Offload heavy work to an isolate (see below). |
| Flutter / Dart — macOS/Win/Linux | Yes | Desktop and embedded Linux / SBC. |
Web — dart2js
|
Yes | Works; no isolate offload (see below). |
Web — dart2wasm
|
Yes | Works; preferred web compiler for CPU-heavy crypto. |
| Bare-metal microcontrollers | No | No supported Dart toolchain for Cortex-M-class MCUs. |
Key generation and signing are CPU-intensive. On Flutter mobile and desktop, run them off the UI thread:
import 'dart:isolate';
import 'package:pqcrypto/pqcrypto.dart';
final (pk, sk) = await Isolate.run(
() => MlDsa.generateKeyPair(DilithiumParams.mlDsa65),
);On Flutter web, isolates do not run on a separate thread, so compute()
does not move CPU work off the main thread — prefer dart2wasm, do heavy key
generation rarely, or generate long-term keys server-side.
Run the bundled example to confirm everything works end to end:
dart run example/main.dartNext: Quickstart · Cookbook · Cryptographic Algorithms
pqcrypto — pure Dart, zero-dependency post-quantum cryptography (ML-KEM FIPS 203 · ML-DSA FIPS 204) for Dart, Flutter, and the web · MIT License · pub.dev · Repository · Documentation Index
Algorithm/KAT-conformance and interoperability evidence — not a CMVP/FIPS 140 module validation.
pqcrypto Wiki
Getting started
Algorithms
Design & internals
Assurance
Integration
Project
Links