adjust didInfo so we can use DIDs and not identities, removing last of identities in memory

This commit is contained in:
2023-07-11 15:30:51 -06:00
parent 8add6448fb
commit b86323ec83
5 changed files with 20 additions and 27 deletions

View File

@@ -76,7 +76,6 @@ import { db, accountsDB } from "@/db";
import { MASTER_SETTINGS_KEY } from "@/db/tables/settings";
import { accessToken } from "@/libs/crypto";
import { createAndSubmitGive, didInfo } from "@/libs/endorserServer";
import { Account } from "@/db/tables/accounts";
import { Contact } from "@/db/tables/contacts";
import AlertMessage from "@/components/AlertMessage";
import QuickNav from "@/components/QuickNav";
@@ -87,6 +86,7 @@ import QuickNav from "@/components/QuickNav";
export default class HomeView extends Vue {
activeDid = "";
allContacts: Array<Contact> = [];
allMyDids: Array<string> = [];
apiServer = "";
feedAllLoaded = false;
feedData = [];
@@ -130,7 +130,9 @@ export default class HomeView extends Vue {
async created() {
try {
await accountsDB.open();
this.allAccounts = await accountsDB.accounts.toArray();
const allAccounts = await accountsDB.accounts.toArray();
this.allMyDids = allAccounts.map((acc) => acc.did);
await db.open();
const settings = await db.settings.get(MASTER_SETTINGS_KEY);
this.apiServer = settings?.apiServer || "";
@@ -227,16 +229,13 @@ export default class HomeView extends Vue {
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 =
claim.agent?.identifier || claim.agent?.did || giveRecord.issuer;
const giverInfo = didInfo(
giverDid,
this.activeDid,
allAccounts,
this.allMyDids,
this.allContacts,
);
const gaveAmount = claim.object?.amountOfThisGood
@@ -249,7 +248,7 @@ export default class HomeView extends Vue {
didInfo(
gaveRecipientId,
this.activeDid,
allAccounts,
this.allMyDids,
this.allContacts,
)
: "";