cipherbird 1.6.0
cipherbird: ^1.6.0 copied to clipboard
Native cryptography for Flutter over dart:ffi: hashing, AEAD, post-quantum, hybrid KEM, sealed messaging, Noise, tokens, recipes and easy-mode keys, engine bundled.
1.6.0 #
Hardening. The bundled engines are the attested build of Engines run 44769079529.
vault_createrefuses a null key or one shorter than 32 bytes.- A keyring device or hardware slot binds all 8 bytes of its memory field on every platform, including the web engine, and the parser refuses a slot whose unused cost fields are not zero.
- MolecularVault refuses a memory cost that is not a multiple of 1024, and opening with a raw key requires the raw-key header.
- BBS blind signing verifies the holder's commitment proof and signs nothing when it fails.
- DRBG reseed refuses entropy shorter than 32 bytes.
- Steganography: inspection runs the whole reader, BMP, PNG and GIF report their real capacity, and a JPEG whose Huffman table declares more than 256 symbols is refused instead of crashing the parser.
xwingKeypairFromSeedthrowsArgumentErrorfor a seed that is not 32 bytes, and it andblsKeygenFromIkmthrowStateErrorwhen the engine has no such key type, where they returned empty keys before.- BBS proof generation, with or without a pseudonym, refuses a disclosed index that is out of range or repeated, a signature that does not decode, and a prover blind or nym secret that is not 32 bytes. Each of these read past the engine's buffers before.
- Envelopes, tokens, sessions and keys written before this change still open.
The engine is renamed CipherBird.
- The C functions are
cipherbird_*(werecryptolib_*), the header iscipherbird_c.hand a library built from source islibcipherbird_c. The engines export the same 356 functions under the new prefix. The Dart API does not change. - A library passed to
CipherBird.loador named byCIPHERBIRD_LIBRARYmust come from this release or later: an engine built before the rename does not load.CRYPTOLIB_DYLIBis still read whenCIPHERBIRD_LIBRARYis unset. - Envelopes, tokens, sessions and keys are unchanged byte for byte: the
derivation and domain separation labels keep their
cryptolibtext.
1.5.0 #
Fixed: calls into libcrypto from many threads could hang on macOS and iOS.
- Concurrent calls of P-256, AES-256-GCM, AES-256-GCM-SIV (and the molecular vault), HPKE, X-Wing, ML-KEM, ML-DSA, SLH-DSA and sntrup761 could stop forever when a signal arrived while a thread waited for one of libcrypto's locks, which on Apple platforms can lose its wakeup. The first calls of a process were the likeliest to hang, warm calls and thread exits could too. A host that signals its threads, as the Go runtime and profilers do, met it first. The engine now does libcrypto's first-use work once, holds signals back from a thread while it is inside libcrypto, and runs libcrypto's per-thread cleanup with signals blocked when a thread exits. The cost is about 0.3 microseconds per call. Results are unchanged byte for byte.
- The engines are the attested build of Engines run 43595023682. Every one, the WebAssembly engine included, exports the 356 functions of this release (341 in 1.4.0), so the generic token calls work in the browser too. The macOS engine is about 0.6 MB larger because it now carries the P-256 curve; the Android, iOS and web engines stay within about 20 KB of their 1.4.0 size.
Incremental SecretStream.
secretStreamEncryptorandsecretStreamDecryptorreturn aSecretStreamEncryptorand aSecretStreamDecryptorthat take one chunk at a time, so a stream of any size passes through in constant memory (200 MiB in 64 KiB chunks grows resident memory by a few MiB).push,finish,pull,isFinishedandclose, withSecretStreamTag,SecretStreamChunkand a typedSecretStreamException: a tampered, reordered, duplicated or foreign chunk isinvalid, use after the final chunk isfinished, use aftercloseisclosed. A finalizer frees a handle that was never closed. Also onlib.aeadasstreamEncryptorandstreamDecryptor, on every platform including the web.streamEncryptandstreamDecryptkeep their results byte for byte and now refuse a key that is not 32 bytes or a header that is not 24 with aSecretStreamExceptioninstead of reading past the buffer.- Streams interoperate with the Go binding's
StreamEncryptorandStreamDecryptorin both directions (scripts/verify_stream_interop.sh).
P-256 ECDSA with SHA-256 (ES256), docs/P256.md.
p256Available,p256DeterministicNonces,p256GenerateKey,p256PublicKey,p256Sign,p256Verify,p256PrivateKeyFromPkcs8andp256PrivateKeyFromPem: raw 64-byter || ssignatures over SHA-256 as JWS ES256 carries them, RFC 6979 nonces, and a strict import of an unencrypted PKCS#8 key in DER or PEM. Checked against the NIST CAVP P-256 cases and RFC 6979 A.2.5.- Desktop and server engines carry it (the macOS slice, the bundled desktop
library, an engine built against a stock OpenSSL). The Android, iOS and
web engines are built with a libcrypto trimmed of elliptic curves, so
p256Available()is false there; on devicesDeviceFipsoffers the platform's P-256.
One token API for every format (docs/TOKEN_API.md).
tokenFormats,tokenKeygen,tokenIssue,tokenAccept,tokenPeekFormatandtokenPeekFooter, withTokenFormatandTokenKeys: a format is named by its token header (v4.local,cb1.local,cb1.public), a.localformat encrypts and a.publicformat signs, and the caller always names the format it expects, so the header inside a token never chooses the algorithm. The same six live onlib.tokens. A new format is an engine change only.TokenStatus.formatfor an unknown format name;TokenStatus.unavailablenow also covers every format in the fips profile.- The format-named methods of 1.4.0 remain as the same calls with the format fixed.
- The common-schema vectors under
tests/vectors/tokens/are accepted through the generic calls, one loop for every format.
1.4.0 #
Tokens: PASETO v4.local and CipherBird's own cb1 tokens, plus keyed BLAKE2b.
pasetoV4LocalEncryptandpasetoV4LocalDecrypt: PASETO v4.local, byte for byte the specification, verified against the official vectors; the whole construction runs in the engine in one call with a fresh nonce from its CSPRNG, and the tag is checked in constant time before decryption.cb1LocalEncrypt,cb1LocalDecrypt,cb1PublicSignandcb1PublicVerify: cb1, the PASETO v4 shape on this library's primitives, BLAKE3 for the key split and the tag, and the Ed25519 + ML-DSA-65 hybrid signature for public tokens. Pinned vectors are shared with every binding; the format is documented in the repository'sdocs/CB1_TOKEN.md.blake2bKeyedandblake2bKeyedInto: BLAKE2b at a chosen output length.TokenStatus,TokenExceptionand thetokensfacade;lib.tokensjoins the grouped views, and the C ABI grows from 327 to 341 functions, all of them reachable onCipherBird.- The engine gains the same entry points on every platform, including the
WebAssembly engine; the engines are the attested 1.4.0 build, the same
bytes as the v1.4.0 GitHub release and the
cipherbird1.4.0 package on npm, so a token issued in Dart is verified in Node and the other way round. - Fixed: a JPEG whose scan declared no components, or a zero sampling factor, spun the JSteg extractor forever; every MCU loop now stops when an iteration consumes no bits. An AVI stream height of INT32_MIN no longer negates a signed minimum. Both found by the scheduled fuzz campaign; regression tests cover the three inputs.
1.3.0 #
The web release: every file-based media method on bytes in the browser, heavy work off the main thread through one generic job, the device facade on WebCrypto, a 37% smaller SIMD engine, a browser key module and a worker-only mode that keeps key material out of the page, plus the explainable entropy health verdict and the live entropy source.
preload(workerOnly: true)keeps the only engine inside the worker: the asynchronous methods run there, the synchronous ones throw and say so, and key material never sits in the page's memory. In that mode the web build is approved for long-lived keys; card data stays refused.HardwareKeyin the browser: a non-extractable AES-256-GCM key made by WebCrypto and kept in IndexedDB wraps keyring slots, so a stored keyring cannot be read out as bytes even by a script that reads the database;HardwareBacking.browsernames it, and the threat model says it is not a secure element.web_setup --checkreports what a page has and lacks for the engine; the READMEs gain hosting guidance (Brotli, an immutable cache header, a preload link, the Content Security Policy the worker needs), and a Pages workflow publishes the showcase for the browser.- The WebAssembly engine is 37% smaller (4.78 MB to 2.99 MB): OpenSSL is trimmed as in the native builds and secp256k1 uses the small precomputed tables, at the same speed.
- The WebAssembly engine and its dependencies are built with SIMD: Argon2id takes 38% less time and ML-KEM-768 11% less in Chrome, the hashes and ciphers are unchanged, the engine is 5% larger.
DeviceFipsin the browser runs on WebCrypto, the platform's own crypto: SHA-2, HMAC, HKDF, PBKDF2, random bytes, AES-256-GCM in the engine's wire layout, and P-256 ECDH and ECDSA with DER signatures, with known-answer and engine-interoperability tests in Chrome.module()states that it is the browser platform crypto and not a validated module as exposed to pages.- Heavy work off the main thread on every platform:
EngineCallJobdescribes one engine entry point by symbol as plain data, the web worker runs any such call on its own engine, and the asynchronous methods (mlDsaSignAsync,slhDsaSignAsync,hybridSigSignAsync,suite2SealAsync,stegoEmbedBytesAsyncand the rest) use it through the runner seam, a background isolate natively. - Steganography, media entropy and the composed seals on bytes, on every
platform including the browser:
stegoEmbedBytesand the rest of the byte-based twins of the file-taking methods,entropyFromBytes,assessHealthOf,keyFromBytes,sealWithBytes,openWithBytesandKeyBytesSource, each taking the carrier'sMediaFormat. The engine carries an in-memory file system for the web; natively a private temporary directory is used and wiped. The Chrome suites of both packages now run in CI. - The health report says everything behind its verdict: both SP 800-90B
estimates, the sample size, the longest run with the repetition-count
cutoff, the peak window count with the adaptive-proportion cutoff, the
floor the cutoffs were calibrated for, and a
summarythe engine writes one line per signal. The cutoffs now follow the floor the policy claims (31 identical bytes at the default one bit per byte) instead of the entropy measured, so a real photograph with a short run of padding in its header passes while a blank image still fails; a refusal names the figure, the cutoff and the setting that would relax it.assessFileHealthtakesfloorBitsPerByte. liveEntropy()andlib.rng.live(): a continuous entropy source for a stream. Feed camera frames, audio buffers or any bytes as they arrive; each chunk is assessed under the policy, credited when it passes and mixed in without credit when it does not, with the reason reported and the repetition-count run carried across chunks.generatedraws from an HMAC-DRBG seeded after 256 credited bits and reseeded as credit keeps arriving; it throws until the first seed.status()reports the credit, the counters and the last verdict.- Media entropy assesses every source before trusting it: two SP 800-90B
estimators (the Most-Common-Value bound over the whole file and the
Markov bound over the bit expansion of the first MiB) with the
repetition-count and adaptive-proportion tests. The plain harvests now
refuse a file below one bit of min-entropy per byte or one that fails the
repetition-count test;
entropyFromFileWithPolicytakes the floor and the test requirement explicitly, and 0 withrequireRct: falseaccepts any file. The engine'sentropyInfoestimate is now that min-entropy lower bound rather than the earlier Shannon figure, so it reads lower for the same file. - The media readers are fuzzed from a seed corpus of every format in CI and every night with a persisted corpus. The campaigns found and fixed five ways a crafted file could exhaust memory or divide by zero before any payload check: a GIF that declares more pixels than its data could encode, GIF or oversized bytes reaching the PNG decoder, a PNG chunk length beyond the end of the file, a progressive JPEG with no size check before decode, and a WAV with zero channels (in both the WAV and the FLAC reader). Every image carrier now caps at 67 million pixels and the PNG and JPEG readers validate the declared size before decoding.
- The example app's Play tab gains two playgrounds. Steganography generates a photo or a sound, or takes any image, sound or video picked from the device, hides a secret seven ways (plain, keyed placement, encrypted, physical seal, HPKE, image factor, or a recipe whose profile, layers, error correction, signature and key source are each a pick), shows the carrier before and after, reveals with the right and the wrong key, inspects, runs detection and damages the file. LavaRand reads a source's health report, harvests it under the policy the developer sets, derives keys, seeds a DRBG and Fortuna, and seals with the file directly or through a recipe keyed by it. Both take any file the system picker offers, and the health line is the engine's own summary. A Live entropy playground feeds camera frames or any picked file into the live source, shows every chunk and the credit arriving on a meter, and draws a key and re-encrypts a message on every credited chunk, so the ciphertext follows the stream; on every reseed or by hand are the other modes. The three media playgrounds run in the browser too, with the camera through getUserMedia.
1.2.0 #
The bank-readiness release: the standards-track post-quantum surface, the validated-module routing, the explicit approval boundary, and the supply-chain and loader hardening from the assessment. Existing APIs and wire formats are unchanged; the new envelopes carry new ids and versions.
-
Standards-track post-quantum surface from the bank-readiness assessment (findings M4, M5, M6): X-Wing (draft-connolly-cfrg-xwing-kem-11) with
xwingKeygen,xwingKeypairFromSeed,xwingEncapsulateandxwingDecapsulate; HPKE with a chosen KEM throughHpkeKem(DHKEM(X25519), ML-KEM-768, X-Wing),hpkeKeygenKem,hpkeDeriveKeypairKem,hpkeSetupSKemandhpkeSetupRKem; Suite v2 envelopes (suite2Seal,suite2Open,suite2SuiteOf,Suite2Id), whose signature binds the recipient key, the KEM ciphertext and the associated data so an envelope cannot be re-addressed; and Session v2 (Session2,generateSession2Prekey,verifySession2Prekey,initiateSession2,claimedSession2Initiator,acceptSession2), a forward-secret ratchet over X-Wing behind a handshake that authenticates both identities. EverySecurityProfileselects X-Wing (hpkeKem,suite2). The version 1 Suite and Session stay available and unchanged. -
The engine's FIPS layer for engines built with
CRYPTOLIB_PROFILE=fips(OpenSSL FIPS Provider, CMVP certificate #4985):fipsAvailable,fipsInit,fipsStatusand thefips*family (digest, HMAC, HKDF, PBKDF2, DRBG, AES-256-GCM, P-256, a key envelope, HPKE P-256). On the bundled full-profile enginefipsAvailableis false and every call throws. -
The approval boundary is explicit (finding M3):
ProtectedDataClass,CipherBird.approvedFor,requireApprovedForandisWebBuild. The web build is approved for ephemeral data only andrequireApprovedForfails closed for long-lived keys and card data. -
Engines carry the 320-function C ABI, every slice built and attested on CI from hash-pinned sources. Engine fixes: a WAV file without a valid format chunk is rejected by the FLAC steganographer (found by the now blocking fuzz job), and authentication verdicts are declassified for the blocking constant-time job.
-
DeviceFips(package:cipherbird/cipherbird_fips.dart) performs the approved operations (SHA-2, HMAC, HKDF, PBKDF2, DRBG, AES-256-GCM, P-256 ECDH and ECDSA) inside the module the platform already validated: Apple corecrypto behind CryptoKit and CommonCrypto on iOS and macOS, the Android platform providers (Conscrypt, BoringCrypto) on Android, or the OpenSSL FIPS Provider when the engine is the fips profile.DeviceFips.module()reports what served the calls; on Android the HKDF and PBKDF2 loops run in the app around the provider's HMAC and are reported as composed. Flutter only; the browser has no validated module. -
The example app is a showcase with one screen per capability and a Play tab of interactive playgrounds (hashes, symmetric encryption, signatures, HPKE with a chosen KEM, Suite v2, a Session v2 chat, hardware keys, the validated module), with integration tests that run every section and press every button on a device.
-
Hardware-backed keys (
package:cipherbird/cipherbird_hardware.dart):HardwareKeylives in the Secure Enclave on iOS and macOS or the Android Keystore (StrongBox, with a reported fallback to the TEE), optionally behind the system biometric prompt, and wraps a new keyring slot type.keyringAddHardwareSlotandkeyringUnlockWithHardwaredrive it;attestreturns App Attest or Android key attestation documents for a server. Envelopes holding a hardware slot are version 2 and are refused by earlier versions. The Android side registers a plugin class for the method channel; the plugin stays an FFI plugin otherwise. On macOS the host app must be signed with a Team ID for the enclave keychain. -
Secrets are wiped at the FFI edge. Every native block the package allocates, natively and in the browser, is overwritten with zeros before it is freed, and so is every scratch block in the web worker; passphrases are marshalled through that path. New byte forms take a passphrase as
Uint8Listthe caller can wipe:argon2idDeriveBytes,argon2idHashStrBytes,argon2idVerifyStrBytes,molecularSealBytes,molecularOpenBytes,keyringAddPassphraseSlotBytes,keyringUnlockWithPassphraseBytes,SymmetricKey.fromPassphraseBytesand the matchingeasyand facade entries.SecretBytesis a handle for key material with a definite end of life;SymmetricKeynow holds one,SymmetricKey.bytesthrows afterdestroy,KemKeyPair.destroywipes the secret key, and KEM shared secrets are wiped once the session key is derived. -
The browser build is not approved for long-lived keys or card data: the engine's linear memory is readable by every script on the page, so a key that must outlive one operation belongs on the native platforms. The web README says so.
-
Engine fixes from the assessment: HMAC-SHA512 now uses every key byte (RFC 2104) instead of the first 32;
cryptolib_initreports failure; an envelope header can no longer demand an Argon2id cost above the policy ceiling (64 passes, 4 GiB) before it is authenticated; the MolecularVault mode byte is checked; HPKE, Noise, the DRBG, Fortuna and the PQ backend wipe their scratch secrets; Noiseinto_sessionis one shot and the transport nonce is read only; a Shamir share record with a length near 2^32 is rejected on 32-bit targets; AES-GCM inputs above 2 GiB are refused instead of truncated. -
Every web engine file is loaded with a Subresource Integrity digest.
web_setupwritesintegrityandcrossoriginattributes on the two page tags and refreshes them on rerun; the Dart loader injectscipherbird.jswith the same digest, fetchescipherbird.wasmwithintegrityand hands the verified bytes to the engine; the worker is built from the verified bytes ofcipherbird.jsandcipherbird_worker.jsand receives the verified.wasmin its first message, so it imports nothing by URL and nothing is interpolated into its source. The digests live inlib/src/engine_integrity.dart, generated from the bundled files. -
A
createCipherBirdglobal that was on the page before the verified script ran is removed rather than called. -
Adopting an engine the page booted through
cipherbird_boot.jsis now an opt-in:dart run cipherbird:web_setup --bootwrites the boot tag andCIPHERBIRD_PAGE_ENGINE=true(a dart-define) makes the loader adopt the page's engine. By defaultweb_setupwrites only the engine tag and the loader always loads through the digest-checked path, so the await inmainis required on the web; pages set up with 1.1.1 or 1.1.2 keep working but need the define to keep the no-await startup. -
Release builds (
dart.vm.product) no longer honour theCIPHERBIRD_LIBRARYandCRYPTOLIB_DYLIBenvironment variables, the package configuration or the current directory when opening the native engine; only an explicit path, the library beside the executable or the process image is used. -
Engine binaries: the desktop library for macOS is now linked against the same pinned static dependency set as the iOS and Android slices (libsodium 1.0.22, OpenSSL 3.5.9, liboqs 0.15.0, blst v0.3.17) instead of Homebrew packages, and every bundled engine is built from sha256-pinned sources with a pinned blst commit, NDK and Emscripten.
cryptolib_initreports failure with a non-zero result.
1.1.2 #
Faster public hashing; no API or wire-format change.
- The engine's unkeyed digests (SHA-256, SHA-512, BLAKE2b and BLAKE3
without a key, one shot and streaming) no longer allocate page-locked,
wiped buffers for their output. A digest of public data is public, so the
lock protected nothing and cost two system calls per hash. Measured on an
Apple M3 Max, 100,000 calls, best of five:
sha256on 32 bytes 2.44 us to 0.30 us,blake32.15 us to 0.25 us; on 1 KiB 6.09 us to 3.88 us and 4.26 us to 1.89 us. - Keyed BLAKE2b and BLAKE3,
deriveKey, HMAC, HKDF and Argon2id keep their locked, wiped buffers; a keyed BLAKE3 stream cannot take the plain path. Output bytes are unchanged, so every known answer test keeps passing. - Public outputs across the engine (ciphertexts, signatures, public keys,
envelopes, Keccak-256 and RIPEMD-160) now use plain buffers like the
digests, removing two system calls from every such call; keys, shared
secrets, decrypted plaintext, MACs and KDF outputs keep their locked, wiped
buffers. In the browser, randomness now comes from one
crypto.getRandomValuescall per buffer instead of one per byte: 32 random bytes went from 39 us to 1.3 us and a 32-byte XChaCha20 encrypt from 28 us to 4.9 us in Chrome. - Every shipped engine is rebuilt: Android, iOS, macOS and WebAssembly.
1.1.1 #
Engine hardening and smaller binaries; no API or wire-format change.
- Vault packets whose signature is not 64 bytes are rejected before verification, in packet parsing and in the symmetric and asymmetric vault open paths; a short signature previously reached the verifier and could crash the process. The asymmetric vault also checks the sender, recipient and secret key lengths on seal and open.
- Length arithmetic in the suite, session and Flagship parsers is done in
size_t, so a signature or ciphertext length near 2^32 can no longer wrap a bounds check. The suite requires the exact hybrid signature size. Regression tests cover both findings and the related short-input cases. - Every shipped binary is rebuilt with libsodium 1.0.22 and OpenSSL 3.5.9 (3.5 LTS). OpenSSL is trimmed to the EVP ciphers the engine uses, liboqs carries only the algorithms the API exposes, and the secp256k1 table is smaller. Android arm64 goes from 7.5 MB to 4.9 MB, x86_64 from 8.3 MB to 6.3 MB, iOS from 7.6 MB to 5.0 MB, macOS from 7.8 MB to 5.2 MB; the WebAssembly engine is 4.4 MB.
- The C ABI is unchanged at 265 functions and the generated web shim is identical to 1.1.0.
await CipherBird.preload()is now cheap everywhere. Natively it returns immediately instead of warming the library on an isolate; the library opens synchronously on first use. In the browser Flutter's plugin registration starts fetching and compiling the engine beforemainruns, sopreloadonly joins a download already in flight. With thecipherbird.jsand newcipherbird_boot.jsscript tags inindex.htmlthe page instantiates the engine during Flutter's bootstrap and the package adopts it synchronously, so the await can be dropped on the web as well;dart run cipherbird:web_setupadds the tags toweb/index.html. Concurrent loads are shared.CipherBird.readyis the same future for code that runs aftermain.
1.1.0 #
Web support. The engine is compiled to WebAssembly with Emscripten and
bundled as assets/cipherbird.js and assets/cipherbird.wasm; the same
Dart API runs in the browser under both flutter build web and
flutter build web --wasm, with byte-compatible envelopes, signatures and
keys. CipherBird.preload() loads the engine and is required on the web; it
takes an optional library location (a file path natively, the URL of
cipherbird.js on the web). File-path APIs are unavailable in the browser.
AES-256-GCM gained a portable OpenSSL path for CPUs without AES
instructions, byte-identical to the hardware path.
Off-thread work is now described by CipherBirdJob, plain data a runner can
copy into an isolate or post to a worker. CipherBirdRunner.run takes a job
instead of a function and a message, and the three Argon2id jobs behind the
asynchronous easy-mode helpers are public (Argon2DeriveJob,
Argon2HashJob, Argon2VerifyJob). In the browser
CipherBirdIsolateRunner runs jobs in a web worker shipped as
assets/cipherbird_worker.js, so password hashing no longer blocks the
page.
1.0.0 #
First release under the name cipherbird. The package was previously
cryptolib_flutter (last version 4.3.0); the API, the bundled binaries and
the wire formats are unchanged. The Dart entry point stays CipherBird, the
name of the native library this package binds.
4.3.0 #
Package structure and conventions.
Changed #
lib/srcnow follows one declaration per file with a 100-line limit, noelsebranches and no inline comments;test/conventions_test.dartenforces it. Native lookups live in per-domain holders resolved lazily; the large extensions are split into named chunks (CipherBirdBbsProofGen,CipherBirdRecipeSealing, ...) that the barrel re-exports, so every method is still reachable from one import.CipherBird.preload()runs through aCipherBirdRunner(CipherBirdIsolateRunnerby default,CipherBirdInlineRunnerfor tests). Await it inmainbeforerunApp.- Data classes use
const factoryredirects andfinal class. - Documentation and strings use plain ASCII;
CipherBirdRecipe.describe()joins layers with->.
Added #
lib.easy.symmetricKeyFromPassphraseAsync,hashPasswordAsyncandverifyPasswordAsyncrun Argon2id on a worker through aCipherBirdRunner.
4.2.0 #
Easy mode: developer-friendly sugar on top of the full API.
Added #
- Bytes/text extensions:
'text'.bytes,'ab12'.hexBytes,'…'.base64Bytes,bytes.hex/.base64/.base64Url/.text,bytes.constantTimeEquals(),bytes.concat(),bytes.wipe(),List<int>.u8,KeyPairResult.publicHex. SymmetricKey— 32-byte key with key-committing AEAD encryption,encryptText/decryptText, Argon2idfromPassphrase(salt:), HKDFderive(purpose), hex/base64 (de)serialisation,asKeySourcefor recipes,destroy().SigningKey/VerifyKey— Ed25519 or the Ed25519+ML-DSA-65 hybrid behind onealgorithm:argument;signText/verifyText;schemefor recipes.KemKeyPair— hybrid X25519+ML-KEM-768encapsulate/decapsulateto aSymmetricKey, and one-call public-key encryptionencryptFor/decrypt(encryptTextFor/decryptText).Identity.sealText/openTextfor the Flagship/Fortress sealed messaging.lib.easy— factories for the above plushashPassword/verifyPassword(Argon2id PHC strings),randomBytes/randomHex/token,sha256Hex.
Every easy-mode class takes an optional CipherBird and defaults to
CipherBird.instance. Composition only — no new cryptography.
4.1.0 #
Extensible recipes: mix your own encryption into a CipherBirdRecipe.
Added #
ProtectionLayeris now an abstract class you can subclass (id,wireName,seal,open) and register withProtectionLayer.register(). The four built-ins (xchacha20Poly1305,aes256Gcm,committing,molecular) are instances of the same base.CascadeLayer— a layer that is itself a mixture of layers, so several ciphers (built-in or custom) become ONE custom layer; cascades nest.KeySource(abstract) withRawKeySource,PassphraseKeySource,KeyFileSource;CipherBirdRecipe.withKeySource()accepts your own (token, KMS, keyring unlock).SignatureScheme(abstract) withEd25519Signature,HybridSignature;CipherBirdRecipe.signedWith()/verifiedWith()accept your own.- Guardrails: ids 0–127 are reserved for the library (custom parts must use
128–255, enforced); a key source must return exactly 32 bytes; a layer's
wireNamefeeds its HKDF sub-key; the envelope pins the key-source id and the signature-scheme id.
Packaging #
- First pub.dev-ready release: the prebuilt native binaries (Android
arm64-v8a + x86_64
.so, iOS device + simulator and macOSCipherBirdframeworks) are committed and included in the published archive, rebuilt against the current 265-function C ABI. RealLICENSE(MIT, credit to the author required), repository links, declared platforms (Android, iOS 15+, macOS 12+ on Apple silicon).
Changed #
verifiedBy(pk)no longer takes analgorithmargument — the envelope records which built-in scheme signed it. A custom scheme must be supplied withverifiedWith().- The wire format is unchanged: envelopes sealed by 4.0.0 open unchanged, and cross-language interop stays byte-identical.
4.0.0 #
Full parity with the native C ABI, type-safe algorithm selectors, and a grouped API for navigating the surface.
Breaking #
-
Algorithm selectors are now enums instead of bare
intwire values. Every affected call site must be updated:Before After mlKemKeygen(1)mlKemKeygen(MlKemLevel.level768)mlDsaKeygen(1)mlDsaKeygen(MlDsaLevel.level65)slhDsaKeygen(3, 1)slhDsaKeygen(SlhDsaLevel.fast192, SlhDsaHash.shake)hpkeSetupS(1, 3, 0, …)hpkeSetupS(HpkeKdf.sha256, HpkeAead.chaCha20Poly1305, HpkeMode.base, …)HpkeKdf,HpkeAeadandHpkeModewere classes ofstatic const int; they are now real enums, so the constants keep their names but change type. -
SealedInfo.suiteis aSealedTierrather than anint(1/2). Compare againstSealedTier.flagship/SealedTier.fortress.SealedTiernow carries an explicit wire value instead of relying on declaration order. -
Argon2id cost is a
KdfPresetrather than0/1, onvaultCreate,vaultFromEntropyandkeyringAddPassphraseSlot.
Added — features that had no Dart binding #
The plugin bound 218 of the 250 C ABI functions; it now binds all 244 that are
callable (the remaining 6 are struct-level *_free calls, deliberately unbound
because the buffer helpers already free those allocations).
- Stateful RNGs —
Drbg(HMAC-DRBG, SP 800-90A) andFortuna, vialib.rng.drbg(...)/lib.rng.fortuna(). Both hold native handles; callclose()when done. - Keyed and encrypted steganography —
stegoEmbedKeyed,stegoExtractKeyed,stegoEmbedEncrypted,stegoExtractDecrypt. - Carrier diagnostics —
stegoInspect(→StegoFileInspection),stegoDetectHidden(→StegoHiddenDataReport),stegoContentDigest. - Entropy-source health —
assessFileHealth(→HealthReport), the SP 800-90B style checks. - Composed carriers —
physicalSeal/physicalOpen,imageFactorSeal/imageFactorOpen,hpkeStegoSeal/hpkeStegoOpen. - Forward error correction —
fecEncode/fecDecodewithFecScheme.
Added — maximal security and composition #
-
SecurityProfile(balanced/high/maximum) sets every algorithm parameter together — ML-KEM/ML-DSA/SLH-DSA parameter sets, sealed tier, HPKE suite, Argon2id cost and the AEAD cascade.maximumtakes the strongest option at every choice, so a maximal KEM can no longer be paired with an interactive-cost KDF by accident. -
CipherBirdRecipecomposes the library's protections instead of exposing them one call at a time:final recipe = lib.maximumSecurity() .withPassphrase('correct horse battery staple') .signedBy(id.secretKey, algorithm: SignatureAlgorithm.hybrid) .verifiedBy(id.publicKey) .withFec(FecScheme.repetition3); final envelope = recipe.seal(secret); recipe.sealIntoCarrier(secret, coverPath: cover, outputPath: out);Key sources: a passphrase (Argon2id), a raw 32-byte key, or a media file (reproducible). Layers: XChaCha20-Poly1305, AES-256-GCM, key-committing AEAD, or a whole MolecularVault as one layer. Then optional signing, forward error correction, and concealment in a carrier.
Composition only — every step is an existing vetted operation. What the recipe adds is the plumbing that is easy to get wrong by hand: each layer gets its own HKDF-separated key, the recipe descriptor is authenticated as AAD by every layer, the order is fixed rather than caller-selectable, and everything fails closed.
describe()prints the configuration for review. The envelope is a library-native format, not a standard.
Added — organisation #
-
Grouped API. Each domain is reachable through a named group, so autocomplete narrows to one area instead of listing ~200 members:
lib.pq.mlKem.keygen(MlKemLevel.level768); lib.stego.detectHidden(path); lib.rng.drbg(entropy); lib.hash.sha256(bytes);Groups:
hash,aead,asym,pq(withmlKem,mlDsa,slhDsa,hybridKem,hybridSig,sntrup),bls,vault,keyring,entropy,stego,composed,chain,suite,sealed,session,frost,hpke,ecvrf,bbs,oprf,opaque,rng.These are zero-cost
extension typeviews over the same instance. The existing flat methods are unchanged and remain fully supported — neither style is deprecated. -
New result types —
StegoFileInspection,StegoHiddenDataReport,HealthReport, plus theMediaFormatandFecSchemeenums. -
MlKemLevel/MlDsaLevel/SlhDsaLevelexposebits,nistCategoryandfastVariantso a parameter set can be inspected, not just passed along.
3.0.0 #
- Initial release: hashing, AEAD, asymmetric, vaults, post-quantum
(ML-KEM/ML-DSA/SLH-DSA), hybrid KEM, BLS, keyring, sealed messaging, FROST,
HPKE, ECVRF, BBS, OPRF and OPAQUE over
dart:ffi.