node-sqlcipher
node-sqlcipher copied to clipboard
Databases created are not encrypted on Linux (Manjaro 5.15.112), electron-react-boilerplate
The database is created via the following code.
export function createDatabase(filePath: string, password: string): Promise<Database> {
return new Promise<Database>((resolve): void => {
let database: Database = new Database(filePath, async (): Promise<void> => {
database.serialize(function(): void {
database.run("PRAGMA cipher_compatibility = 4");
database.run(`PRAGMA key = '${password}'`);
});
database = await setupTables(database);
});
resolve(database);
});
}
called somewhere else in the project via:
//....
const someAsyncFunction = async () => {
const db = await createDatabase(pathToDbFile, password);
}
//....
The resulting file can be opened with an editor/sql viewer of choice without providing the specified password. The same code when compiled on windows however, will result in an encrypted Database.
It is used within the electron-react-boilerplate @journeyapps/sqlcipher version is 5.3.1 I tested it on manjaro 5.12 and manjaro 6.1.