{"id":"6f0ef6eb7741fb2e7cbdeadb9154bfc89e95ad1f6077631a8a95511f36b7ea59","pubkey":"b22b06b051fd5232966a9344a634d956c3dc33a7f5ecdcad9ed11ddc4120a7f2","created_at":1787578702,"kind":30817,"tags":[["d","nip-07"],["title","NIP-07: `window.nostr` capability for web browsers"],["summary","The window.nostr object a browser extension exposes, letting a web page read a public key and have events signed without ever seeing the private key."],["published_at","1785498349"],["s","draft"],["t","nip"],["i","https://github.com/nostr-protocol/nips/blob/master/07.md","fork"],["alt","A specification: NIP-07: `window.nostr` capability for web browsers"]],"content":"NIP-07\n======\n\n`window.nostr` capability for web browsers\n------------------------------------------\n\n`draft` `optional`\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: { pubkey?: string, created_at: number, kind: number, tags: string[][], content: string }): 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.nip04.encrypt(pubkey, plaintext, current_user?): string // returns ciphertext and iv as specified in nip-04 (deprecated)\nasync window.nostr.nip04.decrypt(pubkey, ciphertext, current_user?): string // takes ciphertext and iv as specified in nip-04 (deprecated)\nasync window.nostr.nip44.encrypt(pubkey, plaintext, current_user?): string // returns ciphertext as specified in nip-44\nasync window.nostr.nip44.decrypt(pubkey, ciphertext, current_user?): string // takes ciphertext as specified in nip-44\n```\n\n`pubkey` on the event object and `current_user` on the encryption functions both name the user key to act with. When set, the signer must use that key or reject the request. Signers that predate this may ignore it silently, so clients should check the `pubkey` of the event returned by `signEvent`.\n\n### Recommendation to Extension Authors\nTo make sure that the `window.nostr` is available to nostr clients on page load, the authors who create Chromium and Firefox extensions should load their scripts by specifying `\"run_at\": \"document_end\"` in the extension's manifest.\n\n\n### Implementation\n\nSee https://github.com/aljazceru/awesome-nostr#nip-07-browser-extensions.\n","sig":"3e546353c3c296fc373e1873d77b043b2e62d369bdd93adf27765c47eb15b14daf46023a115832a28c8f53e76ee9f9a4940c021d582c7dd25bdf06891b817267"}