-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ref: fritx/win-sqlcipher#1 ref: fritx/win-sqlcipher#2
- Loading branch information
Showing
4 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<script> | ||
// https://github.com/delaballe/node-sqlcipher#usage | ||
// https://coolaj86.com/articles/building-sqlcipher-for-node-js-on-raspberry-pi-2/ | ||
'use strict'; | ||
var sqlite3 = require('cross-sqlcipher').verbose(); | ||
var db = new sqlite3.Database('./test.db'); | ||
|
||
db.serialize(function() { | ||
db.run("PRAGMA KEY = 'secret'"); | ||
db.run("PRAGMA CIPHER = 'aes-128-cbc'"); | ||
|
||
db.run("DROP TABLE IF EXISTS lorem"); | ||
db.run("CREATE TABLE lorem (info TEXT)"); | ||
|
||
var stmt = db.prepare("INSERT INTO lorem VALUES (?)"); | ||
for (var i = 0; i < 10; i++) { | ||
stmt.run("Ipsum " + i); | ||
} | ||
stmt.finalize(); | ||
|
||
db.each("SELECT rowid AS id, info FROM lorem", function(err, row) { | ||
document.write(row.id + ": " + row.info + '<br>'); | ||
}); | ||
}); | ||
|
||
db.close(); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
let { app, BrowserWindow } = require('electron') | ||
let { join } = require('path') | ||
|
||
let win | ||
|
||
app.on('ready', () => { | ||
let url = 'file://' + join(__dirname, 'main.html') | ||
win = new BrowserWindow() | ||
win.loadURL(url) | ||
|
||
win.openDevTools() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "electron-test", | ||
"main": "main.js", | ||
"scripts": { | ||
"rebuild": "electron-rebuild", | ||
"start": "electron ." | ||
}, | ||
"devDependencies": { | ||
"cross-sqlcipher": "0.0.2", | ||
"electron": "^1.6.10", | ||
"electron-rebuild": "^1.5.11" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters