abdm_fidelius 0.1.0
abdm_fidelius: ^0.1.0 copied to clipboard
Dart implementation of ABDM Fidelius encryption (ECDH + HKDF + AES-256-GCM) for India's health data exchange.
0.1.0 #
Initial release — full ABDM Fidelius encryption protocol in pure Dart.
Core Library #
- ECDH key agreement on three curves: Weierstrass Curve25519 (ABDM default), X25519, P-256
- HKDF-SHA256 key derivation with 20-byte salt from nonce XOR
- AES-256-GCM authenticated encryption with 128-bit tag
- X.509 SubjectPublicKeyInfo DER encoding/decoding for all curves
- Strict base64 validation with descriptive error messages
High-Level API #
FideliusCurve25519— Weierstrass Curve25519 (ABDM gateway compatible)FideliusX25519— X25519 (RFC 7748 Montgomery form)FideliusP256— P-256 / secp256r1 (NIST)- Fully async API (
Future<>on all methods) FideliusKeyPairwith safe JSON serialization (excludes private key by default)FideliusEncryptedPayloadwith fidelius-cli compatible JSON formatdecrypt()returnsnullon GCM auth failure with optionalonErrorcallback
Low-Level Primitives #
generateKeyPair(),deriveSharedSecret(),xorAndSplitNonces()deriveKey(),aesGcmEncrypt(),aesGcmDecrypt()encodeX509SpkiDer(),decodeX509SpkiDer()
CLI Tool #
abdm_fidelius generate— key pair generation (all curves)abdm_fidelius encrypt— encrypt plaintextabdm_fidelius decrypt— decrypt payload- JSON output, no JRE required
Interoperability #
- Byte-for-byte compatible with Java fidelius-cli
- Field name mapping documented (senderPublicKey ↔ keyValue)
Testing #
- 157+ unit and integration tests across all curves and engines
- Cross-curve isolation tests (ArgumentError and GCM failure paths)