Hi,
I've built sqlite with sqlcipher sucessfully. Everything works fine if I use sqlite without sqlcipher features. But as soon as I works with an encrypted db, the main process is killed after a few requests.
Here is an example thas works on a non-encrypted file but fails with a passphrase:
const db = new sqlite3.Database("my_file.db)
db.serialize(function () {
// Do not work if the next line is used
db.run("PRAGMA key = 'passphrase'", console.log)
db.run(`CREATE TABLE IF NOT EXISTS demo (
id INTEGER PRIMARY KEY,
first_name TEXT,
last_name TEXT
)`, console.log)
db.run("INSERT INTO demo (id, first_name, last_name) VALUES (1, 'a', 'b')", console.log)
db.all("select * from demo", (err, rows) => console.log(rows))
})
db.close()
In both cases (with or without encryption), I get correct results in console. But with encryption the main process crashes with the following message just after the requests return: App • ⚠️ Electron process was killed. Exiting...
Puting the whole script in a try-catch doesn't help. Sometimes the main process stay alive for a few seconds, but calling db.close() or any sql exception (ie: duplicate key) seem to crash the process instantly.
Am I missing something to deal with encryption properly?
Hi, I've built sqlite with sqlcipher sucessfully. Everything works fine if I use sqlite without sqlcipher features. But as soon as I works with an encrypted db, the main process is killed after a few requests.
Here is an example thas works on a non-encrypted file but fails with a passphrase:
In both cases (with or without encryption), I get correct results in console. But with encryption the main process crashes with the following message just after the requests return:
App • ⚠️ Electron process was killed. Exiting...
Puting the whole script in a try-catch doesn't help. Sometimes the main process stay alive for a few seconds, but calling
db.close()
or any sql exception (ie: duplicate key) seem to crash the process instantly.Am I missing something to deal with encryption properly?