Browse Source

remove code that keeps the private key (account) data in memory

no-accounts-in-memory
Trent Larson 1 year ago
parent
commit
8add6448fb
  1. 6
      src/views/AccountViewView.vue
  2. 7
      src/views/ContactAmountsView.vue
  3. 16
      src/views/HomeView.vue
  4. 7
      src/views/NewEditProjectView.vue
  5. 5
      src/views/ProjectViewView.vue
  6. 7
      src/views/ProjectsView.vue

6
src/views/AccountViewView.vue

@ -320,7 +320,6 @@ export default class AccountViewView extends Vue {
limitsMessage = "";
loadingLimits = true; // might as well now that we do it on mount, to avoid flashing the registration message
showContactGives = false;
private accounts: AccountsSchema;
showDidCopy = false;
showDerCopy = false;
@ -374,9 +373,8 @@ export default class AccountViewView extends Vue {
}
async beforeCreate() {
accountsDB.open();
this.accounts = accountsDB.accounts;
this.numAccounts = await this.accounts.count();
await accountsDB.open();
this.numAccounts = await accountsDB.accounts.count();
}
async created() {

7
src/views/ContactAmountsView.vue

@ -78,7 +78,6 @@ import * as R from "ramda";
import { Component, Vue } from "vue-facing-decorator";
import { accountsDB, db } from "@/db";
import { AccountsSchema } from "@/db/tables/accounts";
import { Contact } from "@/db/tables/contacts";
import { MASTER_SETTINGS_KEY } from "@/db/tables/settings";
import { accessToken, SimpleSigner } from "@/libs/crypto";
@ -101,13 +100,11 @@ export default class ContactsView extends Vue {
giveRecords: Array<GiveServerRecord> = [];
alertTitle = "";
alertMessage = "";
accounts: AccountsSchema;
numAccounts = 0;
async beforeCreate() {
accountsDB.open();
this.accounts = accountsDB.accounts;
this.numAccounts = await this.accounts.count();
await accountsDB.open();
this.numAccounts = await accountsDB.accounts.count();
}
public async getIdentity(activeDid) {

16
src/views/HomeView.vue

@ -73,7 +73,6 @@
import { Component, Vue } from "vue-facing-decorator";
import GiftedDialog from "@/components/GiftedDialog.vue";
import { db, accountsDB } from "@/db";
import { AccountsSchema } from "@/db/tables/accounts";
import { MASTER_SETTINGS_KEY } from "@/db/tables/settings";
import { accessToken } from "@/libs/crypto";
import { createAndSubmitGive, didInfo } from "@/libs/endorserServer";
@ -87,7 +86,6 @@ import QuickNav from "@/components/QuickNav";
})
export default class HomeView extends Vue {
activeDid = "";
allAccounts: Array<Account> = [];
allContacts: Array<Contact> = [];
apiServer = "";
feedAllLoaded = false;
@ -97,13 +95,11 @@ export default class HomeView extends Vue {
isHiddenSpinner = true;
alertTitle = "";
alertMessage = "";
accounts: AccountsSchema;
numAccounts = 0;
async beforeCreate() {
accountsDB.open();
this.accounts = accountsDB.accounts;
this.numAccounts = await this.accounts.count();
await accountsDB.open();
this.numAccounts = await accountsDB.accounts.count();
}
public async getIdentity(activeDid) {
@ -226,11 +222,13 @@ export default class HomeView extends Vue {
}
}
giveDescription(giveRecord) {
async giveDescription(giveRecord) {
let claim = giveRecord.fullClaim;
if (claim.claim) {
claim = claim.claim;
}
await accountsDB.open();
const allAccounts = await accountsDB.accounts.toArray();
// agent.did is for legacy data, before March 2023
const giverDid =
@ -238,7 +236,7 @@ export default class HomeView extends Vue {
const giverInfo = didInfo(
giverDid,
this.activeDid,
this.allAccounts,
allAccounts,
this.allContacts,
);
const gaveAmount = claim.object?.amountOfThisGood
@ -251,7 +249,7 @@ export default class HomeView extends Vue {
didInfo(
gaveRecipientId,
this.activeDid,
this.allAccounts,
allAccounts,
this.allContacts,
)
: "";

7
src/views/NewEditProjectView.vue

@ -76,7 +76,6 @@ import * as didJwt from "did-jwt";
import { Component, Vue } from "vue-facing-decorator";
import { accountsDB, db } from "@/db";
import { AccountsSchema } from "@/db/tables/accounts";
import { MASTER_SETTINGS_KEY } from "@/db/tables/settings";
import { accessToken, SimpleSigner } from "@/libs/crypto";
import { useAppStore } from "@/store/app";
@ -92,15 +91,13 @@ export default class NewEditProjectView extends Vue {
projectName = "";
description = "";
errorMessage = "";
accounts: AccountsSchema;
numAccounts = 0;
alertTitle = "";
alertMessage = "";
async beforeCreate() {
accountsDB.open();
this.accounts = accountsDB.accounts;
this.numAccounts = await this.accounts.count();
await accountsDB.open();
this.numAccounts = await accountsDB.accounts.count();
}
public async getIdentity(activeDid) {

5
src/views/ProjectViewView.vue

@ -198,9 +198,8 @@ export default class ProjectViewView extends Vue {
truncateLength = 40;
async beforeCreate() {
accountsDB.open();
this.accounts = accountsDB.accounts;
this.numAccounts = (await this.accounts?.count()) || 0;
await accountsDB.open();
this.numAccounts = (await accountsDB.accounts?.count()) || 0;
}
async created() {

7
src/views/ProjectsView.vue

@ -75,7 +75,6 @@
<script lang="ts">
import { Component, Vue } from "vue-facing-decorator";
import { accountsDB, db } from "@/db";
import { AccountsSchema } from "@/db/tables/accounts";
import { MASTER_SETTINGS_KEY } from "@/db/tables/settings";
import { accessToken } from "@/libs/crypto";
import { IIdentifier } from "@veramo/core";
@ -93,13 +92,11 @@ export default class ProjectsView extends Vue {
isLoading = false;
alertTitle = "";
alertMessage = "";
accounts: AccountsSchema;
numAccounts = 0;
async beforeCreate() {
accountsDB.open();
this.accounts = accountsDB.accounts;
this.numAccounts = await this.accounts.count();
await accountsDB.open();
this.numAccounts = await accountsDB.accounts.count();
}
/**

Loading…
Cancel
Save