|
@ -243,6 +243,11 @@ |
|
|
|
|
|
|
|
|
<div v-if="numAccounts > 0" class="flex py-2"> |
|
|
<div v-if="numAccounts > 0" class="flex py-2"> |
|
|
Switch Identifier |
|
|
Switch Identifier |
|
|
|
|
|
<span> |
|
|
|
|
|
<button class="text-blue-500 px-2" @click="switchAccount(0)"> |
|
|
|
|
|
None |
|
|
|
|
|
</button> |
|
|
|
|
|
</span> |
|
|
<span v-for="accountNum in numAccounts" :key="accountNum"> |
|
|
<span v-for="accountNum in numAccounts" :key="accountNum"> |
|
|
<button class="text-blue-500 px-2" @click="switchAccount(accountNum)"> |
|
|
<button class="text-blue-500 px-2" @click="switchAccount(accountNum)"> |
|
|
#{{ accountNum }} |
|
|
#{{ accountNum }} |
|
@ -357,7 +362,9 @@ export default class AccountViewView extends Vue { |
|
|
const account = R.find((acc) => acc.did === this.activeDid, accounts); |
|
|
const account = R.find((acc) => acc.did === this.activeDid, accounts); |
|
|
const identity = JSON.parse(account?.identity || "null"); |
|
|
const identity = JSON.parse(account?.identity || "null"); |
|
|
if (!identity) { |
|
|
if (!identity) { |
|
|
throw new Error("No identity found."); |
|
|
this.limitsMessage = "No identity."; |
|
|
|
|
|
this.loadingLimits = false; |
|
|
|
|
|
return; |
|
|
} |
|
|
} |
|
|
this.publicHex = identity.keys[0].publicKeyHex; |
|
|
this.publicHex = identity.keys[0].publicKeyHex; |
|
|
this.publicBase64 = Buffer.from(this.publicHex, "hex").toString("base64"); |
|
|
this.publicBase64 = Buffer.from(this.publicHex, "hex").toString("base64"); |
|
@ -423,7 +430,9 @@ export default class AccountViewView extends Vue { |
|
|
const account = R.find((acc) => acc.did === this.activeDid, accounts); |
|
|
const account = R.find((acc) => acc.did === this.activeDid, accounts); |
|
|
const identity = JSON.parse(account?.identity || "null"); |
|
|
const identity = JSON.parse(account?.identity || "null"); |
|
|
if (!identity) { |
|
|
if (!identity) { |
|
|
throw new Error("No identity found."); |
|
|
this.limitsMessage = "No identity."; |
|
|
|
|
|
this.loadingLimits = false; |
|
|
|
|
|
return; |
|
|
} |
|
|
} |
|
|
const token = await accessToken(identity); |
|
|
const token = await accessToken(identity); |
|
|
const headers = { |
|
|
const headers = { |
|
@ -451,6 +460,17 @@ export default class AccountViewView extends Vue { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async switchAccount(accountNum: number) { |
|
|
async switchAccount(accountNum: number) { |
|
|
|
|
|
// 0 means none |
|
|
|
|
|
if (accountNum === 0) { |
|
|
|
|
|
await db.open(); |
|
|
|
|
|
db.settings.update(MASTER_SETTINGS_KEY, { |
|
|
|
|
|
activeDid: undefined, |
|
|
|
|
|
}); |
|
|
|
|
|
this.activeDid = ""; |
|
|
|
|
|
this.derivationPath = ""; |
|
|
|
|
|
this.publicHex = ""; |
|
|
|
|
|
this.publicBase64 = ""; |
|
|
|
|
|
} else { |
|
|
await accountsDB.open(); |
|
|
await accountsDB.open(); |
|
|
const accounts = await accountsDB.accounts.toArray(); |
|
|
const accounts = await accountsDB.accounts.toArray(); |
|
|
const account = accounts[accountNum - 1]; |
|
|
const account = accounts[accountNum - 1]; |
|
@ -465,6 +485,7 @@ export default class AccountViewView extends Vue { |
|
|
this.publicHex = account.publicKeyHex; |
|
|
this.publicHex = account.publicKeyHex; |
|
|
this.publicBase64 = Buffer.from(this.publicHex, "hex").toString("base64"); |
|
|
this.publicBase64 = Buffer.from(this.publicHex, "hex").toString("base64"); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public showContactGivesClassNames() { |
|
|
public showContactGivesClassNames() { |
|
|
return { |
|
|
return { |
|
|