switch the encryption secret from localStorage to IndexedDB (because localStorage gets lost so often)

This commit is contained in:
2024-12-08 19:34:31 -07:00
parent ed4a9e581b
commit 251649e6fe
35 changed files with 295 additions and 255 deletions

View File

@@ -87,13 +87,18 @@ import { Component, Vue } from "vue-facing-decorator";
import { Router } from "vue-router";
import { AppString, NotificationIface } from "@/constants/app";
import { accountsDB, db, retrieveSettingsForActiveAccount } from "@/db/index";
import {
accountsDBPromise,
db,
retrieveSettingsForActiveAccount,
} from "@/db/index";
import { MASTER_SETTINGS_KEY } from "@/db/tables/settings";
import {
DEFAULT_ROOT_DERIVATION_PATH,
deriveAddress,
newIdentifier,
} from "@/libs/crypto";
import { retrieveAccountCount } from "@/libs/util";
@Component({
components: {},
@@ -118,8 +123,7 @@ export default class ImportAccountView extends Vue {
shouldErase = false;
async created() {
await accountsDB.open();
this.numAccounts = await accountsDB.accounts.count();
this.numAccounts = await retrieveAccountCount();
// get the server, to help with import on the test server
const settings = await retrieveSettingsForActiveAccount();
this.apiServer = settings.apiServer || "";
@@ -148,7 +152,7 @@ export default class ImportAccountView extends Vue {
this.derivationPath,
);
await accountsDB.open();
const accountsDB = await accountsDBPromise;
if (this.shouldErase) {
await accountsDB.accounts.clear();
}