Socket
Socket
Sign inDemoInstall

@capacitor-community/sqlite

Package Overview
Dependencies
Maintainers
31
Versions
242
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@capacitor-community/sqlite - npm Package Compare versions

Comparing version 3.0.0-beta.12 to 3.0.0-beta.13

android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/UtilsSecret.java

15

CHANGELOG.md

@@ -0,1 +1,16 @@

## 3.0.0-beta.13 (2021-05-06)
### Chore
- Update to Capacitor 3.0.0-rc.1
### Added Features
- Allow users to set secret #issue88
- add isSecretStored, setEncryptionSecret, changeEncryptionSecret methods
### Bug Fixes
- ImportFromJson in Partial Mode without schema changes #issue113
## 3.0.0-beta.12 (2021-04-24)

@@ -2,0 +17,0 @@

72

dist/esm/definitions.d.ts

@@ -1,6 +0,1 @@

declare module '@capacitor/core' {
interface PluginRegistry {
CapacitorSQLite: CapacitorSQLitePlugin;
}
}
/**

@@ -11,2 +6,29 @@ * CapacitorSQLitePlugin Interface

/**
* Check if a passphrase exists in a secure store
*
* @return Promise<capSQLiteResult>
* @since 3.0.0-beta.13
*/
isSecretStored(): Promise<capSQLiteResult>;
/**
* Store a passphrase in a secure store
* Update the secret of previous encrypted databases with GlobalSQLite
* !!! Only to be used once if you wish to encrypt database !!!
*
* @param options capSetSecretOptions
* @return Promise<void>
* @since 3.0.0-beta.13
*/
setEncryptionSecret(options: capSetSecretOptions): Promise<void>;
/**
* Change the passphrase in a secure store
* Update the secret of previous encrypted databases with passphrase
* in secure store
*
* @param options capChangeSecretOptions
* @return Promise<void>
* @since 3.0.0-beta.13
*/
changeEncryptionSecret(options: capChangeSecretOptions): Promise<void>;
/**
* create a database connection

@@ -196,2 +218,18 @@ * @param options capConnectionOptions

}
export interface capSetSecretOptions {
/**
* The passphrase for Encrypted Databases
*/
passphrase?: string;
}
export interface capChangeSecretOptions {
/**
* The new passphrase for Encrypted Databases
*/
passphrase?: string;
/**
* The old passphrase for Encrypted Databases
*/
oldpassphrase?: string;
}
export interface capEchoOptions {

@@ -540,2 +578,23 @@ /**

/**
* Check if a secret is stored
* @returns Promise<capSQLiteResult>
* @since 3.0.0-beta.13
*/
isSecretStored(): Promise<capSQLiteResult>;
/**
* Set a passphrase in a secure store
* @param passphrase
* @returns Promise<void>
* @since 3.0.0-beta.13
*/
setEncryptionSecret(passphrase: string): Promise<void>;
/**
* Change the passphrase in a secure store
* @param passphrase
* @param oldpassphrase
* @returns Promise<void>
* @since 3.0.0-beta.13
*/
changeEncryptionSecret(passphrase: string, oldpassphrase: string): Promise<void>;
/**
* Add the upgrade Statement for database version upgrading

@@ -658,2 +717,5 @@ * @param database

echo(value: string): Promise<capEchoResult>;
isSecretStored(): Promise<capSQLiteResult>;
setEncryptionSecret(passphrase: string): Promise<void>;
changeEncryptionSecret(passphrase: string, oldpassphrase: string): Promise<void>;
addUpgradeStatement(database: string, fromVersion: number, toVersion: number, statement: string, set?: capSQLiteSet[]): Promise<void>;

@@ -660,0 +722,0 @@ createConnection(database: string, encrypted: boolean, mode: string, version: number): Promise<SQLiteDBConnection>;

@@ -12,2 +12,32 @@ /**

}
async isSecretStored() {
try {
const res = await this.sqlite.isSecretStored();
return Promise.resolve(res);
}
catch (err) {
return Promise.reject(err);
}
}
async setEncryptionSecret(passphrase) {
try {
await this.sqlite.setEncryptionSecret({ passphrase: passphrase });
return Promise.resolve();
}
catch (err) {
return Promise.reject(err);
}
}
async changeEncryptionSecret(passphrase, oldpassphrase) {
try {
await this.sqlite.changeEncryptionSecret({
passphrase: passphrase,
oldpassphrase: oldpassphrase,
});
return Promise.resolve();
}
catch (err) {
return Promise.reject(err);
}
}
async addUpgradeStatement(database, fromVersion, toVersion, statement, set) {

@@ -14,0 +44,0 @@ const upgrade = {

6

dist/esm/web.d.ts
import { WebPlugin } from '@capacitor/core';
import type { CapacitorSQLitePlugin, capEchoOptions, capSQLiteOptions, capSQLiteExecuteOptions, capSQLiteSetOptions, capSQLiteRunOptions, capSQLiteQueryOptions, capSQLiteImportOptions, capSQLiteExportOptions, capSQLiteSyncDateOptions, capSQLiteUpgradeOptions, capSQLiteTableOptions, capSQLitePathOptions, capEchoResult, capSQLiteResult, capSQLiteChanges, capSQLiteValues, capSQLiteJson, capSQLiteSyncDate, capAllConnectionsOptions } from './definitions';
import type { CapacitorSQLitePlugin, capEchoOptions, capSQLiteOptions, capSQLiteExecuteOptions, capSQLiteSetOptions, capSQLiteRunOptions, capSQLiteQueryOptions, capSQLiteImportOptions, capSQLiteExportOptions, capSQLiteSyncDateOptions, capSQLiteUpgradeOptions, capSQLiteTableOptions, capSQLitePathOptions, capEchoResult, capSQLiteResult, capSQLiteChanges, capSQLiteValues, capSQLiteJson, capSQLiteSyncDate, capAllConnectionsOptions, capSetSecretOptions, capChangeSecretOptions } from './definitions';
export declare class CapacitorSQLiteWeb extends WebPlugin implements CapacitorSQLitePlugin {
constructor();
echo(options: capEchoOptions): Promise<capEchoResult>;
isSecretStored(): Promise<capSQLiteResult>;
setEncryptionSecret(options: capSetSecretOptions): Promise<void>;
changeEncryptionSecret(options: capChangeSecretOptions): Promise<void>;
createConnection(options: capSQLiteOptions): Promise<void>;

@@ -7,0 +9,0 @@ open(options: capSQLiteOptions): Promise<void>;

import { WebPlugin } from '@capacitor/core';
export class CapacitorSQLiteWeb extends WebPlugin {
constructor() {
super({
name: 'CapacitorSQLite',
platforms: ['web'],
});
}
async echo(options) {

@@ -13,2 +7,14 @@ console.log('ECHO in Web plugin', options);

}
async isSecretStored() {
console.log('isSecretStored');
throw this.unimplemented('Not implemented on web.');
}
async setEncryptionSecret(options) {
console.log('setEncryptionSecret', options);
throw this.unimplemented('Not implemented on web.');
}
async changeEncryptionSecret(options) {
console.log('changeEncryptionSecret', options);
throw this.unimplemented('Not implemented on web.');
}
async createConnection(options) {

@@ -15,0 +21,0 @@ console.log('createConnection', options);

@@ -18,2 +18,32 @@ 'use strict';

}
async isSecretStored() {
try {
const res = await this.sqlite.isSecretStored();
return Promise.resolve(res);
}
catch (err) {
return Promise.reject(err);
}
}
async setEncryptionSecret(passphrase) {
try {
await this.sqlite.setEncryptionSecret({ passphrase: passphrase });
return Promise.resolve();
}
catch (err) {
return Promise.reject(err);
}
}
async changeEncryptionSecret(passphrase, oldpassphrase) {
try {
await this.sqlite.changeEncryptionSecret({
passphrase: passphrase,
oldpassphrase: oldpassphrase,
});
return Promise.resolve();
}
catch (err) {
return Promise.reject(err);
}
}
async addUpgradeStatement(database, fromVersion, toVersion, statement, set) {

@@ -397,8 +427,2 @@ const upgrade = {

class CapacitorSQLiteWeb extends core.WebPlugin {
constructor() {
super({
name: 'CapacitorSQLite',
platforms: ['web'],
});
}
async echo(options) {

@@ -408,2 +432,14 @@ console.log('ECHO in Web plugin', options);

}
async isSecretStored() {
console.log('isSecretStored');
throw this.unimplemented('Not implemented on web.');
}
async setEncryptionSecret(options) {
console.log('setEncryptionSecret', options);
throw this.unimplemented('Not implemented on web.');
}
async changeEncryptionSecret(options) {
console.log('changeEncryptionSecret', options);
throw this.unimplemented('Not implemented on web.');
}
async createConnection(options) {

@@ -410,0 +446,0 @@ console.log('createConnection', options);

@@ -15,2 +15,32 @@ var capacitorCapacitorSQLite = (function (exports, core) {

}
async isSecretStored() {
try {
const res = await this.sqlite.isSecretStored();
return Promise.resolve(res);
}
catch (err) {
return Promise.reject(err);
}
}
async setEncryptionSecret(passphrase) {
try {
await this.sqlite.setEncryptionSecret({ passphrase: passphrase });
return Promise.resolve();
}
catch (err) {
return Promise.reject(err);
}
}
async changeEncryptionSecret(passphrase, oldpassphrase) {
try {
await this.sqlite.changeEncryptionSecret({
passphrase: passphrase,
oldpassphrase: oldpassphrase,
});
return Promise.resolve();
}
catch (err) {
return Promise.reject(err);
}
}
async addUpgradeStatement(database, fromVersion, toVersion, statement, set) {

@@ -394,8 +424,2 @@ const upgrade = {

class CapacitorSQLiteWeb extends core.WebPlugin {
constructor() {
super({
name: 'CapacitorSQLite',
platforms: ['web'],
});
}
async echo(options) {

@@ -405,2 +429,14 @@ console.log('ECHO in Web plugin', options);

}
async isSecretStored() {
console.log('isSecretStored');
throw this.unimplemented('Not implemented on web.');
}
async setEncryptionSecret(options) {
console.log('setEncryptionSecret', options);
throw this.unimplemented('Not implemented on web.');
}
async changeEncryptionSecret(options) {
console.log('changeEncryptionSecret', options);
throw this.unimplemented('Not implemented on web.');
}
async createConnection(options) {

@@ -407,0 +443,0 @@ console.log('createConnection', options);

import { WebPlugin } from '@capacitor/core';
import type { CapacitorSQLitePlugin, capConnectionOptions, capEchoOptions, capEchoResult, capSQLiteChanges, capSQLiteExecuteOptions, capSQLiteExportOptions, capSQLiteImportOptions, capSQLiteJson, capSQLiteOptions, capSQLiteQueryOptions, capSQLiteResult, capSQLiteRunOptions, capSQLiteSetOptions, capSQLiteSyncDateOptions, capSQLiteUpgradeOptions, capSQLiteValues, capSQLiteSyncDate, capSQLiteTableOptions, capSQLitePathOptions, capAllConnectionsOptions } from './definitions';
import type { CapacitorSQLitePlugin, capConnectionOptions, capEchoOptions, capEchoResult, capSQLiteChanges, capSQLiteExecuteOptions, capSQLiteExportOptions, capSQLiteImportOptions, capSQLiteJson, capSQLiteOptions, capSQLiteQueryOptions, capSQLiteResult, capSQLiteRunOptions, capSQLiteSetOptions, capSQLiteSyncDateOptions, capSQLiteUpgradeOptions, capSQLiteValues, capSQLiteSyncDate, capSQLiteTableOptions, capSQLitePathOptions, capAllConnectionsOptions, capSetSecretOptions, capChangeSecretOptions } from './definitions';
export declare class CapacitorSQLiteElectronWeb extends WebPlugin implements CapacitorSQLitePlugin {

@@ -12,2 +12,5 @@ RemoteRef: any;

constructor();
isSecretStored(): Promise<capSQLiteResult>;
setEncryptionSecret(options: capSetSecretOptions): Promise<void>;
changeEncryptionSecret(options: capChangeSecretOptions): Promise<void>;
createConnection(options: capConnectionOptions): Promise<void>;

@@ -14,0 +17,0 @@ closeConnection(options: capSQLiteOptions): Promise<void>;

@@ -11,6 +11,3 @@ import { __awaiter } from "tslib";

constructor() {
super({
name: 'CapacitorSQLite',
platforms: ['electron'],
});
super();
this.RemoteRef = null;

@@ -26,2 +23,20 @@ this._dbDict = {};

}
isSecretStored() {
return __awaiter(this, void 0, void 0, function* () {
console.log('isSecretStored');
throw this.unimplemented('Not implemented on Electron.');
});
}
setEncryptionSecret(options) {
return __awaiter(this, void 0, void 0, function* () {
console.log('setEncryptionSecret', options);
throw this.unimplemented('Not implemented on Electron.');
});
}
changeEncryptionSecret(options) {
return __awaiter(this, void 0, void 0, function* () {
console.log('changeEncryptionSecret', options);
throw this.unimplemented('Not implemented on Electron.');
});
}
createConnection(options) {

@@ -28,0 +43,0 @@ return __awaiter(this, void 0, void 0, function* () {

@@ -1,6 +0,1 @@

declare module '@capacitor/core' {
interface PluginRegistry {
CapacitorSQLite: CapacitorSQLitePlugin;
}
}
/**

@@ -11,2 +6,29 @@ * CapacitorSQLitePlugin Interface

/**
* Check if a passphrase exists in a secure store
*
* @return Promise<capSQLiteResult>
* @since 3.0.0-beta.13
*/
isSecretStored(): Promise<capSQLiteResult>;
/**
* Store a passphrase in a secure store
* Update the secret of previous encrypted databases with GlobalSQLite
* !!! Only to be used once if you wish to encrypt database !!!
*
* @param options capSetSecretOptions
* @return Promise<void>
* @since 3.0.0-beta.13
*/
setEncryptionSecret(options: capSetSecretOptions): Promise<void>;
/**
* Change the passphrase in a secure store
* Update the secret of previous encrypted databases with passphrase
* in secure store
*
* @param options capChangeSecretOptions
* @return Promise<void>
* @since 3.0.0-beta.13
*/
changeEncryptionSecret(options: capChangeSecretOptions): Promise<void>;
/**
* create a database connection

@@ -196,2 +218,18 @@ * @param options capConnectionOptions

}
export interface capSetSecretOptions {
/**
* The passphrase for Encrypted Databases
*/
passphrase?: string;
}
export interface capChangeSecretOptions {
/**
* The new passphrase for Encrypted Databases
*/
passphrase?: string;
/**
* The old passphrase for Encrypted Databases
*/
oldpassphrase?: string;
}
export interface capEchoOptions {

@@ -540,2 +578,23 @@ /**

/**
* Check if a secret is stored
* @returns Promise<capSQLiteResult>
* @since 3.0.0-beta.13
*/
isSecretStored(): Promise<capSQLiteResult>;
/**
* Set a passphrase in a secure store
* @param passphrase
* @returns Promise<void>
* @since 3.0.0-beta.13
*/
setEncryptionSecret(passphrase: string): Promise<void>;
/**
* Change the passphrase in a secure store
* @param passphrase
* @param oldpassphrase
* @returns Promise<void>
* @since 3.0.0-beta.13
*/
changeEncryptionSecret(passphrase: string, oldpassphrase: string): Promise<void>;
/**
* Add the upgrade Statement for database version upgrading

@@ -658,2 +717,5 @@ * @param database

echo(value: string): Promise<capEchoResult>;
isSecretStored(): Promise<capSQLiteResult>;
setEncryptionSecret(passphrase: string): Promise<void>;
changeEncryptionSecret(passphrase: string, oldpassphrase: string): Promise<void>;
addUpgradeStatement(database: string, fromVersion: number, toVersion: number, statement: string, set?: capSQLiteSet[]): Promise<void>;

@@ -660,0 +722,0 @@ createConnection(database: string, encrypted: boolean, mode: string, version: number): Promise<SQLiteDBConnection>;

@@ -15,2 +15,38 @@ import { __awaiter } from "tslib";

}
isSecretStored() {
return __awaiter(this, void 0, void 0, function* () {
try {
const res = yield this.sqlite.isSecretStored();
return Promise.resolve(res);
}
catch (err) {
return Promise.reject(err);
}
});
}
setEncryptionSecret(passphrase) {
return __awaiter(this, void 0, void 0, function* () {
try {
yield this.sqlite.setEncryptionSecret({ passphrase: passphrase });
return Promise.resolve();
}
catch (err) {
return Promise.reject(err);
}
});
}
changeEncryptionSecret(passphrase, oldpassphrase) {
return __awaiter(this, void 0, void 0, function* () {
try {
yield this.sqlite.changeEncryptionSecret({
passphrase: passphrase,
oldpassphrase: oldpassphrase,
});
return Promise.resolve();
}
catch (err) {
return Promise.reject(err);
}
});
}
addUpgradeStatement(database, fromVersion, toVersion, statement, set) {

@@ -17,0 +53,0 @@ return __awaiter(this, void 0, void 0, function* () {

@@ -27,2 +27,4 @@ import { WebPlugin } from '@capacitor/core';

capAllConnectionsOptions,
capSetSecretOptions,
capChangeSecretOptions,
} from './definitions';

@@ -52,6 +54,3 @@ import { Database } from './electron-utils/Database';

constructor() {
super({
name: 'CapacitorSQLite',
platforms: ['electron'],
});
super();
console.log('CapacitorSQLite Electron');

@@ -61,2 +60,15 @@ this.RemoteRef = remote;

}
async isSecretStored(): Promise<capSQLiteResult> {
console.log('isSecretStored');
throw this.unimplemented('Not implemented on Electron.');
}
async setEncryptionSecret(options: capSetSecretOptions): Promise<void> {
console.log('setEncryptionSecret', options);
throw this.unimplemented('Not implemented on Electron.');
}
async changeEncryptionSecret(options: capChangeSecretOptions): Promise<void> {
console.log('changeEncryptionSecret', options);
throw this.unimplemented('Not implemented on Electron.');
}
async createConnection(options: capConnectionOptions): Promise<void> {

@@ -63,0 +75,0 @@ const keys = Object.keys(options);

{
"name": "@capacitor-community/sqlite",
"version": "3.0.0-beta.12",
"version": "3.0.0-beta.13",
"description": "Community plugin for native & electron SQLite databases",

@@ -30,2 +30,3 @@ "main": "dist/plugin.cjs.js",

"native",
"electron",
"database",

@@ -35,6 +36,7 @@ "sqlite"

"scripts": {
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web && npm run verify:electron",
"verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin OTHER_CFLAGS='-DHAVE_GETHOSTUUID=0' && cd ..",
"verify:android": "cd android && ./gradlew clean build test && cd ..",
"verify:web": "npm run build",
"verify:electron": "npm run build-electron",
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",

@@ -57,7 +59,7 @@ "fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- autocorrect --format",

"devDependencies": {
"@capacitor/android": "next",
"@capacitor/core": "next",
"@capacitor/android": "^3.0.0-rc.1",
"@capacitor/core": "3.0.0-rc.1",
"@capacitor/docgen": "^0.0.10",
"@capacitor/ios": "next",
"@ionic/eslint-config": "^0.3.0",
"@capacitor/ios": "^3.0.0-rc.1",
"@ionic/eslint-config": "^0.1.0",
"@ionic/prettier-config": "^1.0.1",

@@ -77,3 +79,3 @@ "@ionic/swiftlint-config": "^1.1.2",

"peerDependencies": {
"@capacitor/core": "next"
"@capacitor/core": "^3.0.0-rc.1"
},

@@ -80,0 +82,0 @@ "prettier": "@ionic/prettier-config",

@@ -35,2 +35,20 @@ <p align="center"><br><img src="https://user-images.githubusercontent.com/236501/85893648-1c92e880-b7a8-11ea-926d-95355b8175c7.png" width="128" height="128" /></p>

🚨 Since release 3.0.0-beta.13 ->> 🚨
- GlobalSQLite `secret`and `newsecret` are deprecated
- The user can now set its own secure secret (passphrase)
- use `setEncryptionSecret` ONCE to migrate encrypted databases
from `secret` to `secure stored secret`
- use `changeEncryptionSecret` to change your `secure stored secret`
- iOS used `KeyChain service` to store the `secret`
- Android used `Encrypted SharedPreferences` to store the `secret`,
the minimun sdk should be set to 23 (limitation from Google)
🚨 Since release 3.0.0-beta.13 ->> 🚨
🚨 Since release 3.0.0-beta.11 ->> 🚨

@@ -210,2 +228,5 @@

| checkConnectionsConsistency | ✅ | ✅ | 🚧 | 🚧 | ❌ |
| isSecretStored | ✅ | ✅ | 🚧 | 🚧 | ❌ |
| setEncryptionSecret | ✅ | ✅ | 🚧 | 🚧 | ❌ |
| changeEncryptionSecret | ✅ | ✅ | 🚧 | 🚧 | ❌ |

@@ -212,0 +233,0 @@ ## Supported SQLite Types

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc