darkbio_crypto library
Post-quantum cryptography primitives.
Initialization
Call init once at app startup before using any crypto functions:
import 'package:darkbio_crypto/darkbio_crypto.dart';
void main() async {
await init();
runApp(MyApp());
}
Usage
Import individual modules with prefixes:
import 'package:darkbio_crypto/xdsa.dart' as xdsa;
import 'package:darkbio_crypto/xhpke.dart' as xhpke;
import 'package:darkbio_crypto/cose.dart' as cose;
import 'package:darkbio_crypto/hkdf.dart' as hkdf;
import 'package:darkbio_crypto/rand.dart' as rand;
// Digital signatures
final secret = xdsa.SecretKey.generate();
final signature = secret.sign(message: data);
// Encryption
final recipient = xhpke.SecretKey.generate().publicKey();
final sealed = cose.seal(signer: secret, recipient: recipient, ...);
// Key derivation
final key = hkdf.key(secret: secret, salt: salt, info: info);
Available modules
- xdsa: Composite ML-DSA-65 + Ed25519 signatures (quantum-resistant)
- xhpke: X-Wing (X25519 + ML-KEM-768) hybrid encryption
- rsa: RSA-2048 signatures with SHA-256
- cwt: CBOR Web Tokens with CWT and EAT claims
- cose: COSE sign, verify, seal, open operations
- hkdf: HKDF-SHA256 key derivation
- argon2: Password-based key derivation
- rand: Cryptographically secure random bytes
- stream: STREAM encryption with ChaCha20-Poly1305