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?
Published at
2024-11-03 14:24:06Event JSON
{
"id": "2f7a9b5cc66a30a41b2a08be28bcd2ecc0594d88da02153156341c60f3256d09",
"pubkey": "3ffac3a6c859eaaa8cdddb2c7002a6e10b33efeb92d025b14ead6f8a2d656657",
"created_at": 1730643846,
"kind": 1,
"tags": [
[
"t",
"help"
],
[
"t",
"nostrhelp"
],
[
"t",
"asknostr"
]
],
"content": "#help #nostrhelp #asknostr\n\nI'm more of a backend kind of guy, so my javascript sucks.\n\nI'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?\n\n(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)\n\nAnyone can help me with that?",
"sig": "0b017724393ba736528b7dcd2f026429fa35abb1d5660b6fd70e33a3cedb528195ab706c7330fdde68ca2908afddc8e79d5be7bac26d2b9d49698f978fc9c6df"
}