remove listeners, set auth function onto system

This commit is contained in:
Liran Cohen
2023-01-25 08:37:35 -05:00
committed by Kieran
parent 97a467260d
commit 2d75139065
5 changed files with 39 additions and 74 deletions

View File

@ -7,8 +7,6 @@ import { RootState } from "State/Store";
import { HexKey, RawEvent, u256, UserMetadata } from "Nostr";
import { bech32ToHex } from "Util"
import { DefaultRelays, HashtagRegex } from "Const";
import { useEffect } from "react";
import { NIP42AuthChallenge, NIP42AuthResponse } from "Nostr/Auth";
declare global {
interface Window {
@ -79,7 +77,7 @@ export default function useEventPublisher() {
}
return {
nip42Auth: async (challenge: string, relay:string): Promise<NEvent> => {
nip42Auth: async (challenge: string, relay:string) => {
if(pubKey) {
const ev = NEvent.ForPubKey(pubKey);
ev.Kind = EventKind.Auth;
@ -88,7 +86,6 @@ export default function useEventPublisher() {
ev.Tags.push(new Tag(["challenge", challenge], 1));
return await signEvent(ev);
}
return Promise.reject();
},
broadcast: (ev: NEvent | undefined) => {
if (ev) {