NodeJS library for interacting with Nostr.
Getting started
- Inititialize the Service with your private key.
const nostr = new NostrService({ nostrPrivKey: <your_priv_key> })
console.log(`Nostr PublicKey = ${nostr.publicKey()}`)
- Connect to relays with comma sperated list of URLs
nostr.connect(["wss://relay.damus.io", "wss://relay.nostr.info"])
.then(() => console.log(`Connected Relays: ${JSON.stringify(nostr.connectedRelays())})`)
Note, reference registry for info about active relays
- Publish event by defining
kind
,content
andtags
:
nostr.publishEvent({
kind: 1,
tags: [],
content: `This is a basic text note`,
})