nostr-tools
Advanced tools
Comparing version 2.0.3 to 2.1.0
@@ -23,2 +23,4 @@ "use strict"; | ||
__export(nostr_tools_exports, { | ||
AbstractRelay: () => AbstractRelay, | ||
AbstractSimplePool: () => AbstractSimplePool, | ||
Relay: () => Relay, | ||
@@ -370,2 +372,200 @@ SimplePool: () => SimplePool, | ||
// nip42.ts | ||
var nip42_exports = {}; | ||
__export(nip42_exports, { | ||
makeAuthEvent: () => makeAuthEvent | ||
}); | ||
// kinds.ts | ||
var kinds_exports = {}; | ||
__export(kinds_exports, { | ||
Application: () => Application, | ||
BadgeAward: () => BadgeAward, | ||
BadgeDefinition: () => BadgeDefinition, | ||
BlockedRelaysList: () => BlockedRelaysList, | ||
BookmarkList: () => BookmarkList, | ||
Bookmarksets: () => Bookmarksets, | ||
Calendar: () => Calendar, | ||
CalendarEventRSVP: () => CalendarEventRSVP, | ||
ChannelCreation: () => ChannelCreation, | ||
ChannelHideMessage: () => ChannelHideMessage, | ||
ChannelMessage: () => ChannelMessage, | ||
ChannelMetadata: () => ChannelMetadata, | ||
ChannelMuteUser: () => ChannelMuteUser, | ||
ClassifiedListing: () => ClassifiedListing, | ||
ClientAuth: () => ClientAuth, | ||
CommunitiesList: () => CommunitiesList, | ||
CommunityDefinition: () => CommunityDefinition, | ||
CommunityPostApproval: () => CommunityPostApproval, | ||
Contacts: () => Contacts, | ||
CreateOrUpdateProduct: () => CreateOrUpdateProduct, | ||
CreateOrUpdateStall: () => CreateOrUpdateStall, | ||
Curationsets: () => Curationsets, | ||
Date: () => Date2, | ||
DraftClassifiedListing: () => DraftClassifiedListing, | ||
DraftLong: () => DraftLong, | ||
Emojisets: () => Emojisets, | ||
EncryptedDirectMessage: () => EncryptedDirectMessage, | ||
EncryptedDirectMessages: () => EncryptedDirectMessages, | ||
EventDeletion: () => EventDeletion, | ||
FileMetadata: () => FileMetadata, | ||
Followsets: () => Followsets, | ||
GenericRepost: () => GenericRepost, | ||
Genericlists: () => Genericlists, | ||
HTTPAuth: () => HTTPAuth, | ||
Handlerinformation: () => Handlerinformation, | ||
Handlerrecommendation: () => Handlerrecommendation, | ||
Highlights: () => Highlights, | ||
InterestsList: () => InterestsList, | ||
Interestsets: () => Interestsets, | ||
JobFeedback: () => JobFeedback, | ||
JobRequest: () => JobRequest, | ||
JobResult: () => JobResult, | ||
Label: () => Label, | ||
LightningPubRPC: () => LightningPubRPC, | ||
LiveChatMessage: () => LiveChatMessage, | ||
LiveEvent: () => LiveEvent, | ||
LongFormArticle: () => LongFormArticle, | ||
Metadata: () => Metadata, | ||
Mutelist: () => Mutelist, | ||
NWCWalletInfo: () => NWCWalletInfo, | ||
NWCWalletRequest: () => NWCWalletRequest, | ||
NWCWalletResponse: () => NWCWalletResponse, | ||
NostrConnect: () => NostrConnect, | ||
OpenTimestamps: () => OpenTimestamps, | ||
Pinlist: () => Pinlist, | ||
ProblemTracker: () => ProblemTracker, | ||
ProfileBadges: () => ProfileBadges, | ||
PublicChatsList: () => PublicChatsList, | ||
Reaction: () => Reaction, | ||
RecommendRelay: () => RecommendRelay, | ||
RelayList: () => RelayList, | ||
Relaysets: () => Relaysets, | ||
Report: () => Report, | ||
Reporting: () => Reporting, | ||
Repost: () => Repost, | ||
SearchRelaysList: () => SearchRelaysList, | ||
ShortTextNote: () => ShortTextNote, | ||
Time: () => Time, | ||
UserEmojiList: () => UserEmojiList, | ||
UserStatuses: () => UserStatuses, | ||
Zap: () => Zap, | ||
ZapGoal: () => ZapGoal, | ||
ZapRequest: () => ZapRequest, | ||
classifyKind: () => classifyKind, | ||
isEphemeralKind: () => isEphemeralKind, | ||
isParameterizedReplaceableKind: () => isParameterizedReplaceableKind, | ||
isRegularKind: () => isRegularKind, | ||
isReplaceableKind: () => isReplaceableKind | ||
}); | ||
function isRegularKind(kind) { | ||
return 1e3 <= kind && kind < 1e4 || [1, 2, 4, 5, 6, 7, 8, 16, 40, 41, 42, 43, 44].includes(kind); | ||
} | ||
function isReplaceableKind(kind) { | ||
return [0, 3].includes(kind) || 1e4 <= kind && kind < 2e4; | ||
} | ||
function isEphemeralKind(kind) { | ||
return 2e4 <= kind && kind < 3e4; | ||
} | ||
function isParameterizedReplaceableKind(kind) { | ||
return 3e4 <= kind && kind < 4e4; | ||
} | ||
function classifyKind(kind) { | ||
if (isRegularKind(kind)) | ||
return "regular"; | ||
if (isReplaceableKind(kind)) | ||
return "replaceable"; | ||
if (isEphemeralKind(kind)) | ||
return "ephemeral"; | ||
if (isParameterizedReplaceableKind(kind)) | ||
return "parameterized"; | ||
return "unknown"; | ||
} | ||
var Metadata = 0; | ||
var ShortTextNote = 1; | ||
var RecommendRelay = 2; | ||
var Contacts = 3; | ||
var EncryptedDirectMessage = 4; | ||
var EventDeletion = 5; | ||
var Repost = 6; | ||
var Reaction = 7; | ||
var BadgeAward = 8; | ||
var ChannelCreation = 40; | ||
var ChannelMetadata = 41; | ||
var ChannelMessage = 42; | ||
var ChannelHideMessage = 43; | ||
var ChannelMuteUser = 44; | ||
var Report = 1984; | ||
var ZapRequest = 9734; | ||
var Zap = 9735; | ||
var RelayList = 10002; | ||
var ClientAuth = 22242; | ||
var BadgeDefinition = 30009; | ||
var FileMetadata = 1063; | ||
var EncryptedDirectMessages = 4; | ||
var GenericRepost = 16; | ||
var OpenTimestamps = 1040; | ||
var LiveChatMessage = 1311; | ||
var ProblemTracker = 1971; | ||
var Reporting = 1984; | ||
var Label = 1985; | ||
var CommunityPostApproval = 4550; | ||
var JobRequest = 5999; | ||
var JobResult = 6999; | ||
var JobFeedback = 7e3; | ||
var ZapGoal = 9041; | ||
var Highlights = 9802; | ||
var Mutelist = 1e4; | ||
var Pinlist = 10001; | ||
var BookmarkList = 10003; | ||
var CommunitiesList = 10004; | ||
var PublicChatsList = 10005; | ||
var BlockedRelaysList = 10006; | ||
var SearchRelaysList = 10007; | ||
var InterestsList = 10015; | ||
var UserEmojiList = 10030; | ||
var NWCWalletInfo = 13194; | ||
var LightningPubRPC = 21e3; | ||
var NWCWalletRequest = 23194; | ||
var NWCWalletResponse = 23195; | ||
var NostrConnect = 24133; | ||
var HTTPAuth = 27235; | ||
var Followsets = 3e4; | ||
var Genericlists = 30001; | ||
var Relaysets = 30002; | ||
var Bookmarksets = 30003; | ||
var Curationsets = 30004; | ||
var ProfileBadges = 30008; | ||
var Interestsets = 30015; | ||
var CreateOrUpdateStall = 30017; | ||
var CreateOrUpdateProduct = 30018; | ||
var LongFormArticle = 30023; | ||
var DraftLong = 30024; | ||
var Emojisets = 30030; | ||
var Application = 30078; | ||
var LiveEvent = 30311; | ||
var UserStatuses = 30315; | ||
var ClassifiedListing = 30402; | ||
var DraftClassifiedListing = 30403; | ||
var Date2 = 31922; | ||
var Time = 31923; | ||
var Calendar = 31924; | ||
var CalendarEventRSVP = 31925; | ||
var Handlerrecommendation = 31989; | ||
var Handlerinformation = 31990; | ||
var CommunityDefinition = 34550; | ||
// nip42.ts | ||
function makeAuthEvent(relayURL, challenge) { | ||
return { | ||
kind: ClientAuth, | ||
created_at: Math.floor(Date.now() / 1e3), | ||
tags: [ | ||
["relay", relayURL], | ||
["challenge", challenge] | ||
], | ||
content: "" | ||
}; | ||
} | ||
// helpers.ts | ||
@@ -380,13 +580,11 @@ async function yieldThread() { | ||
} | ||
var alwaysTrue = (t) => { | ||
t[verifiedSymbol] = true; | ||
return true; | ||
}; | ||
// relay.ts | ||
async function relayConnect(url) { | ||
const relay = new Relay(url); | ||
await relay.connect(); | ||
return relay; | ||
} | ||
var Relay = class { | ||
// abstract-relay.ts | ||
var AbstractRelay = class { | ||
url; | ||
_connected = false; | ||
trusted = false; | ||
onclose = null; | ||
@@ -396,5 +594,5 @@ onnotice = (msg) => console.debug(`NOTICE from ${this.url}: ${msg}`); | ||
connectionTimeout = 4400; | ||
openSubs = /* @__PURE__ */ new Map(); | ||
connectionTimeoutHandle; | ||
connectionPromise; | ||
openSubs = /* @__PURE__ */ new Map(); | ||
openCountRequests = /* @__PURE__ */ new Map(); | ||
@@ -407,5 +605,12 @@ openEventPublishes = /* @__PURE__ */ new Map(); | ||
serial = 0; | ||
constructor(url) { | ||
verifyEvent; | ||
constructor(url, opts) { | ||
this.url = normalizeURL(url); | ||
this.verifyEvent = opts.verifyEvent; | ||
} | ||
static async connect(url, opts) { | ||
const relay = new AbstractRelay(url, opts); | ||
await relay.connect(); | ||
return relay; | ||
} | ||
closeAllSubscriptions(reason) { | ||
@@ -464,8 +669,3 @@ for (let [_, sub] of this.openSubs) { | ||
}; | ||
this.ws.onmessage = (ev) => { | ||
this.incomingMessageQueue.enqueue(ev.data); | ||
if (!this.queueRunning) { | ||
this.runQueue(); | ||
} | ||
}; | ||
this.ws.onmessage = this._onmessage.bind(this); | ||
}); | ||
@@ -508,3 +708,3 @@ return this.connectionPromise; | ||
const event = data[2]; | ||
if ((this.trusted || validateEvent(event) && verifyEvent(event)) && matchFilters(so.filters, event)) { | ||
if (this.verifyEvent(event) && matchFilters(so.filters, event)) { | ||
so.onevent(event); | ||
@@ -550,3 +750,2 @@ } | ||
so.close(data[2]); | ||
this.openSubs.delete(id); | ||
return; | ||
@@ -576,3 +775,3 @@ } | ||
throw new Error("can't perform auth, no challenge was received"); | ||
const evt = nip42_exports.makeAuthEvent(this.url, this.challenge); | ||
const evt = makeAuthEvent(this.url, this.challenge); | ||
await signAuthEvent(evt); | ||
@@ -614,2 +813,8 @@ this.send('["AUTH",' + JSON.stringify(evt) + "]"); | ||
} | ||
_onmessage(ev) { | ||
this.incomingMessageQueue.enqueue(ev.data); | ||
if (!this.queueRunning) { | ||
this.runQueue(); | ||
} | ||
} | ||
}; | ||
@@ -661,2 +866,3 @@ var Subscription = class { | ||
} | ||
this.relay.openSubs.delete(this.id); | ||
this.onclose?.(reason); | ||
@@ -666,8 +872,27 @@ } | ||
// pool.ts | ||
var SimplePool = class { | ||
// relay.ts | ||
function relayConnect(url) { | ||
return Relay.connect(url); | ||
} | ||
var Relay = class extends AbstractRelay { | ||
constructor(url) { | ||
super(url, { verifyEvent }); | ||
} | ||
static async connect(url) { | ||
const relay = new Relay(url); | ||
await relay.connect(); | ||
return relay; | ||
} | ||
}; | ||
// abstract-pool.ts | ||
var AbstractSimplePool = class { | ||
relays = /* @__PURE__ */ new Map(); | ||
seenOn = /* @__PURE__ */ new Map(); | ||
trackRelays = false; | ||
verifyEvent; | ||
trustedRelayURLs = /* @__PURE__ */ new Set(); | ||
constructor(opts) { | ||
this.verifyEvent = opts.verifyEvent; | ||
} | ||
async ensureRelay(url, params) { | ||
@@ -677,7 +902,7 @@ url = normalizeURL(url); | ||
if (!relay) { | ||
relay = new Relay(url); | ||
relay = new AbstractRelay(url, { | ||
verifyEvent: this.trustedRelayURLs.has(url) ? alwaysTrue : this.verifyEvent | ||
}); | ||
if (params?.connectionTimeout) | ||
relay.connectionTimeout = params.connectionTimeout; | ||
if (this.trustedRelayURLs.has(relay.url)) | ||
relay.trusted = true; | ||
this.relays.set(url, relay); | ||
@@ -807,2 +1032,9 @@ } | ||
// pool.ts | ||
var SimplePool = class extends AbstractSimplePool { | ||
constructor() { | ||
super({ verifyEvent }); | ||
} | ||
}; | ||
// nip19.ts | ||
@@ -1307,183 +1539,2 @@ var nip19_exports = {}; | ||
}); | ||
// kinds.ts | ||
var kinds_exports = {}; | ||
__export(kinds_exports, { | ||
Application: () => Application, | ||
BadgeAward: () => BadgeAward, | ||
BadgeDefinition: () => BadgeDefinition, | ||
BlockedRelaysList: () => BlockedRelaysList, | ||
BookmarkList: () => BookmarkList, | ||
Bookmarksets: () => Bookmarksets, | ||
Calendar: () => Calendar, | ||
CalendarEventRSVP: () => CalendarEventRSVP, | ||
ChannelCreation: () => ChannelCreation, | ||
ChannelHideMessage: () => ChannelHideMessage, | ||
ChannelMessage: () => ChannelMessage, | ||
ChannelMetadata: () => ChannelMetadata, | ||
ChannelMuteUser: () => ChannelMuteUser, | ||
ClassifiedListing: () => ClassifiedListing, | ||
ClientAuth: () => ClientAuth, | ||
CommunitiesList: () => CommunitiesList, | ||
CommunityDefinition: () => CommunityDefinition, | ||
CommunityPostApproval: () => CommunityPostApproval, | ||
Contacts: () => Contacts, | ||
CreateOrUpdateProduct: () => CreateOrUpdateProduct, | ||
CreateOrUpdateStall: () => CreateOrUpdateStall, | ||
Curationsets: () => Curationsets, | ||
Date: () => Date2, | ||
DraftClassifiedListing: () => DraftClassifiedListing, | ||
DraftLong: () => DraftLong, | ||
Emojisets: () => Emojisets, | ||
EncryptedDirectMessage: () => EncryptedDirectMessage, | ||
EncryptedDirectMessages: () => EncryptedDirectMessages, | ||
EventDeletion: () => EventDeletion, | ||
FileMetadata: () => FileMetadata, | ||
Followsets: () => Followsets, | ||
GenericRepost: () => GenericRepost, | ||
Genericlists: () => Genericlists, | ||
HTTPAuth: () => HTTPAuth, | ||
Handlerinformation: () => Handlerinformation, | ||
Handlerrecommendation: () => Handlerrecommendation, | ||
Highlights: () => Highlights, | ||
InterestsList: () => InterestsList, | ||
Interestsets: () => Interestsets, | ||
JobFeedback: () => JobFeedback, | ||
JobRequest: () => JobRequest, | ||
JobResult: () => JobResult, | ||
Label: () => Label, | ||
LightningPubRPC: () => LightningPubRPC, | ||
LiveChatMessage: () => LiveChatMessage, | ||
LiveEvent: () => LiveEvent, | ||
LongFormArticle: () => LongFormArticle, | ||
Metadata: () => Metadata, | ||
Mutelist: () => Mutelist, | ||
NWCWalletInfo: () => NWCWalletInfo, | ||
NWCWalletRequest: () => NWCWalletRequest, | ||
NWCWalletResponse: () => NWCWalletResponse, | ||
NostrConnect: () => NostrConnect, | ||
OpenTimestamps: () => OpenTimestamps, | ||
Pinlist: () => Pinlist, | ||
ProblemTracker: () => ProblemTracker, | ||
ProfileBadges: () => ProfileBadges, | ||
PublicChatsList: () => PublicChatsList, | ||
Reaction: () => Reaction, | ||
RecommendRelay: () => RecommendRelay, | ||
RelayList: () => RelayList, | ||
Relaysets: () => Relaysets, | ||
Report: () => Report, | ||
Reporting: () => Reporting, | ||
Repost: () => Repost, | ||
SearchRelaysList: () => SearchRelaysList, | ||
ShortTextNote: () => ShortTextNote, | ||
Time: () => Time, | ||
UserEmojiList: () => UserEmojiList, | ||
UserStatuses: () => UserStatuses, | ||
Zap: () => Zap, | ||
ZapGoal: () => ZapGoal, | ||
ZapRequest: () => ZapRequest, | ||
classifyKind: () => classifyKind, | ||
isEphemeralKind: () => isEphemeralKind, | ||
isParameterizedReplaceableKind: () => isParameterizedReplaceableKind, | ||
isRegularKind: () => isRegularKind, | ||
isReplaceableKind: () => isReplaceableKind | ||
}); | ||
function isRegularKind(kind) { | ||
return 1e3 <= kind && kind < 1e4 || [1, 2, 4, 5, 6, 7, 8, 16, 40, 41, 42, 43, 44].includes(kind); | ||
} | ||
function isReplaceableKind(kind) { | ||
return [0, 3].includes(kind) || 1e4 <= kind && kind < 2e4; | ||
} | ||
function isEphemeralKind(kind) { | ||
return 2e4 <= kind && kind < 3e4; | ||
} | ||
function isParameterizedReplaceableKind(kind) { | ||
return 3e4 <= kind && kind < 4e4; | ||
} | ||
function classifyKind(kind) { | ||
if (isRegularKind(kind)) | ||
return "regular"; | ||
if (isReplaceableKind(kind)) | ||
return "replaceable"; | ||
if (isEphemeralKind(kind)) | ||
return "ephemeral"; | ||
if (isParameterizedReplaceableKind(kind)) | ||
return "parameterized"; | ||
return "unknown"; | ||
} | ||
var Metadata = 0; | ||
var ShortTextNote = 1; | ||
var RecommendRelay = 2; | ||
var Contacts = 3; | ||
var EncryptedDirectMessage = 4; | ||
var EventDeletion = 5; | ||
var Repost = 6; | ||
var Reaction = 7; | ||
var BadgeAward = 8; | ||
var ChannelCreation = 40; | ||
var ChannelMetadata = 41; | ||
var ChannelMessage = 42; | ||
var ChannelHideMessage = 43; | ||
var ChannelMuteUser = 44; | ||
var Report = 1984; | ||
var ZapRequest = 9734; | ||
var Zap = 9735; | ||
var RelayList = 10002; | ||
var ClientAuth = 22242; | ||
var BadgeDefinition = 30009; | ||
var FileMetadata = 1063; | ||
var EncryptedDirectMessages = 4; | ||
var GenericRepost = 16; | ||
var OpenTimestamps = 1040; | ||
var LiveChatMessage = 1311; | ||
var ProblemTracker = 1971; | ||
var Reporting = 1984; | ||
var Label = 1985; | ||
var CommunityPostApproval = 4550; | ||
var JobRequest = 5999; | ||
var JobResult = 6999; | ||
var JobFeedback = 7e3; | ||
var ZapGoal = 9041; | ||
var Highlights = 9802; | ||
var Mutelist = 1e4; | ||
var Pinlist = 10001; | ||
var BookmarkList = 10003; | ||
var CommunitiesList = 10004; | ||
var PublicChatsList = 10005; | ||
var BlockedRelaysList = 10006; | ||
var SearchRelaysList = 10007; | ||
var InterestsList = 10015; | ||
var UserEmojiList = 10030; | ||
var NWCWalletInfo = 13194; | ||
var LightningPubRPC = 21e3; | ||
var NWCWalletRequest = 23194; | ||
var NWCWalletResponse = 23195; | ||
var NostrConnect = 24133; | ||
var HTTPAuth = 27235; | ||
var Followsets = 3e4; | ||
var Genericlists = 30001; | ||
var Relaysets = 30002; | ||
var Bookmarksets = 30003; | ||
var Curationsets = 30004; | ||
var ProfileBadges = 30008; | ||
var Interestsets = 30015; | ||
var CreateOrUpdateStall = 30017; | ||
var CreateOrUpdateProduct = 30018; | ||
var LongFormArticle = 30023; | ||
var DraftLong = 30024; | ||
var Emojisets = 30030; | ||
var Application = 30078; | ||
var LiveEvent = 30311; | ||
var UserStatuses = 30315; | ||
var ClassifiedListing = 30402; | ||
var DraftClassifiedListing = 30403; | ||
var Date2 = 31922; | ||
var Time = 31923; | ||
var Calendar = 31924; | ||
var CalendarEventRSVP = 31925; | ||
var Handlerrecommendation = 31989; | ||
var Handlerinformation = 31990; | ||
var CommunityDefinition = 34550; | ||
// nip18.ts | ||
function finishRepostEvent(t, reposted, relayUrl, privateKey) { | ||
@@ -1803,19 +1854,2 @@ return finalizeEvent( | ||
// nip42.ts | ||
var nip42_exports = {}; | ||
__export(nip42_exports, { | ||
makeAuthEvent: () => makeAuthEvent | ||
}); | ||
function makeAuthEvent(relayURL, challenge) { | ||
return { | ||
kind: ClientAuth, | ||
created_at: Math.floor(Date.now() / 1e3), | ||
tags: [ | ||
["relay", relayURL], | ||
["challenge", challenge] | ||
], | ||
content: "" | ||
}; | ||
} | ||
// nip44.ts | ||
@@ -1822,0 +1856,0 @@ var nip44_exports = {}; |
@@ -23,2 +23,3 @@ "use strict"; | ||
__export(pool_exports, { | ||
AbstractSimplePool: () => AbstractSimplePool, | ||
SimplePool: () => SimplePool | ||
@@ -236,6 +237,2 @@ }); | ||
// nip42.ts | ||
var nip42_exports = {}; | ||
__export(nip42_exports, { | ||
makeAuthEvent: () => makeAuthEvent | ||
}); | ||
function makeAuthEvent(relayURL, challenge) { | ||
@@ -262,8 +259,11 @@ return { | ||
} | ||
var alwaysTrue = (t) => { | ||
t[verifiedSymbol] = true; | ||
return true; | ||
}; | ||
// relay.ts | ||
var Relay = class { | ||
// abstract-relay.ts | ||
var AbstractRelay = class { | ||
url; | ||
_connected = false; | ||
trusted = false; | ||
onclose = null; | ||
@@ -273,5 +273,5 @@ onnotice = (msg) => console.debug(`NOTICE from ${this.url}: ${msg}`); | ||
connectionTimeout = 4400; | ||
openSubs = /* @__PURE__ */ new Map(); | ||
connectionTimeoutHandle; | ||
connectionPromise; | ||
openSubs = /* @__PURE__ */ new Map(); | ||
openCountRequests = /* @__PURE__ */ new Map(); | ||
@@ -284,5 +284,12 @@ openEventPublishes = /* @__PURE__ */ new Map(); | ||
serial = 0; | ||
constructor(url) { | ||
verifyEvent; | ||
constructor(url, opts) { | ||
this.url = normalizeURL(url); | ||
this.verifyEvent = opts.verifyEvent; | ||
} | ||
static async connect(url, opts) { | ||
const relay = new AbstractRelay(url, opts); | ||
await relay.connect(); | ||
return relay; | ||
} | ||
closeAllSubscriptions(reason) { | ||
@@ -341,8 +348,3 @@ for (let [_, sub] of this.openSubs) { | ||
}; | ||
this.ws.onmessage = (ev) => { | ||
this.incomingMessageQueue.enqueue(ev.data); | ||
if (!this.queueRunning) { | ||
this.runQueue(); | ||
} | ||
}; | ||
this.ws.onmessage = this._onmessage.bind(this); | ||
}); | ||
@@ -385,3 +387,3 @@ return this.connectionPromise; | ||
const event = data[2]; | ||
if ((this.trusted || validateEvent(event) && verifyEvent(event)) && matchFilters(so.filters, event)) { | ||
if (this.verifyEvent(event) && matchFilters(so.filters, event)) { | ||
so.onevent(event); | ||
@@ -427,3 +429,2 @@ } | ||
so.close(data[2]); | ||
this.openSubs.delete(id); | ||
return; | ||
@@ -453,3 +454,3 @@ } | ||
throw new Error("can't perform auth, no challenge was received"); | ||
const evt = nip42_exports.makeAuthEvent(this.url, this.challenge); | ||
const evt = makeAuthEvent(this.url, this.challenge); | ||
await signAuthEvent(evt); | ||
@@ -491,2 +492,8 @@ this.send('["AUTH",' + JSON.stringify(evt) + "]"); | ||
} | ||
_onmessage(ev) { | ||
this.incomingMessageQueue.enqueue(ev.data); | ||
if (!this.queueRunning) { | ||
this.runQueue(); | ||
} | ||
} | ||
}; | ||
@@ -538,2 +545,3 @@ var Subscription = class { | ||
} | ||
this.relay.openSubs.delete(this.id); | ||
this.onclose?.(reason); | ||
@@ -543,8 +551,12 @@ } | ||
// pool.ts | ||
var SimplePool = class { | ||
// abstract-pool.ts | ||
var AbstractSimplePool = class { | ||
relays = /* @__PURE__ */ new Map(); | ||
seenOn = /* @__PURE__ */ new Map(); | ||
trackRelays = false; | ||
verifyEvent; | ||
trustedRelayURLs = /* @__PURE__ */ new Set(); | ||
constructor(opts) { | ||
this.verifyEvent = opts.verifyEvent; | ||
} | ||
async ensureRelay(url, params) { | ||
@@ -554,7 +566,7 @@ url = normalizeURL(url); | ||
if (!relay) { | ||
relay = new Relay(url); | ||
relay = new AbstractRelay(url, { | ||
verifyEvent: this.trustedRelayURLs.has(url) ? alwaysTrue : this.verifyEvent | ||
}); | ||
if (params?.connectionTimeout) | ||
relay.connectionTimeout = params.connectionTimeout; | ||
if (this.trustedRelayURLs.has(relay.url)) | ||
relay.trusted = true; | ||
this.relays.set(url, relay); | ||
@@ -683,1 +695,8 @@ } | ||
}; | ||
// pool.ts | ||
var SimplePool = class extends AbstractSimplePool { | ||
constructor() { | ||
super({ verifyEvent }); | ||
} | ||
}; |
@@ -23,2 +23,3 @@ "use strict"; | ||
__export(relay_exports, { | ||
AbstractRelay: () => AbstractRelay, | ||
Relay: () => Relay, | ||
@@ -238,6 +239,2 @@ Subscription: () => Subscription, | ||
// nip42.ts | ||
var nip42_exports = {}; | ||
__export(nip42_exports, { | ||
makeAuthEvent: () => makeAuthEvent | ||
}); | ||
function makeAuthEvent(relayURL, challenge) { | ||
@@ -265,12 +262,6 @@ return { | ||
// relay.ts | ||
async function relayConnect(url) { | ||
const relay = new Relay(url); | ||
await relay.connect(); | ||
return relay; | ||
} | ||
var Relay = class { | ||
// abstract-relay.ts | ||
var AbstractRelay = class { | ||
url; | ||
_connected = false; | ||
trusted = false; | ||
onclose = null; | ||
@@ -280,5 +271,5 @@ onnotice = (msg) => console.debug(`NOTICE from ${this.url}: ${msg}`); | ||
connectionTimeout = 4400; | ||
openSubs = /* @__PURE__ */ new Map(); | ||
connectionTimeoutHandle; | ||
connectionPromise; | ||
openSubs = /* @__PURE__ */ new Map(); | ||
openCountRequests = /* @__PURE__ */ new Map(); | ||
@@ -291,5 +282,12 @@ openEventPublishes = /* @__PURE__ */ new Map(); | ||
serial = 0; | ||
constructor(url) { | ||
verifyEvent; | ||
constructor(url, opts) { | ||
this.url = normalizeURL(url); | ||
this.verifyEvent = opts.verifyEvent; | ||
} | ||
static async connect(url, opts) { | ||
const relay = new AbstractRelay(url, opts); | ||
await relay.connect(); | ||
return relay; | ||
} | ||
closeAllSubscriptions(reason) { | ||
@@ -348,8 +346,3 @@ for (let [_, sub] of this.openSubs) { | ||
}; | ||
this.ws.onmessage = (ev) => { | ||
this.incomingMessageQueue.enqueue(ev.data); | ||
if (!this.queueRunning) { | ||
this.runQueue(); | ||
} | ||
}; | ||
this.ws.onmessage = this._onmessage.bind(this); | ||
}); | ||
@@ -392,3 +385,3 @@ return this.connectionPromise; | ||
const event = data[2]; | ||
if ((this.trusted || validateEvent(event) && verifyEvent(event)) && matchFilters(so.filters, event)) { | ||
if (this.verifyEvent(event) && matchFilters(so.filters, event)) { | ||
so.onevent(event); | ||
@@ -434,3 +427,2 @@ } | ||
so.close(data[2]); | ||
this.openSubs.delete(id); | ||
return; | ||
@@ -460,3 +452,3 @@ } | ||
throw new Error("can't perform auth, no challenge was received"); | ||
const evt = nip42_exports.makeAuthEvent(this.url, this.challenge); | ||
const evt = makeAuthEvent(this.url, this.challenge); | ||
await signAuthEvent(evt); | ||
@@ -498,2 +490,8 @@ this.send('["AUTH",' + JSON.stringify(evt) + "]"); | ||
} | ||
_onmessage(ev) { | ||
this.incomingMessageQueue.enqueue(ev.data); | ||
if (!this.queueRunning) { | ||
this.runQueue(); | ||
} | ||
} | ||
}; | ||
@@ -545,4 +543,20 @@ var Subscription = class { | ||
} | ||
this.relay.openSubs.delete(this.id); | ||
this.onclose?.(reason); | ||
} | ||
}; | ||
// relay.ts | ||
function relayConnect(url) { | ||
return Relay.connect(url); | ||
} | ||
var Relay = class extends AbstractRelay { | ||
constructor(url) { | ||
super(url, { verifyEvent }); | ||
} | ||
static async connect(url) { | ||
const relay = new Relay(url); | ||
await relay.connect(); | ||
return relay; | ||
} | ||
}; |
@@ -313,2 +313,200 @@ var __defProp = Object.defineProperty; | ||
// nip42.ts | ||
var nip42_exports = {}; | ||
__export(nip42_exports, { | ||
makeAuthEvent: () => makeAuthEvent | ||
}); | ||
// kinds.ts | ||
var kinds_exports = {}; | ||
__export(kinds_exports, { | ||
Application: () => Application, | ||
BadgeAward: () => BadgeAward, | ||
BadgeDefinition: () => BadgeDefinition, | ||
BlockedRelaysList: () => BlockedRelaysList, | ||
BookmarkList: () => BookmarkList, | ||
Bookmarksets: () => Bookmarksets, | ||
Calendar: () => Calendar, | ||
CalendarEventRSVP: () => CalendarEventRSVP, | ||
ChannelCreation: () => ChannelCreation, | ||
ChannelHideMessage: () => ChannelHideMessage, | ||
ChannelMessage: () => ChannelMessage, | ||
ChannelMetadata: () => ChannelMetadata, | ||
ChannelMuteUser: () => ChannelMuteUser, | ||
ClassifiedListing: () => ClassifiedListing, | ||
ClientAuth: () => ClientAuth, | ||
CommunitiesList: () => CommunitiesList, | ||
CommunityDefinition: () => CommunityDefinition, | ||
CommunityPostApproval: () => CommunityPostApproval, | ||
Contacts: () => Contacts, | ||
CreateOrUpdateProduct: () => CreateOrUpdateProduct, | ||
CreateOrUpdateStall: () => CreateOrUpdateStall, | ||
Curationsets: () => Curationsets, | ||
Date: () => Date2, | ||
DraftClassifiedListing: () => DraftClassifiedListing, | ||
DraftLong: () => DraftLong, | ||
Emojisets: () => Emojisets, | ||
EncryptedDirectMessage: () => EncryptedDirectMessage, | ||
EncryptedDirectMessages: () => EncryptedDirectMessages, | ||
EventDeletion: () => EventDeletion, | ||
FileMetadata: () => FileMetadata, | ||
Followsets: () => Followsets, | ||
GenericRepost: () => GenericRepost, | ||
Genericlists: () => Genericlists, | ||
HTTPAuth: () => HTTPAuth, | ||
Handlerinformation: () => Handlerinformation, | ||
Handlerrecommendation: () => Handlerrecommendation, | ||
Highlights: () => Highlights, | ||
InterestsList: () => InterestsList, | ||
Interestsets: () => Interestsets, | ||
JobFeedback: () => JobFeedback, | ||
JobRequest: () => JobRequest, | ||
JobResult: () => JobResult, | ||
Label: () => Label, | ||
LightningPubRPC: () => LightningPubRPC, | ||
LiveChatMessage: () => LiveChatMessage, | ||
LiveEvent: () => LiveEvent, | ||
LongFormArticle: () => LongFormArticle, | ||
Metadata: () => Metadata, | ||
Mutelist: () => Mutelist, | ||
NWCWalletInfo: () => NWCWalletInfo, | ||
NWCWalletRequest: () => NWCWalletRequest, | ||
NWCWalletResponse: () => NWCWalletResponse, | ||
NostrConnect: () => NostrConnect, | ||
OpenTimestamps: () => OpenTimestamps, | ||
Pinlist: () => Pinlist, | ||
ProblemTracker: () => ProblemTracker, | ||
ProfileBadges: () => ProfileBadges, | ||
PublicChatsList: () => PublicChatsList, | ||
Reaction: () => Reaction, | ||
RecommendRelay: () => RecommendRelay, | ||
RelayList: () => RelayList, | ||
Relaysets: () => Relaysets, | ||
Report: () => Report, | ||
Reporting: () => Reporting, | ||
Repost: () => Repost, | ||
SearchRelaysList: () => SearchRelaysList, | ||
ShortTextNote: () => ShortTextNote, | ||
Time: () => Time, | ||
UserEmojiList: () => UserEmojiList, | ||
UserStatuses: () => UserStatuses, | ||
Zap: () => Zap, | ||
ZapGoal: () => ZapGoal, | ||
ZapRequest: () => ZapRequest, | ||
classifyKind: () => classifyKind, | ||
isEphemeralKind: () => isEphemeralKind, | ||
isParameterizedReplaceableKind: () => isParameterizedReplaceableKind, | ||
isRegularKind: () => isRegularKind, | ||
isReplaceableKind: () => isReplaceableKind | ||
}); | ||
function isRegularKind(kind) { | ||
return 1e3 <= kind && kind < 1e4 || [1, 2, 4, 5, 6, 7, 8, 16, 40, 41, 42, 43, 44].includes(kind); | ||
} | ||
function isReplaceableKind(kind) { | ||
return [0, 3].includes(kind) || 1e4 <= kind && kind < 2e4; | ||
} | ||
function isEphemeralKind(kind) { | ||
return 2e4 <= kind && kind < 3e4; | ||
} | ||
function isParameterizedReplaceableKind(kind) { | ||
return 3e4 <= kind && kind < 4e4; | ||
} | ||
function classifyKind(kind) { | ||
if (isRegularKind(kind)) | ||
return "regular"; | ||
if (isReplaceableKind(kind)) | ||
return "replaceable"; | ||
if (isEphemeralKind(kind)) | ||
return "ephemeral"; | ||
if (isParameterizedReplaceableKind(kind)) | ||
return "parameterized"; | ||
return "unknown"; | ||
} | ||
var Metadata = 0; | ||
var ShortTextNote = 1; | ||
var RecommendRelay = 2; | ||
var Contacts = 3; | ||
var EncryptedDirectMessage = 4; | ||
var EventDeletion = 5; | ||
var Repost = 6; | ||
var Reaction = 7; | ||
var BadgeAward = 8; | ||
var ChannelCreation = 40; | ||
var ChannelMetadata = 41; | ||
var ChannelMessage = 42; | ||
var ChannelHideMessage = 43; | ||
var ChannelMuteUser = 44; | ||
var Report = 1984; | ||
var ZapRequest = 9734; | ||
var Zap = 9735; | ||
var RelayList = 10002; | ||
var ClientAuth = 22242; | ||
var BadgeDefinition = 30009; | ||
var FileMetadata = 1063; | ||
var EncryptedDirectMessages = 4; | ||
var GenericRepost = 16; | ||
var OpenTimestamps = 1040; | ||
var LiveChatMessage = 1311; | ||
var ProblemTracker = 1971; | ||
var Reporting = 1984; | ||
var Label = 1985; | ||
var CommunityPostApproval = 4550; | ||
var JobRequest = 5999; | ||
var JobResult = 6999; | ||
var JobFeedback = 7e3; | ||
var ZapGoal = 9041; | ||
var Highlights = 9802; | ||
var Mutelist = 1e4; | ||
var Pinlist = 10001; | ||
var BookmarkList = 10003; | ||
var CommunitiesList = 10004; | ||
var PublicChatsList = 10005; | ||
var BlockedRelaysList = 10006; | ||
var SearchRelaysList = 10007; | ||
var InterestsList = 10015; | ||
var UserEmojiList = 10030; | ||
var NWCWalletInfo = 13194; | ||
var LightningPubRPC = 21e3; | ||
var NWCWalletRequest = 23194; | ||
var NWCWalletResponse = 23195; | ||
var NostrConnect = 24133; | ||
var HTTPAuth = 27235; | ||
var Followsets = 3e4; | ||
var Genericlists = 30001; | ||
var Relaysets = 30002; | ||
var Bookmarksets = 30003; | ||
var Curationsets = 30004; | ||
var ProfileBadges = 30008; | ||
var Interestsets = 30015; | ||
var CreateOrUpdateStall = 30017; | ||
var CreateOrUpdateProduct = 30018; | ||
var LongFormArticle = 30023; | ||
var DraftLong = 30024; | ||
var Emojisets = 30030; | ||
var Application = 30078; | ||
var LiveEvent = 30311; | ||
var UserStatuses = 30315; | ||
var ClassifiedListing = 30402; | ||
var DraftClassifiedListing = 30403; | ||
var Date2 = 31922; | ||
var Time = 31923; | ||
var Calendar = 31924; | ||
var CalendarEventRSVP = 31925; | ||
var Handlerrecommendation = 31989; | ||
var Handlerinformation = 31990; | ||
var CommunityDefinition = 34550; | ||
// nip42.ts | ||
function makeAuthEvent(relayURL, challenge) { | ||
return { | ||
kind: ClientAuth, | ||
created_at: Math.floor(Date.now() / 1e3), | ||
tags: [ | ||
["relay", relayURL], | ||
["challenge", challenge] | ||
], | ||
content: "" | ||
}; | ||
} | ||
// helpers.ts | ||
@@ -323,13 +521,11 @@ async function yieldThread() { | ||
} | ||
var alwaysTrue = (t) => { | ||
t[verifiedSymbol] = true; | ||
return true; | ||
}; | ||
// relay.ts | ||
async function relayConnect(url) { | ||
const relay = new Relay(url); | ||
await relay.connect(); | ||
return relay; | ||
} | ||
var Relay = class { | ||
// abstract-relay.ts | ||
var AbstractRelay = class { | ||
url; | ||
_connected = false; | ||
trusted = false; | ||
onclose = null; | ||
@@ -339,5 +535,5 @@ onnotice = (msg) => console.debug(`NOTICE from ${this.url}: ${msg}`); | ||
connectionTimeout = 4400; | ||
openSubs = /* @__PURE__ */ new Map(); | ||
connectionTimeoutHandle; | ||
connectionPromise; | ||
openSubs = /* @__PURE__ */ new Map(); | ||
openCountRequests = /* @__PURE__ */ new Map(); | ||
@@ -350,5 +546,12 @@ openEventPublishes = /* @__PURE__ */ new Map(); | ||
serial = 0; | ||
constructor(url) { | ||
verifyEvent; | ||
constructor(url, opts) { | ||
this.url = normalizeURL(url); | ||
this.verifyEvent = opts.verifyEvent; | ||
} | ||
static async connect(url, opts) { | ||
const relay = new AbstractRelay(url, opts); | ||
await relay.connect(); | ||
return relay; | ||
} | ||
closeAllSubscriptions(reason) { | ||
@@ -407,8 +610,3 @@ for (let [_, sub] of this.openSubs) { | ||
}; | ||
this.ws.onmessage = (ev) => { | ||
this.incomingMessageQueue.enqueue(ev.data); | ||
if (!this.queueRunning) { | ||
this.runQueue(); | ||
} | ||
}; | ||
this.ws.onmessage = this._onmessage.bind(this); | ||
}); | ||
@@ -451,3 +649,3 @@ return this.connectionPromise; | ||
const event = data[2]; | ||
if ((this.trusted || validateEvent(event) && verifyEvent(event)) && matchFilters(so.filters, event)) { | ||
if (this.verifyEvent(event) && matchFilters(so.filters, event)) { | ||
so.onevent(event); | ||
@@ -493,3 +691,2 @@ } | ||
so.close(data[2]); | ||
this.openSubs.delete(id); | ||
return; | ||
@@ -519,3 +716,3 @@ } | ||
throw new Error("can't perform auth, no challenge was received"); | ||
const evt = nip42_exports.makeAuthEvent(this.url, this.challenge); | ||
const evt = makeAuthEvent(this.url, this.challenge); | ||
await signAuthEvent(evt); | ||
@@ -557,2 +754,8 @@ this.send('["AUTH",' + JSON.stringify(evt) + "]"); | ||
} | ||
_onmessage(ev) { | ||
this.incomingMessageQueue.enqueue(ev.data); | ||
if (!this.queueRunning) { | ||
this.runQueue(); | ||
} | ||
} | ||
}; | ||
@@ -604,2 +807,3 @@ var Subscription = class { | ||
} | ||
this.relay.openSubs.delete(this.id); | ||
this.onclose?.(reason); | ||
@@ -609,8 +813,27 @@ } | ||
// pool.ts | ||
var SimplePool = class { | ||
// relay.ts | ||
function relayConnect(url) { | ||
return Relay.connect(url); | ||
} | ||
var Relay = class extends AbstractRelay { | ||
constructor(url) { | ||
super(url, { verifyEvent }); | ||
} | ||
static async connect(url) { | ||
const relay = new Relay(url); | ||
await relay.connect(); | ||
return relay; | ||
} | ||
}; | ||
// abstract-pool.ts | ||
var AbstractSimplePool = class { | ||
relays = /* @__PURE__ */ new Map(); | ||
seenOn = /* @__PURE__ */ new Map(); | ||
trackRelays = false; | ||
verifyEvent; | ||
trustedRelayURLs = /* @__PURE__ */ new Set(); | ||
constructor(opts) { | ||
this.verifyEvent = opts.verifyEvent; | ||
} | ||
async ensureRelay(url, params) { | ||
@@ -620,7 +843,7 @@ url = normalizeURL(url); | ||
if (!relay) { | ||
relay = new Relay(url); | ||
relay = new AbstractRelay(url, { | ||
verifyEvent: this.trustedRelayURLs.has(url) ? alwaysTrue : this.verifyEvent | ||
}); | ||
if (params?.connectionTimeout) | ||
relay.connectionTimeout = params.connectionTimeout; | ||
if (this.trustedRelayURLs.has(relay.url)) | ||
relay.trusted = true; | ||
this.relays.set(url, relay); | ||
@@ -750,2 +973,9 @@ } | ||
// pool.ts | ||
var SimplePool = class extends AbstractSimplePool { | ||
constructor() { | ||
super({ verifyEvent }); | ||
} | ||
}; | ||
// nip19.ts | ||
@@ -1250,183 +1480,2 @@ var nip19_exports = {}; | ||
}); | ||
// kinds.ts | ||
var kinds_exports = {}; | ||
__export(kinds_exports, { | ||
Application: () => Application, | ||
BadgeAward: () => BadgeAward, | ||
BadgeDefinition: () => BadgeDefinition, | ||
BlockedRelaysList: () => BlockedRelaysList, | ||
BookmarkList: () => BookmarkList, | ||
Bookmarksets: () => Bookmarksets, | ||
Calendar: () => Calendar, | ||
CalendarEventRSVP: () => CalendarEventRSVP, | ||
ChannelCreation: () => ChannelCreation, | ||
ChannelHideMessage: () => ChannelHideMessage, | ||
ChannelMessage: () => ChannelMessage, | ||
ChannelMetadata: () => ChannelMetadata, | ||
ChannelMuteUser: () => ChannelMuteUser, | ||
ClassifiedListing: () => ClassifiedListing, | ||
ClientAuth: () => ClientAuth, | ||
CommunitiesList: () => CommunitiesList, | ||
CommunityDefinition: () => CommunityDefinition, | ||
CommunityPostApproval: () => CommunityPostApproval, | ||
Contacts: () => Contacts, | ||
CreateOrUpdateProduct: () => CreateOrUpdateProduct, | ||
CreateOrUpdateStall: () => CreateOrUpdateStall, | ||
Curationsets: () => Curationsets, | ||
Date: () => Date2, | ||
DraftClassifiedListing: () => DraftClassifiedListing, | ||
DraftLong: () => DraftLong, | ||
Emojisets: () => Emojisets, | ||
EncryptedDirectMessage: () => EncryptedDirectMessage, | ||
EncryptedDirectMessages: () => EncryptedDirectMessages, | ||
EventDeletion: () => EventDeletion, | ||
FileMetadata: () => FileMetadata, | ||
Followsets: () => Followsets, | ||
GenericRepost: () => GenericRepost, | ||
Genericlists: () => Genericlists, | ||
HTTPAuth: () => HTTPAuth, | ||
Handlerinformation: () => Handlerinformation, | ||
Handlerrecommendation: () => Handlerrecommendation, | ||
Highlights: () => Highlights, | ||
InterestsList: () => InterestsList, | ||
Interestsets: () => Interestsets, | ||
JobFeedback: () => JobFeedback, | ||
JobRequest: () => JobRequest, | ||
JobResult: () => JobResult, | ||
Label: () => Label, | ||
LightningPubRPC: () => LightningPubRPC, | ||
LiveChatMessage: () => LiveChatMessage, | ||
LiveEvent: () => LiveEvent, | ||
LongFormArticle: () => LongFormArticle, | ||
Metadata: () => Metadata, | ||
Mutelist: () => Mutelist, | ||
NWCWalletInfo: () => NWCWalletInfo, | ||
NWCWalletRequest: () => NWCWalletRequest, | ||
NWCWalletResponse: () => NWCWalletResponse, | ||
NostrConnect: () => NostrConnect, | ||
OpenTimestamps: () => OpenTimestamps, | ||
Pinlist: () => Pinlist, | ||
ProblemTracker: () => ProblemTracker, | ||
ProfileBadges: () => ProfileBadges, | ||
PublicChatsList: () => PublicChatsList, | ||
Reaction: () => Reaction, | ||
RecommendRelay: () => RecommendRelay, | ||
RelayList: () => RelayList, | ||
Relaysets: () => Relaysets, | ||
Report: () => Report, | ||
Reporting: () => Reporting, | ||
Repost: () => Repost, | ||
SearchRelaysList: () => SearchRelaysList, | ||
ShortTextNote: () => ShortTextNote, | ||
Time: () => Time, | ||
UserEmojiList: () => UserEmojiList, | ||
UserStatuses: () => UserStatuses, | ||
Zap: () => Zap, | ||
ZapGoal: () => ZapGoal, | ||
ZapRequest: () => ZapRequest, | ||
classifyKind: () => classifyKind, | ||
isEphemeralKind: () => isEphemeralKind, | ||
isParameterizedReplaceableKind: () => isParameterizedReplaceableKind, | ||
isRegularKind: () => isRegularKind, | ||
isReplaceableKind: () => isReplaceableKind | ||
}); | ||
function isRegularKind(kind) { | ||
return 1e3 <= kind && kind < 1e4 || [1, 2, 4, 5, 6, 7, 8, 16, 40, 41, 42, 43, 44].includes(kind); | ||
} | ||
function isReplaceableKind(kind) { | ||
return [0, 3].includes(kind) || 1e4 <= kind && kind < 2e4; | ||
} | ||
function isEphemeralKind(kind) { | ||
return 2e4 <= kind && kind < 3e4; | ||
} | ||
function isParameterizedReplaceableKind(kind) { | ||
return 3e4 <= kind && kind < 4e4; | ||
} | ||
function classifyKind(kind) { | ||
if (isRegularKind(kind)) | ||
return "regular"; | ||
if (isReplaceableKind(kind)) | ||
return "replaceable"; | ||
if (isEphemeralKind(kind)) | ||
return "ephemeral"; | ||
if (isParameterizedReplaceableKind(kind)) | ||
return "parameterized"; | ||
return "unknown"; | ||
} | ||
var Metadata = 0; | ||
var ShortTextNote = 1; | ||
var RecommendRelay = 2; | ||
var Contacts = 3; | ||
var EncryptedDirectMessage = 4; | ||
var EventDeletion = 5; | ||
var Repost = 6; | ||
var Reaction = 7; | ||
var BadgeAward = 8; | ||
var ChannelCreation = 40; | ||
var ChannelMetadata = 41; | ||
var ChannelMessage = 42; | ||
var ChannelHideMessage = 43; | ||
var ChannelMuteUser = 44; | ||
var Report = 1984; | ||
var ZapRequest = 9734; | ||
var Zap = 9735; | ||
var RelayList = 10002; | ||
var ClientAuth = 22242; | ||
var BadgeDefinition = 30009; | ||
var FileMetadata = 1063; | ||
var EncryptedDirectMessages = 4; | ||
var GenericRepost = 16; | ||
var OpenTimestamps = 1040; | ||
var LiveChatMessage = 1311; | ||
var ProblemTracker = 1971; | ||
var Reporting = 1984; | ||
var Label = 1985; | ||
var CommunityPostApproval = 4550; | ||
var JobRequest = 5999; | ||
var JobResult = 6999; | ||
var JobFeedback = 7e3; | ||
var ZapGoal = 9041; | ||
var Highlights = 9802; | ||
var Mutelist = 1e4; | ||
var Pinlist = 10001; | ||
var BookmarkList = 10003; | ||
var CommunitiesList = 10004; | ||
var PublicChatsList = 10005; | ||
var BlockedRelaysList = 10006; | ||
var SearchRelaysList = 10007; | ||
var InterestsList = 10015; | ||
var UserEmojiList = 10030; | ||
var NWCWalletInfo = 13194; | ||
var LightningPubRPC = 21e3; | ||
var NWCWalletRequest = 23194; | ||
var NWCWalletResponse = 23195; | ||
var NostrConnect = 24133; | ||
var HTTPAuth = 27235; | ||
var Followsets = 3e4; | ||
var Genericlists = 30001; | ||
var Relaysets = 30002; | ||
var Bookmarksets = 30003; | ||
var Curationsets = 30004; | ||
var ProfileBadges = 30008; | ||
var Interestsets = 30015; | ||
var CreateOrUpdateStall = 30017; | ||
var CreateOrUpdateProduct = 30018; | ||
var LongFormArticle = 30023; | ||
var DraftLong = 30024; | ||
var Emojisets = 30030; | ||
var Application = 30078; | ||
var LiveEvent = 30311; | ||
var UserStatuses = 30315; | ||
var ClassifiedListing = 30402; | ||
var DraftClassifiedListing = 30403; | ||
var Date2 = 31922; | ||
var Time = 31923; | ||
var Calendar = 31924; | ||
var CalendarEventRSVP = 31925; | ||
var Handlerrecommendation = 31989; | ||
var Handlerinformation = 31990; | ||
var CommunityDefinition = 34550; | ||
// nip18.ts | ||
function finishRepostEvent(t, reposted, relayUrl, privateKey) { | ||
@@ -1746,19 +1795,2 @@ return finalizeEvent( | ||
// nip42.ts | ||
var nip42_exports = {}; | ||
__export(nip42_exports, { | ||
makeAuthEvent: () => makeAuthEvent | ||
}); | ||
function makeAuthEvent(relayURL, challenge) { | ||
return { | ||
kind: ClientAuth, | ||
created_at: Math.floor(Date.now() / 1e3), | ||
tags: [ | ||
["relay", relayURL], | ||
["challenge", challenge] | ||
], | ||
content: "" | ||
}; | ||
} | ||
// nip44.ts | ||
@@ -2119,2 +2151,4 @@ var nip44_exports = {}; | ||
export { | ||
AbstractRelay, | ||
AbstractSimplePool, | ||
Relay, | ||
@@ -2121,0 +2155,0 @@ SimplePool, |
@@ -1,7 +0,1 @@ | ||
var __defProp = Object.defineProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
// pure.ts | ||
@@ -215,6 +209,2 @@ import { schnorr } from "@noble/curves/secp256k1"; | ||
// nip42.ts | ||
var nip42_exports = {}; | ||
__export(nip42_exports, { | ||
makeAuthEvent: () => makeAuthEvent | ||
}); | ||
function makeAuthEvent(relayURL, challenge) { | ||
@@ -241,8 +231,11 @@ return { | ||
} | ||
var alwaysTrue = (t) => { | ||
t[verifiedSymbol] = true; | ||
return true; | ||
}; | ||
// relay.ts | ||
var Relay = class { | ||
// abstract-relay.ts | ||
var AbstractRelay = class { | ||
url; | ||
_connected = false; | ||
trusted = false; | ||
onclose = null; | ||
@@ -252,5 +245,5 @@ onnotice = (msg) => console.debug(`NOTICE from ${this.url}: ${msg}`); | ||
connectionTimeout = 4400; | ||
openSubs = /* @__PURE__ */ new Map(); | ||
connectionTimeoutHandle; | ||
connectionPromise; | ||
openSubs = /* @__PURE__ */ new Map(); | ||
openCountRequests = /* @__PURE__ */ new Map(); | ||
@@ -263,5 +256,12 @@ openEventPublishes = /* @__PURE__ */ new Map(); | ||
serial = 0; | ||
constructor(url) { | ||
verifyEvent; | ||
constructor(url, opts) { | ||
this.url = normalizeURL(url); | ||
this.verifyEvent = opts.verifyEvent; | ||
} | ||
static async connect(url, opts) { | ||
const relay = new AbstractRelay(url, opts); | ||
await relay.connect(); | ||
return relay; | ||
} | ||
closeAllSubscriptions(reason) { | ||
@@ -320,8 +320,3 @@ for (let [_, sub] of this.openSubs) { | ||
}; | ||
this.ws.onmessage = (ev) => { | ||
this.incomingMessageQueue.enqueue(ev.data); | ||
if (!this.queueRunning) { | ||
this.runQueue(); | ||
} | ||
}; | ||
this.ws.onmessage = this._onmessage.bind(this); | ||
}); | ||
@@ -364,3 +359,3 @@ return this.connectionPromise; | ||
const event = data[2]; | ||
if ((this.trusted || validateEvent(event) && verifyEvent(event)) && matchFilters(so.filters, event)) { | ||
if (this.verifyEvent(event) && matchFilters(so.filters, event)) { | ||
so.onevent(event); | ||
@@ -406,3 +401,2 @@ } | ||
so.close(data[2]); | ||
this.openSubs.delete(id); | ||
return; | ||
@@ -432,3 +426,3 @@ } | ||
throw new Error("can't perform auth, no challenge was received"); | ||
const evt = nip42_exports.makeAuthEvent(this.url, this.challenge); | ||
const evt = makeAuthEvent(this.url, this.challenge); | ||
await signAuthEvent(evt); | ||
@@ -470,2 +464,8 @@ this.send('["AUTH",' + JSON.stringify(evt) + "]"); | ||
} | ||
_onmessage(ev) { | ||
this.incomingMessageQueue.enqueue(ev.data); | ||
if (!this.queueRunning) { | ||
this.runQueue(); | ||
} | ||
} | ||
}; | ||
@@ -517,2 +517,3 @@ var Subscription = class { | ||
} | ||
this.relay.openSubs.delete(this.id); | ||
this.onclose?.(reason); | ||
@@ -522,8 +523,12 @@ } | ||
// pool.ts | ||
var SimplePool = class { | ||
// abstract-pool.ts | ||
var AbstractSimplePool = class { | ||
relays = /* @__PURE__ */ new Map(); | ||
seenOn = /* @__PURE__ */ new Map(); | ||
trackRelays = false; | ||
verifyEvent; | ||
trustedRelayURLs = /* @__PURE__ */ new Set(); | ||
constructor(opts) { | ||
this.verifyEvent = opts.verifyEvent; | ||
} | ||
async ensureRelay(url, params) { | ||
@@ -533,7 +538,7 @@ url = normalizeURL(url); | ||
if (!relay) { | ||
relay = new Relay(url); | ||
relay = new AbstractRelay(url, { | ||
verifyEvent: this.trustedRelayURLs.has(url) ? alwaysTrue : this.verifyEvent | ||
}); | ||
if (params?.connectionTimeout) | ||
relay.connectionTimeout = params.connectionTimeout; | ||
if (this.trustedRelayURLs.has(relay.url)) | ||
relay.trusted = true; | ||
this.relays.set(url, relay); | ||
@@ -662,4 +667,12 @@ } | ||
}; | ||
// pool.ts | ||
var SimplePool = class extends AbstractSimplePool { | ||
constructor() { | ||
super({ verifyEvent }); | ||
} | ||
}; | ||
export { | ||
AbstractSimplePool, | ||
SimplePool | ||
}; |
@@ -1,7 +0,1 @@ | ||
var __defProp = Object.defineProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
// pure.ts | ||
@@ -215,6 +209,2 @@ import { schnorr } from "@noble/curves/secp256k1"; | ||
// nip42.ts | ||
var nip42_exports = {}; | ||
__export(nip42_exports, { | ||
makeAuthEvent: () => makeAuthEvent | ||
}); | ||
function makeAuthEvent(relayURL, challenge) { | ||
@@ -242,12 +232,6 @@ return { | ||
// relay.ts | ||
async function relayConnect(url) { | ||
const relay = new Relay(url); | ||
await relay.connect(); | ||
return relay; | ||
} | ||
var Relay = class { | ||
// abstract-relay.ts | ||
var AbstractRelay = class { | ||
url; | ||
_connected = false; | ||
trusted = false; | ||
onclose = null; | ||
@@ -257,5 +241,5 @@ onnotice = (msg) => console.debug(`NOTICE from ${this.url}: ${msg}`); | ||
connectionTimeout = 4400; | ||
openSubs = /* @__PURE__ */ new Map(); | ||
connectionTimeoutHandle; | ||
connectionPromise; | ||
openSubs = /* @__PURE__ */ new Map(); | ||
openCountRequests = /* @__PURE__ */ new Map(); | ||
@@ -268,5 +252,12 @@ openEventPublishes = /* @__PURE__ */ new Map(); | ||
serial = 0; | ||
constructor(url) { | ||
verifyEvent; | ||
constructor(url, opts) { | ||
this.url = normalizeURL(url); | ||
this.verifyEvent = opts.verifyEvent; | ||
} | ||
static async connect(url, opts) { | ||
const relay = new AbstractRelay(url, opts); | ||
await relay.connect(); | ||
return relay; | ||
} | ||
closeAllSubscriptions(reason) { | ||
@@ -325,8 +316,3 @@ for (let [_, sub] of this.openSubs) { | ||
}; | ||
this.ws.onmessage = (ev) => { | ||
this.incomingMessageQueue.enqueue(ev.data); | ||
if (!this.queueRunning) { | ||
this.runQueue(); | ||
} | ||
}; | ||
this.ws.onmessage = this._onmessage.bind(this); | ||
}); | ||
@@ -369,3 +355,3 @@ return this.connectionPromise; | ||
const event = data[2]; | ||
if ((this.trusted || validateEvent(event) && verifyEvent(event)) && matchFilters(so.filters, event)) { | ||
if (this.verifyEvent(event) && matchFilters(so.filters, event)) { | ||
so.onevent(event); | ||
@@ -411,3 +397,2 @@ } | ||
so.close(data[2]); | ||
this.openSubs.delete(id); | ||
return; | ||
@@ -437,3 +422,3 @@ } | ||
throw new Error("can't perform auth, no challenge was received"); | ||
const evt = nip42_exports.makeAuthEvent(this.url, this.challenge); | ||
const evt = makeAuthEvent(this.url, this.challenge); | ||
await signAuthEvent(evt); | ||
@@ -475,2 +460,8 @@ this.send('["AUTH",' + JSON.stringify(evt) + "]"); | ||
} | ||
_onmessage(ev) { | ||
this.incomingMessageQueue.enqueue(ev.data); | ||
if (!this.queueRunning) { | ||
this.runQueue(); | ||
} | ||
} | ||
}; | ||
@@ -522,6 +513,23 @@ var Subscription = class { | ||
} | ||
this.relay.openSubs.delete(this.id); | ||
this.onclose?.(reason); | ||
} | ||
}; | ||
// relay.ts | ||
function relayConnect(url) { | ||
return Relay.connect(url); | ||
} | ||
var Relay = class extends AbstractRelay { | ||
constructor(url) { | ||
super(url, { verifyEvent }); | ||
} | ||
static async connect(url) { | ||
const relay = new Relay(url); | ||
await relay.connect(); | ||
return relay; | ||
} | ||
}; | ||
export { | ||
AbstractRelay, | ||
Relay, | ||
@@ -528,0 +536,0 @@ Subscription, |
@@ -19,2 +19,3 @@ export interface Nostr { | ||
} | ||
export type NostrEvent = Event; | ||
export type EventTemplate = Pick<Event, 'kind' | 'tags' | 'content' | 'created_at'>; | ||
@@ -21,0 +22,0 @@ export type UnsignedEvent = Pick<Event, 'kind' | 'tags' | 'content' | 'created_at' | 'pubkey'>; |
@@ -1,2 +0,2 @@ | ||
import { Event } from './pure.ts'; | ||
import { Event } from './core.ts'; | ||
export type Filter = { | ||
@@ -3,0 +3,0 @@ ids?: string[]; |
@@ -0,1 +1,3 @@ | ||
import { type Nostr } from './core.ts'; | ||
export declare function yieldThread(): Promise<unknown>; | ||
export declare const alwaysTrue: Nostr['verifyEvent']; |
export * from './pure.ts'; | ||
export * from './relay.ts'; | ||
export * from './pure.ts'; | ||
export * from './filter.ts'; | ||
@@ -5,0 +4,0 @@ export * from './pool.ts'; |
@@ -1,2 +0,2 @@ | ||
import type { Event } from './pure.ts'; | ||
import type { Event } from './core.ts'; | ||
import type { EventPointer, ProfilePointer } from './nip19.ts'; | ||
@@ -3,0 +3,0 @@ export type NIP10Result = { |
@@ -1,2 +0,2 @@ | ||
import { EventTemplate } from './pure.ts'; | ||
import { EventTemplate } from './core.ts'; | ||
/** | ||
@@ -3,0 +3,0 @@ * creates an EventTemplate for an AUTH event to be signed. |
@@ -1,26 +0,5 @@ | ||
import { Relay, SubscriptionParams } from './relay.ts'; | ||
import type { Event } from './pure.ts'; | ||
import { type Filter } from './filter.ts'; | ||
export type SubCloser = { | ||
close: () => void; | ||
}; | ||
export type SubscribeManyParams = Omit<SubscriptionParams, 'onclose' | 'id'> & { | ||
maxWait?: number; | ||
onclose?: (reasons: string[]) => void; | ||
id?: string; | ||
}; | ||
export declare class SimplePool { | ||
private relays; | ||
seenOn: Map<string, Set<Relay>>; | ||
trackRelays: boolean; | ||
trustedRelayURLs: Set<string>; | ||
ensureRelay(url: string, params?: { | ||
connectionTimeout?: number; | ||
}): Promise<Relay>; | ||
close(relays: string[]): void; | ||
subscribeMany(relays: string[], filters: Filter[], params: SubscribeManyParams): SubCloser; | ||
subscribeManyEose(relays: string[], filters: Filter[], params: Pick<SubscribeManyParams, 'id' | 'onevent' | 'onclose' | 'maxWait'>): SubCloser; | ||
querySync(relays: string[], filter: Filter, params?: Pick<SubscribeManyParams, 'id' | 'maxWait'>): Promise<Event[]>; | ||
get(relays: string[], filter: Filter, params?: Pick<SubscribeManyParams, 'id' | 'maxWait'>): Promise<Event | null>; | ||
publish(relays: string[], event: Event): Promise<string>[]; | ||
import { AbstractSimplePool } from './abstract-pool.ts'; | ||
export declare class SimplePool extends AbstractSimplePool { | ||
constructor(); | ||
} | ||
export * from './abstract-pool.ts'; |
import { type AddressPointer, type ProfilePointer, type EventPointer } from './nip19.ts'; | ||
import type { Event } from './pure.ts'; | ||
import type { Event } from './core.ts'; | ||
type Reference = { | ||
@@ -4,0 +4,0 @@ text: string; |
@@ -1,73 +0,10 @@ | ||
import { type Event, EventTemplate } from './pure.ts'; | ||
import { type Filter } from './filter.ts'; | ||
import { AbstractRelay } from './abstract-relay.ts'; | ||
/** | ||
* @deprecated use Relay.connect() instead. | ||
*/ | ||
export declare function relayConnect(url: string): Promise<Relay>; | ||
export declare class Relay { | ||
readonly url: string; | ||
private _connected; | ||
trusted: boolean; | ||
onclose: (() => void) | null; | ||
onnotice: (msg: string) => void; | ||
baseEoseTimeout: number; | ||
connectionTimeout: number; | ||
private connectionTimeoutHandle; | ||
private connectionPromise; | ||
private openSubs; | ||
private openCountRequests; | ||
private openEventPublishes; | ||
private ws; | ||
private incomingMessageQueue; | ||
private queueRunning; | ||
private challenge; | ||
private serial; | ||
export declare class Relay extends AbstractRelay { | ||
constructor(url: string); | ||
private closeAllSubscriptions; | ||
get connected(): boolean; | ||
connect(): Promise<void>; | ||
private runQueue; | ||
private handleNext; | ||
send(message: string): Promise<void>; | ||
auth(signAuthEvent: (authEvent: EventTemplate) => Promise<void>): Promise<void>; | ||
publish(event: Event): Promise<string>; | ||
count(filters: Filter[], params: { | ||
id?: string | null; | ||
}): Promise<number>; | ||
subscribe(filters: Filter[], params: Partial<SubscriptionParams>): Subscription; | ||
prepareSubscription(filters: Filter[], params: Partial<SubscriptionParams> & { | ||
id?: string; | ||
}): Subscription; | ||
close(): void; | ||
static connect(url: string): Promise<Relay>; | ||
} | ||
export declare class Subscription { | ||
readonly relay: Relay; | ||
readonly id: string; | ||
closed: boolean; | ||
eosed: boolean; | ||
filters: Filter[]; | ||
alreadyHaveEvent: ((id: string) => boolean) | undefined; | ||
receivedEvent: ((relay: Relay, id: string) => void) | undefined; | ||
onevent: (evt: Event) => void; | ||
oneose: (() => void) | undefined; | ||
onclose: ((reason: string) => void) | undefined; | ||
eoseTimeout: number; | ||
private eoseTimeoutHandle; | ||
constructor(relay: Relay, id: string, filters: Filter[], params: SubscriptionParams); | ||
fire(): void; | ||
receivedEose(): void; | ||
close(reason?: string): void; | ||
} | ||
export type SubscriptionParams = { | ||
onevent?: (evt: Event) => void; | ||
oneose?: () => void; | ||
onclose?: (reason: string) => void; | ||
alreadyHaveEvent?: (id: string) => boolean; | ||
receivedEvent?: (relay: Relay, id: string) => void; | ||
eoseTimeout?: number; | ||
}; | ||
export type CountResolver = { | ||
resolve: (count: number) => void; | ||
reject: (err: Error) => void; | ||
}; | ||
export type EventPublishResolver = { | ||
resolve: (reason: string) => void; | ||
reject: (err: Error) => void; | ||
}; | ||
export * from './abstract-relay.ts'; |
@@ -1,3 +0,3 @@ | ||
/// <reference types="bun-types" /> | ||
import type { Event } from './pure.ts'; | ||
/// <reference types="web" /> | ||
import type { Event } from './core.ts'; | ||
export declare const utf8Decoder: TextDecoder; | ||
@@ -4,0 +4,0 @@ export declare const utf8Encoder: TextEncoder; |
{ | ||
"type": "module", | ||
"name": "nostr-tools", | ||
"version": "2.0.3", | ||
"version": "2.1.0", | ||
"description": "Tools for making a Nostr client.", | ||
@@ -42,2 +43,7 @@ "repository": { | ||
}, | ||
"./abstract-relay": { | ||
"import": "./lib/esm/abstract-relay.js", | ||
"require": "./lib/cjs/abstract-relay.js", | ||
"types": "./lib/types/abstract-relay.d.ts" | ||
}, | ||
"./relay": { | ||
@@ -48,2 +54,7 @@ "import": "./lib/esm/relay.js", | ||
}, | ||
"./abstract-pool": { | ||
"import": "./lib/esm/abstract-pool.js", | ||
"require": "./lib/cjs/abstract-pool.js", | ||
"types": "./lib/types/abstract-pool.d.ts" | ||
}, | ||
"./pool": { | ||
@@ -168,3 +179,4 @@ "import": "./lib/esm/pool.js", | ||
"@scure/bip39": "1.2.1", | ||
"nostr-wasm": "v0.0.3" | ||
"mitata": "^0.1.6", | ||
"nostr-wasm": "v0.1.0" | ||
}, | ||
@@ -171,0 +183,0 @@ "peerDependencies": { |
@@ -46,5 +46,5 @@ # ![](https://img.shields.io/github/actions/workflow/status/nbd-wtf/nostr-tools/test.yml) nostr-tools | ||
```js | ||
import { relayConnect, finalizeEvent, generateSecretKey, getPublicKey } from 'nostr-tools' | ||
import { Relay, finalizeEvent, generateSecretKey, getPublicKey } from 'nostr-tools' | ||
const relay = await relayConnect('wss://relay.example.com') | ||
const relay = await Relay.connect('wss://relay.example.com') | ||
console.log(`connected to ${relay.url}`) | ||
@@ -214,2 +214,4 @@ | ||
import { generateSecretKey, finalizeEvent, verifyEvent } from 'nostr-tools/pure' | ||
import { SimplePool } from 'nostr-tools/pool' | ||
import { Relay, Subscription } from 'nostr-tools/relay' | ||
import { matchFilter } from 'nostr-tools/filter' | ||
@@ -235,4 +237,33 @@ import { decode, nprofileEncode, neventEncode, npubEncode } from 'nostr-tools/nip19' | ||
This may be faster than the pure-JS [noble libraries](https://paulmillr.com/noble/) used by default and in `nostr-tools/pure`. | ||
If you're going to use `Relay` and `SimplePool` you must also import `nostr-tools/abstract-relay` and/or `nostr-tools/abstract-pool` instead of the defaults and then instantiate them by passing the `verifyEvent`: | ||
```js | ||
import { setNostrWasm, verifyEvent } from 'nostr-tools/wasm' | ||
import { AbstractRelay } from 'nostr-tools/abstract-relay' | ||
import { AbstractSimplePool } from 'nostr-tools/abstract-pool' | ||
import { initNostrWasm } from 'nostr-wasm' | ||
initNostrWasm().then(setNostrWasm) | ||
const relay = AbstractRelay.connect('wss://relayable.org', { verifyEvent }) | ||
const pool = new AbstractSimplePool({ verifyEvent }) | ||
``` | ||
This may be faster than the pure-JS [noble libraries](https://paulmillr.com/noble/) used by default and in `nostr-tools/pure`. Benchmarks: | ||
``` | ||
benchmark time (avg) (min … max) p75 p99 p995 | ||
------------------------------------------------- ----------------------------- | ||
• relay read message and verify event (many events) | ||
------------------------------------------------- ----------------------------- | ||
wasm 34.94 ms/iter (34.61 ms … 35.73 ms) 35.07 ms 35.73 ms 35.73 ms | ||
pure js 239.7 ms/iter (235.41 ms … 243.69 ms) 240.51 ms 243.69 ms 243.69 ms | ||
trusted 402.71 µs/iter (344.57 µs … 2.98 ms) 407.39 µs 745.62 µs 812.59 µs | ||
summary for relay read message and verify event | ||
wasm | ||
86.77x slower than trusted | ||
6.86x faster than pure js | ||
``` | ||
### Using from the browser (if you don't want to use a bundler) | ||
@@ -239,0 +270,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2134564
192
20935
282
Yes
9
+ Addedmitata@^0.1.6
+ Addedmitata@0.1.14(transitive)
Updatednostr-wasm@v0.1.0