remove websocket-polyfill, instruct nodejs users to install it manually.

This commit is contained in:
fiatjaf
2022-12-21 16:23:47 -03:00
parent 4bd4469357
commit 8aa31bb437
3 changed files with 13 additions and 5 deletions

View File

@@ -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'))
```

View File

@@ -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",

View File

@@ -1,7 +1,5 @@
/* global WebSocket */
import 'websocket-polyfill'
import {Event, verifySignature, validateEvent} from './event'
import {Filter, matchFilters} from './filter'