mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-08 16:28:49 +00:00
remove websocket-polyfill, instruct nodejs users to install it manually.
This commit is contained in:
13
README.md
13
README.md
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
Tools for developing [Nostr](https://github.com/fiatjaf/nostr) clients.
|
Tools for developing [Nostr](https://github.com/fiatjaf/nostr) clients.
|
||||||
|
|
||||||
|
Very lean on dependencies.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
### Generating a private key and a public key
|
### Generating a private key and a public key
|
||||||
@@ -112,6 +114,12 @@ pub.on('failed', reason => {
|
|||||||
await relay.close()
|
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
|
### Querying profile data from a NIP-05 address
|
||||||
|
|
||||||
```js
|
```js
|
||||||
@@ -122,8 +130,11 @@ console.log(profile.pubkey)
|
|||||||
// prints: 32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245
|
// prints: 32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245
|
||||||
console.log(profile.relays)
|
console.log(profile.relays)
|
||||||
// prints: [wss://relay.damus.io]
|
// 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'))
|
nip05.useFetchImplementation(require('node-fetch'))
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -14,8 +14,7 @@
|
|||||||
"@scure/bip32": "^1.1.1",
|
"@scure/bip32": "^1.1.1",
|
||||||
"@scure/bip39": "^1.1.0",
|
"@scure/bip39": "^1.1.0",
|
||||||
"base64-arraybuffer": "^1.0.2",
|
"base64-arraybuffer": "^1.0.2",
|
||||||
"bech32": "^2.0.0",
|
"bech32": "^2.0.0"
|
||||||
"websocket-polyfill": "^0.0.3"
|
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"decentralization",
|
"decentralization",
|
||||||
|
|||||||
2
relay.ts
2
relay.ts
@@ -1,7 +1,5 @@
|
|||||||
/* global WebSocket */
|
/* global WebSocket */
|
||||||
|
|
||||||
import 'websocket-polyfill'
|
|
||||||
|
|
||||||
import {Event, verifySignature, validateEvent} from './event'
|
import {Event, verifySignature, validateEvent} from './event'
|
||||||
import {Filter, matchFilters} from './filter'
|
import {Filter, matchFilters} from './filter'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user