@capacitor-community/sqlite 5.0.5-1 → 5.0.5-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/electron/dist/plugin.js
CHANGED
|
@@ -3458,27 +3458,6 @@ class UtilsEncryption {
|
|
|
3458
3458
|
constructor() {
|
|
3459
3459
|
this.fileUtil = new utilsFile_1$3.UtilsFile();
|
|
3460
3460
|
this.sqliteUtil = new utilsSQLite_1$4.UtilsSQLite();
|
|
3461
|
-
/**
|
|
3462
|
-
* SqlcipherEncrypt
|
|
3463
|
-
* @param oDB
|
|
3464
|
-
* @param pathDB
|
|
3465
|
-
* @param password
|
|
3466
|
-
*/
|
|
3467
|
-
/* private async sqlcipherEncrypt(
|
|
3468
|
-
oDB: any,
|
|
3469
|
-
pathDB: string,
|
|
3470
|
-
password: string,
|
|
3471
|
-
): Promise<void> {
|
|
3472
|
-
oDB.serialize(() => {
|
|
3473
|
-
let stmt = `ATTACH DATABASE '${pathDB}' `;
|
|
3474
|
-
stmt += `AS encrypted KEY '${password}';`;
|
|
3475
|
-
oDB.run(stmt);
|
|
3476
|
-
oDB.run("SELECT sqlcipher_export('encrypted');");
|
|
3477
|
-
oDB.run('DETACH DATABASE encrypted;');
|
|
3478
|
-
});
|
|
3479
|
-
return Promise.resolve();
|
|
3480
|
-
}
|
|
3481
|
-
*/
|
|
3482
3461
|
}
|
|
3483
3462
|
/**
|
|
3484
3463
|
* EncryptDatabase
|
|
@@ -3489,16 +3468,10 @@ class UtilsEncryption {
|
|
|
3489
3468
|
const msg = 'EncryptDatabase: ';
|
|
3490
3469
|
const retB = this.fileUtil.isPathExists(pathDB);
|
|
3491
3470
|
if (retB) {
|
|
3492
|
-
const tempPath = this.fileUtil.getFilePath('temp.db');
|
|
3493
3471
|
try {
|
|
3494
|
-
await this.
|
|
3495
|
-
|
|
3496
|
-
const mDB = await this.sqliteUtil.openOrCreateDatabase(pathDB, '', true);
|
|
3497
|
-
this.sqliteUtil.pragmaReKey(oDB, '', password);
|
|
3498
|
-
this.sqliteUtil.closeDB(oDB);
|
|
3472
|
+
const mDB = await this.sqliteUtil.openOrCreateDatabase(pathDB, '', false);
|
|
3473
|
+
this.sqliteUtil.pragmaReKey(mDB, '', password);
|
|
3499
3474
|
this.sqliteUtil.closeDB(mDB);
|
|
3500
|
-
this.fileUtil.deleteFilePath(pathDB);
|
|
3501
|
-
this.fileUtil.renameFilePath(tempPath, pathDB);
|
|
3502
3475
|
return Promise.resolve();
|
|
3503
3476
|
}
|
|
3504
3477
|
catch (err) {
|