{"id":26573928,"url":"https://github.com/journeyapps/node-sqlcipher","last_synced_at":"2025-04-06T03:04:45.344Z","repository":{"id":45431169,"uuid":"114878775","full_name":"journeyapps/node-sqlcipher","owner":"journeyapps","description":"SQLCipher bindings for Node","archived":false,"fork":false,"pushed_at":"2022-12-06T22:08:35.000Z","size":52589,"stargazers_count":203,"open_issues_count":22,"forks_count":67,"subscribers_count":17,"default_branch":"master","last_synced_at":"2024-04-14T00:55:28.816Z","etag":null,"topics":["electron","nodejs","sqlcipher","sqlite"],"latest_commit_sha":null,"homepage":"https://journeyapps.com","language":"PLpgSQL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/journeyapps.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-20T11:19:49.000Z","updated_at":"2024-03-31T13:40:03.000Z","dependencies_parsed_at":"2023-01-24T11:31:10.721Z","dependency_job_id":null,"html_url":"https://github.com/journeyapps/node-sqlcipher","commit_stats":null,"previous_names":[],"tags_count":54,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/journeyapps%2Fnode-sqlcipher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/journeyapps%2Fnode-sqlcipher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/journeyapps%2Fnode-sqlcipher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/journeyapps%2Fnode-sqlcipher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/journeyapps","download_url":"https://codeload.github.com/journeyapps/node-sqlcipher/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247426999,"owners_count":20937199,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["electron","nodejs","sqlcipher","sqlite"],"created_at":"2025-03-23T01:21:41.283Z","updated_at":"2025-04-06T03:04:45.307Z","avatar_url":"https://github.com/journeyapps.png","language":"PLpgSQL","readme":"Fork of [node-sqlite3](https://github.com/mapbox/node-sqlite3), modified to use [SQLCipher](https://www.zetetic.net/sqlcipher/).\n\nWhile the `node-sqlite3` project does include support for compiling against sqlcipher, it requires manual work, and does not work out-of-the-box on Electron on Windows. This fork changes the default configuration to bundle SQLCipher directly, as well as OpenSSL where required.\n\n## Supported platforms\n\nBinaries are built against N-API 3 and 6, on MacOS, Windows (ia32 and x64) and Linux (x64).\n\nNode 10+ and Electron 6+ is supported.\n\nOther platforms/architectures may work by building from source - see the section below.\n\n# Installation\n\n```sh\nyarn add \"@journeyapps/sqlcipher\"\n# Or: npm install --save \"@journeyapps/sqlcipher\"\n```\n\n# Usage\n\n``` js\nvar sqlite3 = require('@journeyapps/sqlcipher').verbose();\nvar db = new sqlite3.Database('test.db');\n\ndb.serialize(function() {\n  // This is the default, but it is good to specify explicitly:\n  db.run(\"PRAGMA cipher_compatibility = 4\");\n\n  // To open a database created with SQLCipher 3.x, use this:\n  // db.run(\"PRAGMA cipher_compatibility = 3\");\n\n  db.run(\"PRAGMA key = 'mysecret'\");\n  db.run(\"CREATE TABLE lorem (info TEXT)\");\n\n  var stmt = db.prepare(\"INSERT INTO lorem VALUES (?)\");\n  for (var i = 0; i \u003c 10; i++) {\n      stmt.run(\"Ipsum \" + i);\n  }\n  stmt.finalize();\n\n  db.each(\"SELECT rowid AS id, info FROM lorem\", function(err, row) {\n      console.log(row.id + \": \" + row.info);\n  });\n});\n\ndb.close();\n```\n\n# SQLCipher\n\nA copy of the source for SQLCipher 4.4.2 is bundled, which is based on SQLite 3.33.0.\n\n## Building from source.\n\nBuilding from source when installing the package is only supported up to version 5.2.0.\n\nThe two pre-built versions (N-API 3 and N-API 6) cover all electron and node versions, so building from source should\nnot be required.\n\n## Usage with electron-forge / electron-rebuild\n\n[electron-forge](https://www.electronforge.io/) uses [electron-rebuild](https://github.com/electron/electron-rebuild) and attempts to rebuild this library from source by default, in a way\nthat is _not_ compatible with the way `node-pre-gyp` is used here.\n\nThe workaround is to disable the rebuilding:\n1. If using Electron 11+, use a node version that supports N-API 6+ (v10.20.0+ / v12.17.0+ / v14.0.0).\n2. After `npm install` / `yarn install`, make sure that the folder `node_modules/@journeyapps/sqlcipher/lib/binding/napi-v6-linux-x64` exists.\n   If not, check the previous step again, remove the `node_modules` folder, and try again.\n3. Disable rebuilding of this library using the `onlyModules` option of `electron-rebuild` in your `package.json`:\n\n        \"config\": {\n            \"forge\": {\n                \"electronRebuildConfig\": {\n                    \"onlyModules\": []  // Specify other native modules here if required\n                }\n            }\n        }\n\nNote: [electron-builder](https://www.electron.build/) does not appear to have this issue, and should work directly.\nSimilarly, using electron directly should just work, but do check that a compatible node version is used (see above). \n\n## OpenSSL\n\nSQLCipher depends on OpenSSL.\n\nFor Windows, we bundle OpenSSL 1.1.1i. Binaries are generated using [vckpg](https://github.com/microsoft/vcpkg) (e.g., `.\\vcpkg\\vcpkg install openssl:x64-windows-static`).\n\nOn Mac we bundle OpenSSL 1.1.1l.\n\nOn Linux we dynamically link against the system OpenSSL.\n\n# API\n\nSee the [API documentation](https://github.com/mapbox/node-sqlite3/wiki) in the wiki.\n\nDocumentation for the SQLCipher extension is available [here](https://www.zetetic.net/sqlcipher/sqlcipher-api/).\n\n# Acknowledgments\n\nMost of the work in this library is from the [node-sqlite3](https://github.com/mapbox/node-sqlite3) library by [MapBox](https://mapbox.com/).\n\nAdditionally, some of the SQLCipher-related changes are based on a fork by [liubiggun](https://github.com/liubiggun/node-sqlite3).\n\n# License\n\n`node-sqlcipher` is [BSD licensed](./LICENSE).\n\n`SQLCipher` is `Copyright (c) 2016, ZETETIC LLC` under the [BSD license](https://github.com/sqlcipher/sqlcipher/blob/master/LICENSE).\n\n`SQLite` is Public Domain\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjourneyapps%2Fnode-sqlcipher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjourneyapps%2Fnode-sqlcipher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjourneyapps%2Fnode-sqlcipher/lists"}