Account and avatar
This commit is contained in:
+6
-2
@@ -5,7 +5,7 @@ import { sha512 } from "@noble/hashes/sha2.js";
|
||||
import { base58 } from "@scure/base";
|
||||
|
||||
import axios from "axios";
|
||||
import { AccountsFile, getAccounts } from "@/lib/accounts";
|
||||
import { Account, AccountsFile, getAccounts } from "@/lib/accounts";
|
||||
|
||||
ed.hashes.sha512 = sha512;
|
||||
|
||||
@@ -38,6 +38,10 @@ export default class Enclave {
|
||||
this.accounts = await getAccounts();
|
||||
}
|
||||
|
||||
public getAccount(): Account | null {
|
||||
return this.accounts?.accounts[this.accounts.activeAccount] || null;
|
||||
}
|
||||
|
||||
public async connectToServer(hostname: string, isSecure: boolean) {
|
||||
if (this.server) {
|
||||
this.server.disconnect();
|
||||
@@ -87,7 +91,7 @@ export default class Enclave {
|
||||
public getClientSecretKey() {
|
||||
if (!this.accounts) return null;
|
||||
|
||||
const account = this.accounts?.accounts[this.accounts.activeAccount];
|
||||
const account = this.getAccount();
|
||||
|
||||
return account ? base58.decode(account.privateKey) : null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user