Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nostr-tools

Package Overview
Dependencies
Maintainers
1
Versions
151
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nostr-tools - npm Package Compare versions

Comparing version 0.18.0 to 0.19.0

2

package.json
{
"name": "nostr-tools",
"version": "0.18.0",
"version": "0.19.0",
"description": "Tools for making a Nostr client.",

@@ -5,0 +5,0 @@ "repository": {

@@ -1,2 +0,2 @@

import {getEventHash, signEvent} from './event'
import {getEventHash, verifySignature, signEvent} from './event'
import {relayConnect, normalizeRelayURL} from './relay'

@@ -6,2 +6,4 @@

var globalPrivateKey
var globalSigningFunction
const poolPolicy = {

@@ -80,2 +82,5 @@ // setting this to a number will cause events to be published to a random

},
registerSigningFunction(fn) {
globalSigningFunction = fn
},
setPolicy(key, value) {

@@ -128,5 +133,17 @@ poolPolicy[key] = value

event.sig = await signEvent(event, globalPrivateKey)
} else if (globalSigningFunction) {
event.sig = await globalSigningFunction(event)
if (!event.sig) {
// abort here
return
} else {
// check
if (!(await verifySignature(event)))
throw new Error(
'signature provided by custom signing function is invalid.'
)
}
} else {
throw new Error(
"can't publish unsigned event. either sign this event beforehand or pass a private key while initializing this relay pool so it can be signed automatically."
"can't publish unsigned event. either sign this event beforehand, provide a signing function or pass a private key while initializing this relay pool so it can be signed automatically."
)

@@ -133,0 +150,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc