Skip to content

Databases created are not encrypted on Linux (Manjaro 5.15.112), electron-react-boilerplate #110

@dashDotter

Description

@dashDotter

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions