mirror of
https://github.com/Kong/insomnia.git
synced 2026-11-03 11:35:20 -05:00
Add the fieldEncryptionKey init option: the same encryption hooks are attached to every datastore of a persistent instance, and in-memory instances ignore it. init() now waits for every datastore to load before repairing the database, and rejects with an AggregateError naming the datastores that failed, instead of hanging at the first query on a datastore that never became ready. A failed init discards the half-loaded datastores, forces autoload on, and installs a no-op onload handler so NeDB does not also raise an unhandled rejection. With a key, the encrypted path table is derived up front so a broken schema fails init. The decryption failure report is created per init() and reconciled after the load (a .db file holds several lines per document, so failures on lines that a later line replaced or deleted are dropped). It is exposed to a createNedbDatabase wrapper as getFieldDecryptionFailures(). Tests run real NeDB datastores in a temp directory. Update the design doc to match, and replace the crypto mock in the hook tests with a fake key. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>