This allows you to sign Nostr events on web-apps without having to give them your keys.
It provides a window.nostr
object which has the following methods:
async window.nostr.getPublicKey(): string // returns your public key as hex
async window.nostr.signEvent(event): Event // returns the full event object signed
async window.nostr.getRelays(): { [url: string]: RelayPolicy } // returns a map of relays
async window.nostr.nip04.encrypt(pubkey, plaintext): string // returns ciphertext+iv as specified in nip04
async window.nostr.nip04.decrypt(pubkey, ciphertext): string // takes ciphertext+iv as specified in nip04
screencast.mp4
To run the plugin from this code:
git clone https://github.com/fiatjaf/nos2x
cd nos2x
git checkout chromium # or git checkout firefox
yarn # or use npm or pnpm
yarn run build
then ...
- Chromium:
- go to chrome://extensions
- make sure, "developer mode" is enabled on the top right
- "Load unpackaged"
- select the
extension/
folder
- Firefox:
- go to about:debugging
- "This Firefox"
- "Load Temporary Add-on..."
- select any file from the
extension/
folder
LICENSE: public domain.
Icon made by Freepik from www.flaticon.com.