feat: revamp nostr connect flow

This commit is contained in:
reya
2024-05-30 15:21:33 +07:00
parent 6d42360549
commit 41d0de539d
8 changed files with 113 additions and 216 deletions

View File

@@ -62,19 +62,12 @@ export class NostrAccount {
}
static async connectRemoteAccount(uri: string) {
const remoteKey = uri.replace("bunker://", "").split("?")[0];
const npub = await commands.toNpub(remoteKey);
const connect = await commands.connectRemoteAccount(uri);
if (npub.status === "ok") {
const connect = await commands.nostrConnect(npub.data, uri);
if (connect.status === "ok") {
return connect.data;
} else {
throw new Error(connect.error);
}
if (connect.status === "ok") {
return connect.data;
} else {
throw new Error(npub.error);
throw new Error(connect.error);
}
}