Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sqlcipher build #326

Open
zoubingwu opened this issue Nov 18, 2019 · 3 comments
Open

Sqlcipher build #326

zoubingwu opened this issue Nov 18, 2019 · 3 comments

Comments

@zoubingwu
Copy link

Can't find a good way to do custom build since you can't pass custom flags when using tools like electron-builder, so I forked this repo and made a sqlcipher build.

In case anyone need this, just npm install better-sqlite3-sqlcipher(also requires rebuild for electron), use db.pragma('key = "password"') to pass password after initialze(first time to set password), there is an example

it goes with win_ia32/win_x64/linux_ia32/linux_x64/mac_x64 pre-compiled binaries for openssl, so other platforms or archs aren't supported for now.

@zhoukq
Copy link

zhoukq commented Jan 31, 2020

I found a way to use custom build in electron application.
At first, make sure you can build customize sqlite for better-sqlite3 with your local node.
When it turns to Electron, you can follow these steps:
debug mode:

  1. run ./node_modules/.bin/electron-rebuild use electron's node to rebuild all the native node module
  2. cd to better-sqlite3's node module, run HOME=~/.electron-gyp node-gyp rebuild --target=[your electron version] --arch=x64 --dist-url=https://atom.io/download/electron --sqlite3=[your cuustomized sqlite build folder] use electron's node manually rebuild the better-sqlite3

release mode(electron-builder):

  1. Run step1 and step 2
  2. Following https://www.electron.build/configuration/configuration, set "npmRebuild": false in package.json. In this way, you can skip native module rebuild stage when you run yarn dist

@Deveosys
Copy link

Following these instructions produce this error for me :

HOME=~/.electron-gyp node-gyp rebuild --target=11.2.0 --arch=x64 --dist-url=https://atom.io/download/electron --sqlite3=..../sqlcipher

Release/obj/gen/sqlite3/sqlite3.c:23675:10: fatal error: 'openssl/rand.h' file not found

@julianpoemp
Copy link

julianpoemp commented Jun 29, 2022

unfortunately, better-sqlite3 doesn't support sqlitecipher. The project better-sqlite3-sqlcipher is not an alternative because it's deprecated (last commit 2 years ago).
I really wanted to use it in my projects with TypeORM, but without encryption it doesn't fit my needs. I'm sure it would be a great benefit for this project to support encryption.

But it's really nice for people who don't need encryption, but rather performance gains 😄

EDIT: I found the package better-sqlite3-multiple-ciphers which fits my needs perfectly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

5 participants