|
@ -290,6 +290,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 }} |
|
@ -403,7 +408,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"); |
|
@ -469,7 +476,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 = { |
|
@ -497,19 +506,31 @@ export default class AccountViewView extends Vue { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async switchAccount(accountNum: number) { |
|
|
async switchAccount(accountNum: number) { |
|
|
await accountsDB.open(); |
|
|
// 0 means none |
|
|
const accounts = await accountsDB.accounts.toArray(); |
|
|
if (accountNum === 0) { |
|
|
const account = accounts[accountNum - 1]; |
|
|
await db.open(); |
|
|
|
|
|
db.settings.update(MASTER_SETTINGS_KEY, { |
|
|
|
|
|
activeDid: undefined, |
|
|
|
|
|
}); |
|
|
|
|
|
this.activeDid = ""; |
|
|
|
|
|
this.derivationPath = ""; |
|
|
|
|
|
this.publicHex = ""; |
|
|
|
|
|
this.publicBase64 = ""; |
|
|
|
|
|
} else { |
|
|
|
|
|
await accountsDB.open(); |
|
|
|
|
|
const accounts = await accountsDB.accounts.toArray(); |
|
|
|
|
|
const account = accounts[accountNum - 1]; |
|
|
|
|
|
|
|
|
await db.open(); |
|
|
await db.open(); |
|
|
db.settings.update(MASTER_SETTINGS_KEY, { |
|
|
db.settings.update(MASTER_SETTINGS_KEY, { |
|
|
activeDid: account.did, |
|
|
activeDid: account.did, |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
this.activeDid = account.did; |
|
|
this.activeDid = account.did; |
|
|
this.derivationPath = account.derivationPath; |
|
|
this.derivationPath = account.derivationPath; |
|
|
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() { |
|
|