diff --git a/README.md b/README.md index 373e833..747e35e 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ Tools for developing [Nostr](https://github.com/fiatjaf/nostr) clients. +Very lean on dependencies. + ## Usage ### Generating a private key and a public key @@ -112,6 +114,12 @@ pub.on('failed', reason => { await relay.close() ``` +To use this on Node.js you first must install `websocket-polyfill` and import it: + +```js +import 'websocket-polyfill' +``` + ### Querying profile data from a NIP-05 address ```js @@ -122,8 +130,11 @@ console.log(profile.pubkey) // prints: 32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245 console.log(profile.relays) // prints: [wss://relay.damus.io] +``` -// on nodejs, install node-fetch@2 and call this first: +To use this on Node.js you first must install `node-fetch@2` and call something like this: + +```js nip05.useFetchImplementation(require('node-fetch')) ``` diff --git a/package.json b/package.json index 25fae6f..f87ef02 100644 --- a/package.json +++ b/package.json @@ -14,8 +14,7 @@ "@scure/bip32": "^1.1.1", "@scure/bip39": "^1.1.0", "base64-arraybuffer": "^1.0.2", - "bech32": "^2.0.0", - "websocket-polyfill": "^0.0.3" + "bech32": "^2.0.0" }, "keywords": [ "decentralization", diff --git a/relay.ts b/relay.ts index e0bcb48..48bf68e 100644 --- a/relay.ts +++ b/relay.ts @@ -1,7 +1,5 @@ /* global WebSocket */ -import 'websocket-polyfill' - import {Event, verifySignature, validateEvent} from './event' import {Filter, matchFilters} from './filter'