Account and avatar

This commit is contained in:
2026-08-19 18:24:44 +02:00
parent 35e8d58fdb
commit 630a23b0bd
6 changed files with 83 additions and 22 deletions
+6 -2
View File
@@ -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;
}