nedb
nedb copied to clipboard
protect Database file
is there any way to protect DB file with password?
I have not yet seen that feature, howveer you can just encrypt and decrypt the records on fly so even if someone sees the data, they cannot change encrypted data.
const contactDB = new DataStore({ filename: path.join(app.getPath('userData'), './data/contact.json'), autoload: true, corruptAlertThreshold: 1,//0 means you don't tolerate any corruption, 1 means you don't care. timestampData: true, // automatically add and manage the fields createdAt and updatedAt //encryption for nedb afterSerialization: (plaintext)=>{ return encryptNebDatabase(plaintext) }, beforeDeserialization:(ciphertext)=>{ return decryptNedbDatabase(ciphertext) } })