zetrix_encryption_flutter 0.1.0 copy "zetrix_encryption_flutter: ^0.1.0" to clipboard
zetrix_encryption_flutter: ^0.1.0 copied to clipboard

Zetrix encryption library — ED25519, SM2, Dilithium3 (ML-DSA-65 FIPS 204), and Hybrid key support.

zetrix_encryption_flutter #

Low-level cryptography library for the Zetrix blockchain ecosystem. Provides key generation, signing, and verification for ED25519, SM2, Dilithium3 (ML-DSA-65 / FIPS 204), and a Hybrid (ED25519 + Dilithium3) scheme. The Dilithium3 and Hybrid operations are backed by a Rust native library via flutter_rust_bridge.

Used internally by zetrix_flutter (core SDK) and zetrix_vc_flutter (VC/VP SDK). Can also be used standalone.

Platform Support #

Android iOS
✅ ✅

Requirements #

  • Flutter >= 3.19.0
  • Dart >= 3.3.0
  • Android minSdk 24
  • iOS 13.0+

Initialization #

The library self-initializes on first use — no explicit init() call is required in application code. The native Rust library is loaded lazily and transparently on the first async crypto operation.

Key Types #

Constant Algorithm Address prefix
keyTypeEd25519 ED25519 ZTX3
keyTypeSm2 SM2 ZTX3
keyTypeDilithium3 ML-DSA-65 (FIPS 204) ZTX4
keyTypeHybrid ED25519 + ML-DSA-65 ZTX5

Usage #

Generate a key pair #

import 'package:zetrix_encryption_flutter/zetrix_encryption_flutter.dart';

// ED25519 (default)
final kp = await ZetrixKeypair.generateKeyPair();

// SM2
final sm2Kp = await ZetrixKeypair.generateKeyPair(keyTypeSm2);

// Dilithium3 (post-quantum)
final pqcKp = await ZetrixKeypair.generateKeyPair(keyTypeDilithium3);

// Hybrid (ED25519 + Dilithium3)
final hybridKp = await ZetrixKeypair.generateKeyPair(keyTypeHybrid);

print(kp.privateKey);  // encoded private key
print(kp.publicKey);   // hex-encoded public key
print(kp.address);     // ZTX3... address

Sign and verify #

// Sign a hex-encoded transaction blob
final result = await ZetrixSignature.signBlob('deadbeef0102...', kp.privateKey);
print(result.signature);  // hex-encoded signature

// Sign an arbitrary UTF-8 message
final msgResult = await ZetrixSignature.signMessage('hello zetrix', kp.privateKey);

// Verify
final valid = await ZetrixSignature.verify(
  hexToBytes(result.signature),
  hexToBytes('deadbeef0102...'),
  kp.publicKey,
);

Derive keys and validate #

// Derive public key from private key
final pub = await ZetrixKeypair.getEncPublicKey(kp.privateKey);

// Derive address from public key
final addr = ZetrixKeypair.getAddress(kp.publicKey);

// Validate
ZetrixKeypair.checkEncPrivateKey(kp.privateKey);  // bool
ZetrixKeypair.checkEncPublicKey(kp.publicKey);    // bool
ZetrixKeypair.checkAddress(kp.address);           // bool
0
likes
130
points
10
downloads

Documentation

API reference

Publisher

verified publisherdev.zetrix.com

Weekly Downloads

Zetrix encryption library — ED25519, SM2, Dilithium3 (ML-DSA-65 FIPS 204), and Hybrid key support.

Homepage
Repository

License

MIT (license)

Dependencies

bs58, cryptography, flutter, flutter_rust_bridge, hex, pinenacl, pointycastle

More

Packages that depend on zetrix_encryption_flutter

Packages that implement zetrix_encryption_flutter