|
@ -263,10 +263,10 @@ |
|
|
/> |
|
|
/> |
|
|
<button |
|
|
<button |
|
|
v-if="apiServerInput != apiServer" |
|
|
v-if="apiServerInput != apiServer" |
|
|
class="px-4 rounded bg-slate-200 border border-slate-400" |
|
|
class="px-4 rounded bg-red-500 border border-slate-400" |
|
|
@click="onClickSaveApiServer()" |
|
|
@click="onClickSaveApiServer()" |
|
|
> |
|
|
> |
|
|
<fa icon="floppy-disk" class="fa-fw"></fa> |
|
|
<fa icon="floppy-disk" class="fa-fw" color="white"></fa> |
|
|
</button> |
|
|
</button> |
|
|
<button |
|
|
<button |
|
|
class="px-4 rounded bg-slate-200 border border-slate-400" |
|
|
class="px-4 rounded bg-slate-200 border border-slate-400" |
|
@ -332,12 +332,7 @@ import { useClipboard } from "@vueuse/core"; |
|
|
import { AppString } from "@/constants/app"; |
|
|
import { AppString } from "@/constants/app"; |
|
|
import { db, accountsDB } from "@/db"; |
|
|
import { db, accountsDB } from "@/db"; |
|
|
import { MASTER_SETTINGS_KEY } from "@/db/tables/settings"; |
|
|
import { MASTER_SETTINGS_KEY } from "@/db/tables/settings"; |
|
|
import { |
|
|
import { accessToken } from "@/libs/crypto"; |
|
|
accessToken, |
|
|
|
|
|
deriveAddress, |
|
|
|
|
|
generateSeed, |
|
|
|
|
|
newIdentifier, |
|
|
|
|
|
} from "@/libs/crypto"; |
|
|
|
|
|
import { AxiosError } from "axios/index"; |
|
|
import { AxiosError } from "axios/index"; |
|
|
|
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-var-requires |
|
|
// eslint-disable-next-line @typescript-eslint/no-var-requires |
|
@ -411,32 +406,8 @@ export default class AccountViewView extends Vue { |
|
|
this.showContactGives = !!settings?.showContactGivesInline; |
|
|
this.showContactGives = !!settings?.showContactGivesInline; |
|
|
|
|
|
|
|
|
await accountsDB.open(); |
|
|
await accountsDB.open(); |
|
|
this.numAccounts = await accountsDB.accounts.count(); |
|
|
|
|
|
if (this.numAccounts === 0) { |
|
|
|
|
|
let address = ""; // 0x... ETH address, without "did:eth:" |
|
|
|
|
|
let privateHex = ""; |
|
|
|
|
|
const mnemonic = generateSeed(); |
|
|
|
|
|
[address, privateHex, this.publicHex, this.derivationPath] = |
|
|
|
|
|
deriveAddress(mnemonic); |
|
|
|
|
|
|
|
|
|
|
|
const newId = newIdentifier( |
|
|
|
|
|
address, |
|
|
|
|
|
this.publicHex, |
|
|
|
|
|
privateHex, |
|
|
|
|
|
this.derivationPath |
|
|
|
|
|
); |
|
|
|
|
|
await accountsDB.accounts.add({ |
|
|
|
|
|
dateCreated: new Date().toISOString(), |
|
|
|
|
|
derivationPath: this.derivationPath, |
|
|
|
|
|
did: newId.did, |
|
|
|
|
|
identity: JSON.stringify(newId), |
|
|
|
|
|
mnemonic: mnemonic, |
|
|
|
|
|
publicKeyHex: newId.keys[0].publicKeyHex, |
|
|
|
|
|
}); |
|
|
|
|
|
this.activeDid = newId.did; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const accounts = await accountsDB.accounts.toArray(); |
|
|
const accounts = await accountsDB.accounts.toArray(); |
|
|
|
|
|
this.numAccounts = accounts.length; |
|
|
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 || "undefined"); |
|
|
const identity = JSON.parse(account?.identity || "undefined"); |
|
|
this.publicHex = identity.keys[0].publicKeyHex; |
|
|
this.publicHex = identity.keys[0].publicKeyHex; |
|
|