feat: add keyring support for linux and windows

This commit is contained in:
reya
2024-07-31 10:59:54 +07:00
parent bdf3ffd7bf
commit a55b31b0e6
6 changed files with 72 additions and 52 deletions

View File

@@ -4,12 +4,7 @@ import { type Result, commands } from "./commands";
export const NostrAccount = {
getAccounts: async () => {
const query = await commands.getAccounts();
if (query.status === "ok") {
return query.data;
} else {
return [];
}
return query;
},
loadAccount: async (npub: string) => {
const bunker: string = localStorage.getItem(`${npub}_bunker`);

View File

@@ -44,13 +44,8 @@ try {
else return { status: "error", error: e as any };
}
},
async getAccounts() : Promise<Result<string[], string>> {
try {
return { status: "ok", data: await TAURI_INVOKE("get_accounts") };
} catch (e) {
if(e instanceof Error) throw e;
else return { status: "error", error: e as any };
}
async getAccounts() : Promise<string[]> {
return await TAURI_INVOKE("get_accounts");
},
async createAccount() : Promise<Result<Account, string>> {
try {