Why Nostr? What is Njump?
2024-11-03 14:24:06

girinovey on Nostr: #help #nostrhelp #asknostr I'm more of a backend kind of guy, so my javascript sucks. ...

#help #nostrhelp #asknostr

I'm more of a backend kind of guy, so my javascript sucks.

I'm trying to use NIP07 (https://github.com/nostr-protocol/nips/blob/master/07.md) in a page just to recover the user pubkey. I expected i only needed to call "window.nostr.getPublicKey()", and the extension would have created "window.nostr" for me. But window.nostr is currently undefined. Do i need to initialize the extension in some way so it will create this window.nostr object for me? How do i do that? any snippets of code that do that?

(i have a link on my page and when the use clicks on the link, it triggers an event that should read the pubkey from the extension and write it down in a textbox)

Anyone can help me with that?
Author Public Key
npub18lav8fkgt8424rxamvk8qq4xuy9n8mltjtgztv2w44hc5tt9vets0hcfsz