nedb icon indicating copy to clipboard operation
nedb copied to clipboard

protect Database file

Open jaykukadiya99 opened this issue 4 years ago • 1 comments

is there any way to protect DB file with password?

jaykukadiya99 avatar Jun 12 '20 13:06 jaykukadiya99

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) } })

bogere avatar Jun 08 '21 15:06 bogere