Registry / database / cordova-sqlcipher-adapter

cordova-sqlcipher-adapter

JSON →
library0.6.0jsnpmunverified

Native SQLCipher version 4 database adapter for Cordova/PhoneGap applications on Android, iOS, and macOS platforms, based on cordova-sqlite-storage. Version 0.6.0 is stable but in maintenance-only mode (no active development). It provides an HTML5 Web SQL API-compatible interface with encrypted SQLite databases via SQLCipher. Key differentiators include free MIT license (with Apache 2.0 option for Android) and support for multiple platforms, but it suffers from known limitations: multiple SQLite corruption problems, Windows 10 UWP support disabled, and armeabi CPU support dropped. Alternative plugins with commercial licenses offer lighter resource usage. Breaking changes are pending in an upcoming major release.

npm install cordova-sqlcipher-adapter
INSTALL
IMPORT
SIG · CORDOVA-SQLCIPHER-
C
cordova-sqlcipher-adapter
databasejavascriptv0.6.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import sqlitePlugin from 'cordova-sqlcipher-adapter';
const sqlitePlugin = require('cordova-sqlcipher-adapter');
ESM import not officially supported; typically used via script tag or window.sqlitePlugin. The plugin is injected as window.sqlitePlugin after installation and platform build.
SQLitePlugin
import { SQLitePlugin } from 'cordova-sqlcipher-adapter';
const SQLitePlugin = require('cordova-sqlcipher-adapter').SQLitePlugin;
The SQLitePlugin constructor is exported, but usage via window.sqlitePlugin is more common.
SQLiteFactory
// Not exported as a named import; use window.sqlitePlugin directly.
const { openDatabase } = require('cordova-sqlcipher-adapter');
The traditional openDatabase and deleteDatabase functions are available on window.sqlitePlugin after deviceready.

Opens an encrypted SQLite database with SQLCipher, creates a table, inserts a row, and queries it using both transaction and batch execution.

// Ensure plugin is installed and deviceready fired document.addEventListener('deviceready', () => { const db = window.sqlitePlugin.openDatabase({name: 'test.db', location: 'default', key: 'password'}); db.transaction((tx) => { tx.executeSql('CREATE TABLE IF NOT EXISTS test (id integer primary key, value text)'); tx.executeSql('INSERT INTO test VALUES (?,?)', [1, 'hello']); }); db.transaction((tx) => { tx.executeSql('SELECT * FROM test', [], (tx, res) => { console.log('Result:', res.rows.item(0)); }); }); db.executeSql('SELECT * FROM test', [], (res) => { console.log('Batch result:', res); }); }, false);
Debug
Known issues
breakingMultiple SQLite corruption problem exists in Android, iOS, and macOS - see issue #626
fix
Consider using alternative plugins (cordova-sqlite-evcore-extbuild-free or commercial) or upgrading to upcoming major release (if available).
affects: <=0.6.0
breakingWindows 10 (UWP) support is disabled due to major limitations
fix
Use a different Cordova SQLite plugin for Windows or target Android/iOS/macOS only.
affects: >=0.3.0 <=0.6.0
deprecatedExtra-old armeabi CPU for Android pre-5.0 is no longer supported
fix
Update target Android to 5.0+ or use armeabi-v7a compatible device.
affects: >=0.3.0
gotchaWithout the database password there is no proven way to recover the data.
fix
Always backup the password and ensure it is safely stored (e.g., using device secure storage).
affects: all
gotchaError code will always be 0 for all errors in upcoming major release (breaking change).
fix
Adapt error handling to rely on message strings rather than error codes.
affects: >=0.3.0
Errors
Common errors & fixes
Error: Could not locate plugin 'cordova-sqlcipher-adapter'
Plugin not installed or not properly added to Cordova project.
fix
Run: cordova plugin add cordova-sqlcipher-adapter
TypeError: window.sqlitePlugin is undefined
Calling plugin API before deviceready event or improper platform build.
fix
Wrap calls in document.addEventListener('deviceready', ...) and rebuild platform.
SQLitePlugin.openDatabase: Invalid or missing required argument: 'key'
Missing key/password argument when opening database.
fix
Pass {name: 'db', key: 'yourPassword'} to openDatabase.
Upgrade
Version history
0.6.0latest on npm
Audit
Dependencies
cordovarequiredCordova framework required for native plugin integration
Agent activity
18 hits · last 30 days
node
14
OpenAI (training)
1
Resources
cordova-sqlcipher-adapter — npm install cordova-sqlcipher-adapter · libregistry