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

@@ -247,7 +247,7 @@ import { Router } from "vue-router";
import QuickNav from "@/components/QuickNav.vue";
import { AppString, NotificationIface } from "@/constants/app";
import { accountsDB, db, retrieveSettingsForActiveAccount } from "@/db/index";
import { db, retrieveSettingsForActiveAccount } from "@/db/index";
import * as vcLib from "@/libs/crypto/vc";
import {
PeerSetup,
@@ -258,7 +258,7 @@ import {
import {
AccountKeyInfo,
blobToBase64,
getAccount,
retrieveAccountMetadata,
registerAndSavePasskey,
SHARED_PHOTO_BASE64_KEY,
} from "@/libs/util";
@@ -294,11 +294,7 @@ export default class Help extends Vue {
this.activeDid = settings.activeDid || "";
this.userName = settings.firstName;
await accountsDB.open();
const account: { identity?: string } | undefined = await accountsDB.accounts
.where("did")
.equals(this.activeDid)
.first();
const account = await retrieveAccountMetadata(this.activeDid);
if (this.activeDid) {
if (account) {
this.credIdHex = account.passkeyCredIdHex as string;
@@ -368,7 +364,7 @@ export default class Help extends Vue {
}
public async createJwtSimplewebauthn() {
const account: AccountKeyInfo | undefined = await getAccount(
const account: AccountKeyInfo | undefined = await retrieveAccountMetadata(
this.activeDid || "",
);
if (!vcLib.isFromPasskey(account)) {
@@ -385,7 +381,7 @@ export default class Help extends Vue {
}
public async createJwtNavigator() {
const account: AccountKeyInfo | undefined = await getAccount(
const account: AccountKeyInfo | undefined = await retrieveAccountMetadata(
this.activeDid || "",
);
if (!vcLib.isFromPasskey(account)) {