diff --git a/src/components/World/components/objects/landmarks.js b/src/components/World/components/objects/landmarks.js index a460337..30f5e83 100644 --- a/src/components/World/components/objects/landmarks.js +++ b/src/components/World/components/objects/landmarks.js @@ -22,17 +22,16 @@ export async function loadLandmarks(vue, world, scene, loop) { await accountsDB.open(); const accounts = await accountsDB.accounts.toArray(); const account = R.find((acc) => acc.did === activeDid, accounts); - const identity = JSON.parse(account?.identity || "undefined"); - if (!identity) { - throw new Error("No identity found."); - } - const token = await accessToken(identity); - - const url = apiServer + "/api/v2/report/claims?claimType=GiveAction"; const headers = { "Content-Type": "application/json", - Authorization: "Bearer " + token, }; + const identity = JSON.parse(account?.identity || "null"); + if (identity) { + const token = await accessToken(identity); + headers["Authorization"] = "Bearer " + token; + } + + const url = apiServer + "/api/v2/report/claims?claimType=GiveAction"; const resp = await axios.get(url, { headers: headers }); if (resp.status === 200) { const landmarks = resp.data.data; diff --git a/src/libs/endorserServer.ts b/src/libs/endorserServer.ts index 026e705..aaac8d2 100644 --- a/src/libs/endorserServer.ts +++ b/src/libs/endorserServer.ts @@ -3,6 +3,7 @@ import { IIdentifier } from "@veramo/core"; import { accessToken, SimpleSigner } from "@/libs/crypto"; import * as didJwt from "did-jwt"; import { Axios, AxiosResponse } from "axios"; +import { Contact } from "@/db/tables/contacts"; export const SCHEMA_ORG_CONTEXT = "https://schema.org"; export const SERVICE_ID = "endorser.ch"; @@ -81,12 +82,15 @@ export function isHiddenDid(did) { /** always returns text, maybe UNNAMED_VISIBLE or UNKNOWN_ENTITY **/ -export function didInfo(did, identifiers, contacts) { - const myId = R.find((i) => i.did === did, identifiers); +export function didInfo(did, activeDid, identifiers, contacts) { + const myId: IIdentifier | undefined = R.find( + (i) => i.did === did, + identifiers + ); if (myId) { - return "You"; + return "You" + (myId.did !== activeDid ? " (Alt ID)" : ""); } else { - const contact = R.find((c) => c.did === did, contacts); + const contact: Contact | undefined = R.find((c) => c.did === did, contacts); if (contact) { return contact.name || "Someone Unnamed in Contacts"; } else if (!did) { diff --git a/src/views/AccountViewView.vue b/src/views/AccountViewView.vue index ed2c7df..02bd796 100644 --- a/src/views/AccountViewView.vue +++ b/src/views/AccountViewView.vue @@ -290,6 +290,11 @@
Switch Identifier + + +