Browse Source

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

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

7
src/views/ContactAmountsView.vue

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

16
src/views/HomeView.vue

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

5
src/views/ProjectViewView.vue

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

7
src/views/ProjectsView.vue

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

Loading…
Cancel
Save