my approach to creating and using an sqlite3 encrypted database.
1_ create an encrypted db file using the ubuntu package sudo apt-get install sqlcipher
.
2_ setting PRAGMA key = 'secret'
.
3_ in electron :
const myDBConfig = {
client: "sqlite3",
connection: {
filename: __dirname.concat("/../../enc_schema.db")
},
pool: {
afterCreate: function(conn, done) {
conn.run("PRAGMA KEY = 'secret'");
done();
}
}
}
const knex = require('knex')(myDBConfig);
the output is : SQLITE_NOTADB: file is not a database.
was my approach completely wrong or is it fixable ???