first pass at nip42 authentication #93

Merged
LiranCohen merged 6 commits from feature/Nip42-Support into nip42 2023-01-25 14:45:00 +00:00
Showing only changes of commit ef7d66d303 - Show all commits

View File

@ -78,7 +78,8 @@ export default function useEventPublisher() {
ev.Content = content;
v0l commented 2023-01-25 10:32:34 +00:00 (Migrated from github.com)
Review

You can simply just not return anything here instead, undefined is fine

You can simply just not return anything here instead, undefined is fine
}
const nip42Auth = async (challenge: string, relay:string): Promise<NEvent> => {
return {
nip42Auth: async (challenge: string, relay:string): Promise<NEvent> => {
if(pubKey) {
const ev = NEvent.ForPubKey(pubKey);
ev.Kind = EventKind.Auth;
@ -88,10 +89,7 @@ export default function useEventPublisher() {
return await signEvent(ev);
}
return Promise.reject();
}
return {
nip42Auth: nip42Auth,
},
broadcast: (ev: NEvent | undefined) => {
if (ev) {
console.debug("Sending event: ", ev);