nostr-tools 0.21.2 → 0.22.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -15,7 +15,7 @@ pool.addRelay('ws://some.relay.com', {read: true, write: true})
15
15
  pool.addRelay('ws://other.relay.cool', {read: true, write: true})
16
16
 
17
17
  // example callback function for a subscription
18
- function onEvent(event, relay) => {
18
+ function onEvent(event, relay) {
19
19
  console.log(`got an event from ${relay.url} which is already validated.`, event)
20
20
  }
21
21
 
package/event.js CHANGED
@@ -52,5 +52,7 @@ export function verifySignature(event) {
52
52
  }
53
53
 
54
54
  export async function signEvent(event, key) {
55
- return secp256k1.schnorr.sign(getEventHash(event), key)
55
+ return Buffer.from(
56
+ await secp256k1.schnorr.sign(getEventHash(event), key)
57
+ ).toString('hex')
56
58
  }
package/keys.js CHANGED
@@ -5,5 +5,5 @@ export function generatePrivateKey() {
5
5
  }
6
6
 
7
7
  export function getPublicKey(privateKey) {
8
- return secp256k1.schnorr.getPublicKey(privateKey)
8
+ return Buffer.from(secp256k1.schnorr.getPublicKey(privateKey)).toString('hex')
9
9
  }
package/nip04.js CHANGED
@@ -37,6 +37,6 @@ export function decrypt(privkey, pubkey, ciphertext) {
37
37
 
38
38
  function getNormalizedX(key) {
39
39
  return typeof key === 'string'
40
- ? key.substr(2)
41
- : Buffer.from(key.slice(1)).toString('hex')
40
+ ? key.substr(2, 64)
41
+ : Buffer.from(key.slice(1, 33)).toString('hex')
42
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nostr-tools",
3
- "version": "0.21.2",
3
+ "version": "0.22.1",
4
4
  "description": "Tools for making a Nostr client.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "dependencies": {
10
10
  "@noble/hashes": "^0.5.7",
11
- "@noble/secp256k1": "^1.3.0",
11
+ "@noble/secp256k1": "^1.5.2",
12
12
  "browserify-cipher": ">=1",
13
13
  "buffer": ">=5",
14
14
  "create-hash": "^1.2.0",