Skip to content
Melvin Carvalho edited this page May 13, 2023 · 4 revisions

NIP-07: window.nostr Capability for Web Browsers

NIP-07 is an optional draft that specifies the window.nostr object for use in web browsers or extensions. This object enables websites and web applications to interact with the Nostr network, provided it is available. The window.nostr object must define specific methods to enable this functionality.

Methods

The window.nostr 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

In addition to the basic methods above, the following optional functions can also be implemented:

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

Implementations

The following browser extensions and applications have implemented NIP-07:

Getting Started

If you're a developer looking to install or test an extension that uses the window.nostr object, follow the appropriate links above for the browser you're using. Each implementation provides instructions on how to install and use the extension or application.

Once you have installed the extension or application, you can start building web applications that interact with the Nostr network using the window.nostr object and its available methods.

Testing

Clone this wiki locally