aboutsummaryrefslogtreecommitdiffstats
path: root/src/components
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-01-23 20:39:51 -0800
committerAdam Soltys <[email protected]>2025-01-23 20:39:51 -0800
commitdbca79c616ec2fec6bae94fb33587b84e1a66055 (patch)
treed2a8d10898648ae0d21d0995a0bc1a3d6f8a238e /src/components
parent3f258ea37faf150f201fa76504a874596ee7905f (diff)
downloadcoinos-ui-dbca79c616ec2fec6bae94fb33587b84e1a66055.tar.gz
coinos-ui-dbca79c616ec2fec6bae94fb33587b84e1a66055.zip
fix nostr connect
Diffstat (limited to 'src/components')
-rw-r--r--src/components/Nostr.svelte27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/components/Nostr.svelte b/src/components/Nostr.svelte
index a4f20d23..5a97473c 100644
--- a/src/components/Nostr.svelte
+++ b/src/components/Nostr.svelte
@@ -12,6 +12,7 @@
generateSecretKey,
getPublicKey,
} from "nostr-tools";
+ import { getConversationKey, decrypt } from "nostr-tools/nip44";
import { AmberClipboardSigner } from "applesauce-signer";
import { copy, focus, fail, post } from "$lib/utils";
@@ -52,10 +53,17 @@
async onevent(event) {
let pk = event.pubkey;
try {
- let { result } = JSON.parse(
- await nip04.decrypt(sk, pk, event.content),
- );
- if (result === connectionSecret) {
+ let result;
+ try {
+ ({ result } = JSON.parse(
+ await nip04.decrypt(sk, pk, event.content),
+ ));
+ } catch (e) {
+ let ck = await getConversationKey(sk, pk);
+ ({ result } = JSON.parse(await decrypt(event.content, ck)));
+ }
+
+ if (result === connectionSecret || result === "ack") {
$signer = {
method: "connect",
params: {
@@ -156,17 +164,6 @@
</button>
{/if}
- {#if $signer?.method === "signer"}
- <a href={signUrl} type="button" class="btn" onclick={signerSign}>
- <iconify-icon
- icon="material-symbols:diamond-rounded"
- width="32"
- class="text-orange-400"
- ></iconify-icon>
- <div class="my-auto">NIP-55 Signer</div>
- </a>
- {/if}
-
{#if !$signer}
{#if extensionAvailable}
<button type="button" class="btn" onclick={extensionSign}>