From 967d29ef2fccdf48468e576e927443029c774296 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Sun, 28 Jan 2024 14:01:42 -0500 Subject: [PATCH] Fixes auth --- js/nostr-broadcast.js | 1 - js/nostr-utils.js | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/js/nostr-broadcast.js b/js/nostr-broadcast.js index e3c3172..cfa00f4 100644 --- a/js/nostr-broadcast.js +++ b/js/nostr-broadcast.js @@ -19,7 +19,6 @@ const fetchAndBroadcast = async () => { $('#checking-relays-header').text("Waiting for Relays: ") // parse pubkey ('npub' or hexa) const relaySet = parseRelaySet($('#relaySet').val()) - console.log(relaySet, $('#relaySet').val()) const pubkey = parsePubkey($('#pubkey').val()) if (!pubkey) return // disable button (will be re-enable at the end of the process) diff --git a/js/nostr-utils.js b/js/nostr-utils.js index 751b39d..8c9fc13 100644 --- a/js/nostr-utils.js +++ b/js/nostr-utils.js @@ -207,6 +207,7 @@ const fetchFromRelay = async (relay, filters, pubkey, events, relayStatus) => } if (msgType === 'AUTH') { + console.log(relay, subscriptionId) signNostrAuthEvent(relay, subscriptionId).then( (event) => { if (event) @@ -257,7 +258,7 @@ const getEvents = async (filters, pubkey, relaySet) => { let myRelaySet = null - if (relaySet.length > 0) + if (relaySet && relaySet.length > 0) myRelaySet = relaySet else myRelaySet = relays @@ -428,7 +429,7 @@ async function signNostrAuthEvent(relay, auth_challenge) { kind: 22243, // NIP-42++ content: "", tags: [ - ["relay", relay] + ["relay", relay], ["challenge", auth_challenge] ], };