make display on creation page look halfway decent, and switch fully to it
This commit is contained in:
@@ -263,10 +263,10 @@
|
||||
/>
|
||||
<button
|
||||
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()"
|
||||
>
|
||||
<fa icon="floppy-disk" class="fa-fw"></fa>
|
||||
<fa icon="floppy-disk" class="fa-fw" color="white"></fa>
|
||||
</button>
|
||||
<button
|
||||
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 { db, accountsDB } from "@/db";
|
||||
import { MASTER_SETTINGS_KEY } from "@/db/tables/settings";
|
||||
import {
|
||||
accessToken,
|
||||
deriveAddress,
|
||||
generateSeed,
|
||||
newIdentifier,
|
||||
} from "@/libs/crypto";
|
||||
import { accessToken } from "@/libs/crypto";
|
||||
import { AxiosError } from "axios/index";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
@@ -411,32 +406,8 @@ export default class AccountViewView extends Vue {
|
||||
this.showContactGives = !!settings?.showContactGivesInline;
|
||||
|
||||
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();
|
||||
this.numAccounts = accounts.length;
|
||||
const account = R.find((acc) => acc.did === this.activeDid, accounts);
|
||||
const identity = JSON.parse(account?.identity || "undefined");
|
||||
this.publicHex = identity.keys[0].publicKeyHex;
|
||||
|
||||
Reference in New Issue
Block a user