Skip to content
pubscout

oqs

4.2.0, released 4 weeks ago by an unverified publisher

Dart FFI bindings for liboqs enabling post-quantum cryptography primitives like ML-KEM and ML-DSA.

$ flutter pub add oqs
Source repository

What it does

Provides high-performance post-quantum cryptography (PQC) key encapsulation and signature primitives in Dart via FFI bindings to liboqs. It supports dynamic library loading across Android, iOS, Windows, macOS, and Linux, and offers constant-time comparison methods to prevent timing side-channels.

AI-written summary of version 4.2.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need post-quantum key encapsulation mechanisms (ML-KEM, Falcon) in a Dart or Flutter application.
  • You want post-quantum digital signatures with optional context-aware parameters.

Skip it when

  • You cannot include native binaries or build the required liboqs native library for your deployment target.

Strengths

  • High-performance post-quantum cryptography support via native liboqs bindings.
  • Cross-platform support covering Android, iOS, Windows, macOS, and Linux.
  • Includes constant-time comparison methods to guard against timing side-channels.

Weaknesses

  • Requires manual setup and management of native liboqs binaries for each target platform.
  • Changes upstream in liboqs (such as breaking name changes or removed algorithms) directly impact the Dart API behavior.

Setup

Kind
FFI (native library)
Effort
High
Code generation
No
Direct dependencies
1

Requires obtaining and setting up a native liboqs dynamic library or XCFramework for each target platform (Android, iOS, Windows, macOS, Linux).

import 'package:oqs/oqs.dart';

void main() {
  LibOQS.init();
  final kems = LibOQS.getSupportedKEMAlgorithms();
  final kem = KEM.create(kems.first)!;
  final kp = kem.generateKeyPair();
  final enc = kem.encapsulate(kp.publicKey);
  final dec = kem.decapsulate(enc.ciphertext, kp.secretKey);
  print(dec.length == enc.sharedSecret.length);
  kem.dispose();
  LibOQS.cleanup();
}

Alternatives

Packages that do the same job and could replace oqs.

  • sodium

    Dart bindings for the libsodium cryptographic library for Dart-VM and Web.

  • webcrypto

    Cross-platform implementation of Web Cryptography APIs for Dart.

  • pqcrypto

    Pure Dart post-quantum cryptography package implementing ML-KEM, ML-DSA, and SLH-DSA.

  • ed25519_edwards

    Ed25519 signature implementation for Dart, compatible with RFC 8032 keys.

Works with

Packages commonly used together with oqs: ones it builds on, ones built on it, and its own family.