loverx on Nostr: NIP-07 ====== `window.nostr` capability for web browsers ...
NIP-07
======
`window.nostr` capability for web browsers
------------------------------------------
`draft` `optional` `author:fiatjaf`
The `window.nostr` object may be made available by web browsers or extensions and websites or web-apps may make use of it after checking its availability.
That object must define the following methods:
```
async window.nostr.getPublicKey(): string // returns a public key as hex
async window.nostr.signEvent(event: Event): Event // takes an event object, adds `id`, `pubkey` and `sig` and returns it
```
Aside from these two basic above, the following functions can also be implemented optionally:
```
async window.nostr.getRelays(): { [url: string]: {read: boolean, write: boolean} } // returns a basic map of relay urls to relay policies
async window.nostr.nip04.encrypt(pubkey, plaintext): string // returns ciphertext and iv as specified in nip-04
async window.nostr.nip04.decrypt(pubkey, ciphertext): string // takes ciphertext and iv as specified in nip-04
```
### Implementation
- [nos2x](
https://github.com/fiatjaf/nos2x) (Chrome and derivatives)
- [Alby](
https://getalby.com) (Chrome and derivatives, Firefox, Safari)
- [Blockcore](
https://www.blockcore.net/wallet) (Chrome and derivatives)
- [nos2x-fox](
https://diegogurpegui.com/nos2x-fox/) (Firefox)
- [Flamingo](
https://www.getflamingo.org/) (Chrome and derivatives)
Published at
2023-03-26 12:42:13Event JSON
{
"id": "194320c9ba62d45727af65fe6a49025a154e376651dde70e6322f398d7b16126",
"pubkey": "01ea472a16686b2de7a317db60ba4cd0c8fca5b0d9c07a8afca9975829bb3244",
"created_at": 1679834533,
"kind": 1,
"tags": [
[
"e",
"dc9d132072b4c5a2a00c84393ee56a7b77c4732addf99ca007077f8c014d97df",
"wss://nos.lol",
"root"
],
[
"p",
"01ea472a16686b2de7a317db60ba4cd0c8fca5b0d9c07a8afca9975829bb3244"
],
[
"e",
"b1ed2104623a4e80b10072e00ab8eee19e2ea780d302d2cfe94541ffacd6ced9",
"wss://nos.lol",
"reply"
],
[
"p",
"01ea472a16686b2de7a317db60ba4cd0c8fca5b0d9c07a8afca9975829bb3244"
]
],
"content": "NIP-07\n======\n\n`window.nostr` capability for web browsers\n------------------------------------------\n\n`draft` `optional` `author:fiatjaf`\n\nThe `window.nostr` object may be made available by web browsers or extensions and websites or web-apps may make use of it after checking its availability.\n\nThat object must define the following methods:\n\n```\nasync window.nostr.getPublicKey(): string // returns a public key as hex\nasync window.nostr.signEvent(event: Event): Event // takes an event object, adds `id`, `pubkey` and `sig` and returns it\n```\n\nAside from these two basic above, the following functions can also be implemented optionally:\n```\nasync window.nostr.getRelays(): { [url: string]: {read: boolean, write: boolean} } // returns a basic map of relay urls to relay policies\nasync window.nostr.nip04.encrypt(pubkey, plaintext): string // returns ciphertext and iv as specified in nip-04\nasync window.nostr.nip04.decrypt(pubkey, ciphertext): string // takes ciphertext and iv as specified in nip-04\n```\n\n### Implementation\n\n- [nos2x](https://github.com/fiatjaf/nos2x) (Chrome and derivatives)\n- [Alby](https://getalby.com) (Chrome and derivatives, Firefox, Safari)\n- [Blockcore](https://www.blockcore.net/wallet) (Chrome and derivatives)\n- [nos2x-fox](https://diegogurpegui.com/nos2x-fox/) (Firefox)\n- [Flamingo](https://www.getflamingo.org/) (Chrome and derivatives)",
"sig": "b72fdf15d041dce9eafedadf7d5c258b70662703e1f2a5abd1968fed35a46fe06558181fa7024e707359ba4f04c472817b4cc6944f6efffa854c058c82ec470c"
}