Changelog
Unreleased
Fixed
- (none yet — no behavioural changes since 1.0.4.)
Added
- Test suite. Vitest covering round-trip encrypt/decrypt across primitives, objects, arrays, unicode, very-long inputs, and the empty-string boundary; the explicit-driver overload (
AES,TripleDES); known-answer vectors formd5/sha1/sha256/sha512; configuration-default semantics; and decrypt failure modes (wrong key, malformed cipher, empty string). - README with a prominent security notice spelling out the threat model: these helpers wrap
crypto-js’s passphrase-keyed AES-CBC + OpenSSL-style MD5 KDF; ciphertext is not authenticated;md5/sha1are not collision-resistant. Includes explicit “use for” / “do NOT use for” lists. - CHANGELOG,
llms.txt,llms-full.txt, and askills/folder (README,overviewwith a security-boundaries section,encrypt-decrypt,hashes,configuration,recipes) for tool-assisted development. vitest.config.tswith thenodeenvironment and the self-detecting sibling-alias pattern used elsewhere in the workspace.- CI. GitHub Actions workflow: Node 18/20/22 × Ubuntu, plus Node 20 × Windows.
package.jsonpolish.sideEffects: false, sharperdescription, expandedkeywords,vitestandtypescriptdev-dependencies,test/test:watchscripts.
Changed
- (none — the public API is unchanged.)
Removed
- (none.)
Tests
30 passingKnown caveats (documented, not fixed)
decryptlogs decode errors viaconsole.warnand returnsnull. Callers cannot distinguish “wrong key” from “malformed input” from “tampered cipher” — the wrapper does not provide authentication, so by design it can only signal “did this round-trip as JSON or not.”encrypt(undefined)round-trips toundefined(becauseJSON.stringify({ data: undefined })is"{}", which decrypts and parses to{}, whose.dataisundefined). This is a property of the JSON layer, not of the cipher.encryptof a value containing circular references throws synchronously (fromJSON.stringify) before any encryption happens — caller responsibility.