Fixes auth

This commit is contained in:
Vitor Pamplona 2024-01-28 14:01:42 -05:00
parent 96dfbc33b0
commit 967d29ef2f
2 changed files with 3 additions and 3 deletions

View File

@ -19,7 +19,6 @@ const fetchAndBroadcast = async () => {
$('#checking-relays-header').text("Waiting for Relays: ") $('#checking-relays-header').text("Waiting for Relays: ")
// parse pubkey ('npub' or hexa) // parse pubkey ('npub' or hexa)
const relaySet = parseRelaySet($('#relaySet').val()) const relaySet = parseRelaySet($('#relaySet').val())
console.log(relaySet, $('#relaySet').val())
const pubkey = parsePubkey($('#pubkey').val()) const pubkey = parsePubkey($('#pubkey').val())
if (!pubkey) return if (!pubkey) return
// disable button (will be re-enable at the end of the process) // disable button (will be re-enable at the end of the process)

View File

@ -207,6 +207,7 @@ const fetchFromRelay = async (relay, filters, pubkey, events, relayStatus) =>
} }
if (msgType === 'AUTH') { if (msgType === 'AUTH') {
console.log(relay, subscriptionId)
signNostrAuthEvent(relay, subscriptionId).then( signNostrAuthEvent(relay, subscriptionId).then(
(event) => { (event) => {
if (event) if (event)
@ -257,7 +258,7 @@ const getEvents = async (filters, pubkey, relaySet) => {
let myRelaySet = null let myRelaySet = null
if (relaySet.length > 0) if (relaySet && relaySet.length > 0)
myRelaySet = relaySet myRelaySet = relaySet
else else
myRelaySet = relays myRelaySet = relays
@ -428,7 +429,7 @@ async function signNostrAuthEvent(relay, auth_challenge) {
kind: 22243, // NIP-42++ kind: 22243, // NIP-42++
content: "", content: "",
tags: [ tags: [
["relay", relay] ["relay", relay],
["challenge", auth_challenge] ["challenge", auth_challenge]
], ],
}; };