@openclaw/nostr 2026.7.1-beta.2 → 2026.7.1-beta.4
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/dist/api.js +5 -16
- package/dist/{channel-CV0aX1uq.js → channel-B2Y66pl3.js} +11 -4
- package/dist/channel-plugin-api.js +1 -1
- package/dist/doctor-contract-api.js +3 -22
- package/dist/setup-api.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-BqBa2C0K.js → setup-surface-CKamwGa3.js} +1 -1
- package/node_modules/nostr-tools/README.md +37 -15
- package/node_modules/nostr-tools/lib/cjs/abstract-pool.js +134 -6
- package/node_modules/nostr-tools/lib/cjs/abstract-pool.js.map +4 -4
- package/node_modules/nostr-tools/lib/cjs/abstract-relay.js +35 -6
- package/node_modules/nostr-tools/lib/cjs/abstract-relay.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/filter.js.map +1 -1
- package/node_modules/nostr-tools/lib/cjs/index.js +401 -72
- package/node_modules/nostr-tools/lib/cjs/index.js.map +4 -4
- package/node_modules/nostr-tools/lib/cjs/kinds.js +196 -4
- package/node_modules/nostr-tools/lib/cjs/kinds.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/nip10.js +5 -4
- package/node_modules/nostr-tools/lib/cjs/nip10.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/nip17.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/nip18.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/nip19.js +2 -0
- package/node_modules/nostr-tools/lib/cjs/nip19.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/nip21.js +2 -0
- package/node_modules/nostr-tools/lib/cjs/nip21.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/nip22.js +11 -5
- package/node_modules/nostr-tools/lib/cjs/nip22.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/nip25.js.map +1 -1
- package/node_modules/nostr-tools/lib/cjs/nip27.js +2 -0
- package/node_modules/nostr-tools/lib/cjs/nip27.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/nip28.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/nip29.js +2 -0
- package/node_modules/nostr-tools/lib/cjs/nip29.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/nip42.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/nip45.js +183 -0
- package/node_modules/nostr-tools/lib/cjs/nip45.js.map +7 -0
- package/node_modules/nostr-tools/lib/cjs/nip46.js +149 -9
- package/node_modules/nostr-tools/lib/cjs/nip46.js.map +4 -4
- package/node_modules/nostr-tools/lib/cjs/nip47.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/nip49.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/nip57.js.map +1 -1
- package/node_modules/nostr-tools/lib/cjs/nip58.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/nip59.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/nip75.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/nip94.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/nip98.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/nip99.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/nipb0.js +1064 -0
- package/node_modules/nostr-tools/lib/cjs/nipb0.js.map +7 -0
- package/node_modules/nostr-tools/lib/cjs/pool.js +134 -6
- package/node_modules/nostr-tools/lib/cjs/pool.js.map +4 -4
- package/node_modules/nostr-tools/lib/cjs/references.js +2 -0
- package/node_modules/nostr-tools/lib/cjs/references.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/relay.js +35 -6
- package/node_modules/nostr-tools/lib/cjs/relay.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/abstract-pool.js +134 -6
- package/node_modules/nostr-tools/lib/esm/abstract-pool.js.map +4 -4
- package/node_modules/nostr-tools/lib/esm/abstract-relay.js +35 -6
- package/node_modules/nostr-tools/lib/esm/abstract-relay.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/filter.js.map +1 -1
- package/node_modules/nostr-tools/lib/esm/index.js +377 -48
- package/node_modules/nostr-tools/lib/esm/index.js.map +4 -4
- package/node_modules/nostr-tools/lib/esm/kinds.js +196 -4
- package/node_modules/nostr-tools/lib/esm/kinds.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/nip10.js +5 -4
- package/node_modules/nostr-tools/lib/esm/nip10.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/nip17.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/nip18.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/nip19.js +2 -0
- package/node_modules/nostr-tools/lib/esm/nip19.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/nip21.js +2 -0
- package/node_modules/nostr-tools/lib/esm/nip21.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/nip22.js +11 -5
- package/node_modules/nostr-tools/lib/esm/nip22.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/nip25.js.map +1 -1
- package/node_modules/nostr-tools/lib/esm/nip27.js +2 -0
- package/node_modules/nostr-tools/lib/esm/nip27.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/nip28.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/nip29.js +2 -0
- package/node_modules/nostr-tools/lib/esm/nip29.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/nip42.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/nip45.js +162 -0
- package/node_modules/nostr-tools/lib/esm/nip45.js.map +7 -0
- package/node_modules/nostr-tools/lib/esm/nip46.js +149 -9
- package/node_modules/nostr-tools/lib/esm/nip46.js.map +4 -4
- package/node_modules/nostr-tools/lib/esm/nip47.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/nip49.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/nip57.js.map +1 -1
- package/node_modules/nostr-tools/lib/esm/nip58.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/nip59.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/nip75.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/nip94.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/nip98.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/nip99.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/nipb0.js +1049 -0
- package/node_modules/nostr-tools/lib/esm/nipb0.js.map +7 -0
- package/node_modules/nostr-tools/lib/esm/pool.js +134 -6
- package/node_modules/nostr-tools/lib/esm/pool.js.map +4 -4
- package/node_modules/nostr-tools/lib/esm/references.js +2 -0
- package/node_modules/nostr-tools/lib/esm/references.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/relay.js +35 -6
- package/node_modules/nostr-tools/lib/esm/relay.js.map +2 -2
- package/node_modules/nostr-tools/lib/nostr.bundle.js +350 -23
- package/node_modules/nostr-tools/lib/nostr.bundle.js.map +4 -4
- package/node_modules/nostr-tools/lib/types/abstract-pool.d.ts +9 -0
- package/node_modules/nostr-tools/lib/types/abstract-relay.d.ts +10 -1
- package/node_modules/nostr-tools/lib/types/kinds.d.ts +200 -8
- package/node_modules/nostr-tools/lib/types/nip45.d.ts +13 -0
- package/node_modules/nostr-tools/lib/types/nip45.test.d.ts +1 -0
- package/node_modules/nostr-tools/lib/types/nip46.d.ts +12 -5
- package/node_modules/nostr-tools/lib/types/nipb0.d.ts +129 -0
- package/node_modules/nostr-tools/package.json +13 -1
- package/npm-shrinkwrap.json +7 -7
- package/package.json +5 -5
|
@@ -232,39 +232,61 @@ var verifyEvent = i.verifyEvent;
|
|
|
232
232
|
// kinds.ts
|
|
233
233
|
var kinds_exports = {};
|
|
234
234
|
__export(kinds_exports, {
|
|
235
|
+
AIEmbeddings: () => AIEmbeddings,
|
|
236
|
+
AppCurationSet: () => AppCurationSet,
|
|
235
237
|
Application: () => Application,
|
|
238
|
+
AuthoredPodcasts: () => AuthoredPodcasts,
|
|
236
239
|
BadgeAward: () => BadgeAward,
|
|
237
240
|
BadgeDefinition: () => BadgeDefinition,
|
|
241
|
+
Bid: () => Bid,
|
|
242
|
+
BidConfirmation: () => BidConfirmation,
|
|
243
|
+
BlobsAuth: () => BlobsAuth,
|
|
238
244
|
BlockedRelaysList: () => BlockedRelaysList,
|
|
239
245
|
BlossomServerList: () => BlossomServerList,
|
|
240
246
|
BookmarkList: () => BookmarkList,
|
|
241
247
|
Bookmarksets: () => Bookmarksets,
|
|
242
248
|
Calendar: () => Calendar,
|
|
243
249
|
CalendarEventRSVP: () => CalendarEventRSVP,
|
|
250
|
+
CashuMintAnnouncement: () => CashuMintAnnouncement,
|
|
251
|
+
CashuWalletEvent: () => CashuWalletEvent,
|
|
252
|
+
CashuWalletHistory: () => CashuWalletHistory,
|
|
253
|
+
CashuWalletTokens: () => CashuWalletTokens,
|
|
244
254
|
ChannelCreation: () => ChannelCreation,
|
|
245
255
|
ChannelHideMessage: () => ChannelHideMessage,
|
|
246
256
|
ChannelMessage: () => ChannelMessage,
|
|
247
257
|
ChannelMetadata: () => ChannelMetadata,
|
|
248
258
|
ChannelMuteUser: () => ChannelMuteUser,
|
|
249
259
|
ChatMessage: () => ChatMessage,
|
|
260
|
+
Chess: () => Chess,
|
|
250
261
|
ClassifiedListing: () => ClassifiedListing,
|
|
251
262
|
ClientAuth: () => ClientAuth,
|
|
263
|
+
CodeSnippet: () => CodeSnippet,
|
|
264
|
+
CoinjoinPool: () => CoinjoinPool,
|
|
252
265
|
Comment: () => Comment,
|
|
253
266
|
CommunitiesList: () => CommunitiesList,
|
|
254
267
|
CommunityDefinition: () => CommunityDefinition,
|
|
255
268
|
CommunityPostApproval: () => CommunityPostApproval,
|
|
269
|
+
ConferenceEvent: () => ConferenceEvent,
|
|
256
270
|
Contacts: () => Contacts,
|
|
257
271
|
CreateOrUpdateProduct: () => CreateOrUpdateProduct,
|
|
258
272
|
CreateOrUpdateStall: () => CreateOrUpdateStall,
|
|
273
|
+
CuratedVideoSets: () => CuratedVideoSets,
|
|
259
274
|
Curationsets: () => Curationsets,
|
|
260
275
|
Date: () => Date2,
|
|
276
|
+
DecoupledEncryptionKeyDistribution: () => DecoupledEncryptionKeyDistribution,
|
|
277
|
+
DecoupledKeyAnnouncement: () => DecoupledKeyAnnouncement,
|
|
278
|
+
DecoupledKeyClientAnnouncement: () => DecoupledKeyClientAnnouncement,
|
|
261
279
|
DirectMessageRelaysList: () => DirectMessageRelaysList,
|
|
262
280
|
DraftClassifiedListing: () => DraftClassifiedListing,
|
|
281
|
+
DraftEvent: () => DraftEvent,
|
|
263
282
|
DraftLong: () => DraftLong,
|
|
264
283
|
Emojisets: () => Emojisets,
|
|
265
284
|
EncryptedDirectMessage: () => EncryptedDirectMessage,
|
|
266
285
|
EventDeletion: () => EventDeletion,
|
|
286
|
+
FavoritePodcasts: () => FavoritePodcasts,
|
|
267
287
|
FavoriteRelays: () => FavoriteRelays,
|
|
288
|
+
FedimintAnnouncement: () => FedimintAnnouncement,
|
|
289
|
+
Feed: () => Feed,
|
|
268
290
|
FileMessage: () => FileMessage,
|
|
269
291
|
FileMetadata: () => FileMetadata,
|
|
270
292
|
FileServerPreference: () => FileServerPreference,
|
|
@@ -272,55 +294,129 @@ __export(kinds_exports, {
|
|
|
272
294
|
ForumThread: () => ForumThread,
|
|
273
295
|
GenericRepost: () => GenericRepost,
|
|
274
296
|
Genericlists: () => Genericlists,
|
|
297
|
+
GeocacheListing: () => GeocacheListing,
|
|
298
|
+
GeocacheLog: () => GeocacheLog,
|
|
299
|
+
GeocacheLogEntry: () => GeocacheLogEntry,
|
|
300
|
+
GeocacheProofOfFind: () => GeocacheProofOfFind,
|
|
275
301
|
GiftWrap: () => GiftWrap,
|
|
302
|
+
GitPullRequest: () => GitPullRequest,
|
|
303
|
+
GitPullRequestUpdate: () => GitPullRequestUpdate,
|
|
304
|
+
GoodWikiAuthorList: () => GoodWikiAuthorList,
|
|
305
|
+
GoodWikiRelayList: () => GoodWikiRelayList,
|
|
276
306
|
GroupMetadata: () => GroupMetadata,
|
|
277
307
|
HTTPAuth: () => HTTPAuth,
|
|
278
308
|
Handlerinformation: () => Handlerinformation,
|
|
279
309
|
Handlerrecommendation: () => Handlerrecommendation,
|
|
280
310
|
Highlights: () => Highlights,
|
|
311
|
+
InteractiveRoom: () => InteractiveRoom,
|
|
281
312
|
InterestsList: () => InterestsList,
|
|
282
313
|
Interestsets: () => Interestsets,
|
|
314
|
+
Issue: () => Issue,
|
|
283
315
|
JobFeedback: () => JobFeedback,
|
|
284
316
|
JobRequest: () => JobRequest,
|
|
285
317
|
JobResult: () => JobResult,
|
|
286
318
|
Label: () => Label,
|
|
319
|
+
LegacyNsiteFile: () => LegacyNsiteFile,
|
|
287
320
|
LightningPubRPC: () => LightningPubRPC,
|
|
321
|
+
LinkSet: () => LinkSet,
|
|
288
322
|
LiveChatMessage: () => LiveChatMessage,
|
|
289
323
|
LiveEvent: () => LiveEvent,
|
|
290
324
|
LongFormArticle: () => LongFormArticle,
|
|
325
|
+
MarketplaceUI: () => MarketplaceUI,
|
|
326
|
+
MediaFollows: () => MediaFollows,
|
|
327
|
+
MediaStarterPacks: () => MediaStarterPacks,
|
|
328
|
+
MergeRequests: () => MergeRequests,
|
|
291
329
|
Metadata: () => Metadata,
|
|
330
|
+
ModularArticleContent: () => ModularArticleContent,
|
|
331
|
+
ModularArticleHeader: () => ModularArticleHeader,
|
|
332
|
+
MuteSets: () => MuteSets,
|
|
292
333
|
Mutelist: () => Mutelist,
|
|
293
334
|
NWCWalletInfo: () => NWCWalletInfo,
|
|
294
335
|
NWCWalletRequest: () => NWCWalletRequest,
|
|
295
336
|
NWCWalletResponse: () => NWCWalletResponse,
|
|
296
337
|
NormalVideo: () => NormalVideo,
|
|
297
338
|
NostrConnect: () => NostrConnect,
|
|
339
|
+
NsiteNamed: () => NsiteNamed,
|
|
340
|
+
NsiteRoot: () => NsiteRoot,
|
|
341
|
+
NutZap: () => NutZap,
|
|
342
|
+
NutZapInfo: () => NutZapInfo,
|
|
298
343
|
OpenTimestamps: () => OpenTimestamps,
|
|
344
|
+
Patch: () => Patch,
|
|
345
|
+
PeerToPeerOrderEvents: () => PeerToPeerOrderEvents,
|
|
299
346
|
Photo: () => Photo,
|
|
300
347
|
Pinlist: () => Pinlist,
|
|
348
|
+
PodcastEpisode: () => PodcastEpisode,
|
|
349
|
+
PodcastMetadata: () => PodcastMetadata,
|
|
301
350
|
Poll: () => Poll,
|
|
302
351
|
PollResponse: () => PollResponse,
|
|
303
352
|
PrivateDirectMessage: () => PrivateDirectMessage,
|
|
353
|
+
PrivateEventRelayList: () => PrivateEventRelayList,
|
|
304
354
|
ProblemTracker: () => ProblemTracker,
|
|
355
|
+
ProductSoldAsAuction: () => ProductSoldAsAuction,
|
|
305
356
|
ProfileBadges: () => ProfileBadges,
|
|
357
|
+
ProxyAnnouncement: () => ProxyAnnouncement,
|
|
306
358
|
PublicChatsList: () => PublicChatsList,
|
|
359
|
+
PublicMessage: () => PublicMessage,
|
|
307
360
|
Reaction: () => Reaction,
|
|
361
|
+
ReactionToWebsite: () => ReactionToWebsite,
|
|
308
362
|
RecommendRelay: () => RecommendRelay,
|
|
363
|
+
Redirects: () => Redirects,
|
|
364
|
+
RelayDiscovery: () => RelayDiscovery,
|
|
309
365
|
RelayList: () => RelayList,
|
|
366
|
+
RelayMonitorAnnouncement: () => RelayMonitorAnnouncement,
|
|
310
367
|
RelayReview: () => RelayReview,
|
|
368
|
+
RelayReviews: () => RelayReviews,
|
|
311
369
|
Relaysets: () => Relaysets,
|
|
370
|
+
ReleaseArtifactSets: () => ReleaseArtifactSets,
|
|
371
|
+
Reply: () => Reply,
|
|
312
372
|
Report: () => Report,
|
|
313
373
|
Reporting: () => Reporting,
|
|
374
|
+
RepositoryAnnouncement: () => RepositoryAnnouncement,
|
|
375
|
+
RepositoryState: () => RepositoryState,
|
|
314
376
|
Repost: () => Repost,
|
|
377
|
+
ReservedCashuWalletTokens: () => ReservedCashuWalletTokens,
|
|
378
|
+
RoomPresence: () => RoomPresence,
|
|
379
|
+
Scroll: () => Scroll,
|
|
315
380
|
Seal: () => Seal,
|
|
316
381
|
SearchRelaysList: () => SearchRelaysList,
|
|
317
382
|
ShortTextNote: () => ShortTextNote,
|
|
318
383
|
ShortVideo: () => ShortVideo,
|
|
384
|
+
SimpleGroupAdmins: () => SimpleGroupAdmins,
|
|
385
|
+
SimpleGroupCreateGroup: () => SimpleGroupCreateGroup,
|
|
386
|
+
SimpleGroupCreateInvite: () => SimpleGroupCreateInvite,
|
|
387
|
+
SimpleGroupDeleteEvent: () => SimpleGroupDeleteEvent,
|
|
388
|
+
SimpleGroupDeleteGroup: () => SimpleGroupDeleteGroup,
|
|
389
|
+
SimpleGroupEditMetadata: () => SimpleGroupEditMetadata,
|
|
390
|
+
SimpleGroupJoinRequest: () => SimpleGroupJoinRequest,
|
|
391
|
+
SimpleGroupLeaveRequest: () => SimpleGroupLeaveRequest,
|
|
392
|
+
SimpleGroupList: () => SimpleGroupList,
|
|
393
|
+
SimpleGroupLiveKitParticipants: () => SimpleGroupLiveKitParticipants,
|
|
394
|
+
SimpleGroupMembers: () => SimpleGroupMembers,
|
|
395
|
+
SimpleGroupPutUser: () => SimpleGroupPutUser,
|
|
396
|
+
SimpleGroupRemoveUser: () => SimpleGroupRemoveUser,
|
|
397
|
+
SimpleGroupReply: () => SimpleGroupReply,
|
|
398
|
+
SimpleGroupRoles: () => SimpleGroupRoles,
|
|
399
|
+
SimpleGroupThreadedReply: () => SimpleGroupThreadedReply,
|
|
400
|
+
SlideSet: () => SlideSet,
|
|
401
|
+
SoftwareApplication: () => SoftwareApplication,
|
|
402
|
+
StarterPacks: () => StarterPacks,
|
|
403
|
+
StatusApplied: () => StatusApplied,
|
|
404
|
+
StatusClosed: () => StatusClosed,
|
|
405
|
+
StatusDraft: () => StatusDraft,
|
|
406
|
+
StatusOpen: () => StatusOpen,
|
|
407
|
+
TidalLogin: () => TidalLogin,
|
|
319
408
|
Time: () => Time,
|
|
409
|
+
Torrent: () => Torrent,
|
|
410
|
+
TorrentComment: () => TorrentComment,
|
|
411
|
+
TransportMethodAnnouncement: () => TransportMethodAnnouncement,
|
|
320
412
|
UserEmojiList: () => UserEmojiList,
|
|
413
|
+
UserGraspList: () => UserGraspList,
|
|
321
414
|
UserStatuses: () => UserStatuses,
|
|
415
|
+
VideoViewEvent: () => VideoViewEvent,
|
|
322
416
|
Voice: () => Voice,
|
|
323
417
|
VoiceComment: () => VoiceComment,
|
|
418
|
+
WebBookmarks: () => WebBookmarks,
|
|
419
|
+
WikiArticle: () => WikiArticle,
|
|
324
420
|
Zap: () => Zap,
|
|
325
421
|
ZapGoal: () => ZapGoal,
|
|
326
422
|
ZapRequest: () => ZapRequest,
|
|
@@ -368,40 +464,83 @@ var Repost = 6;
|
|
|
368
464
|
var Reaction = 7;
|
|
369
465
|
var BadgeAward = 8;
|
|
370
466
|
var ChatMessage = 9;
|
|
467
|
+
var SimpleGroupThreadedReply = 10;
|
|
371
468
|
var ForumThread = 11;
|
|
469
|
+
var SimpleGroupReply = 12;
|
|
372
470
|
var Seal = 13;
|
|
373
471
|
var PrivateDirectMessage = 14;
|
|
374
472
|
var FileMessage = 15;
|
|
375
473
|
var GenericRepost = 16;
|
|
474
|
+
var ReactionToWebsite = 17;
|
|
376
475
|
var Photo = 20;
|
|
377
476
|
var NormalVideo = 21;
|
|
378
477
|
var ShortVideo = 22;
|
|
478
|
+
var PublicMessage = 24;
|
|
379
479
|
var ChannelCreation = 40;
|
|
380
480
|
var ChannelMetadata = 41;
|
|
381
481
|
var ChannelMessage = 42;
|
|
382
482
|
var ChannelHideMessage = 43;
|
|
383
483
|
var ChannelMuteUser = 44;
|
|
484
|
+
var PodcastEpisode = 54;
|
|
485
|
+
var Chess = 64;
|
|
486
|
+
var MergeRequests = 818;
|
|
487
|
+
var PollResponse = 1018;
|
|
488
|
+
var Bid = 1021;
|
|
489
|
+
var BidConfirmation = 1022;
|
|
384
490
|
var OpenTimestamps = 1040;
|
|
385
491
|
var GiftWrap = 1059;
|
|
386
|
-
var Poll = 1068;
|
|
387
492
|
var FileMetadata = 1063;
|
|
493
|
+
var Poll = 1068;
|
|
388
494
|
var Comment = 1111;
|
|
389
|
-
var LiveChatMessage = 1311;
|
|
390
495
|
var Voice = 1222;
|
|
496
|
+
var Scroll = 1227;
|
|
391
497
|
var VoiceComment = 1244;
|
|
498
|
+
var LiveChatMessage = 1311;
|
|
499
|
+
var CodeSnippet = 1337;
|
|
500
|
+
var Patch = 1617;
|
|
501
|
+
var GitPullRequest = 1618;
|
|
502
|
+
var GitPullRequestUpdate = 1619;
|
|
503
|
+
var Issue = 1621;
|
|
504
|
+
var Reply = 1622;
|
|
505
|
+
var StatusOpen = 1630;
|
|
506
|
+
var StatusApplied = 1631;
|
|
507
|
+
var StatusClosed = 1632;
|
|
508
|
+
var StatusDraft = 1633;
|
|
392
509
|
var ProblemTracker = 1971;
|
|
393
510
|
var Report = 1984;
|
|
394
511
|
var Reporting = 1984;
|
|
395
512
|
var Label = 1985;
|
|
513
|
+
var RelayReviews = 1986;
|
|
514
|
+
var AIEmbeddings = 1987;
|
|
515
|
+
var Torrent = 2003;
|
|
516
|
+
var TorrentComment = 2004;
|
|
517
|
+
var CoinjoinPool = 2022;
|
|
518
|
+
var DecoupledKeyClientAnnouncement = 4454;
|
|
519
|
+
var DecoupledEncryptionKeyDistribution = 4455;
|
|
396
520
|
var CommunityPostApproval = 4550;
|
|
397
521
|
var JobRequest = 5999;
|
|
398
522
|
var JobResult = 6999;
|
|
399
523
|
var JobFeedback = 7e3;
|
|
524
|
+
var ReservedCashuWalletTokens = 7374;
|
|
525
|
+
var CashuWalletTokens = 7375;
|
|
526
|
+
var CashuWalletHistory = 7376;
|
|
527
|
+
var GeocacheLog = 7516;
|
|
528
|
+
var GeocacheProofOfFind = 7517;
|
|
529
|
+
var SimpleGroupPutUser = 9e3;
|
|
530
|
+
var SimpleGroupRemoveUser = 9001;
|
|
531
|
+
var SimpleGroupEditMetadata = 9002;
|
|
532
|
+
var SimpleGroupDeleteEvent = 9005;
|
|
533
|
+
var SimpleGroupCreateGroup = 9007;
|
|
534
|
+
var SimpleGroupDeleteGroup = 9008;
|
|
535
|
+
var SimpleGroupCreateInvite = 9009;
|
|
536
|
+
var SimpleGroupJoinRequest = 9021;
|
|
537
|
+
var SimpleGroupLeaveRequest = 9022;
|
|
400
538
|
var ZapGoal = 9041;
|
|
539
|
+
var NutZap = 9321;
|
|
540
|
+
var TidalLogin = 9467;
|
|
401
541
|
var ZapRequest = 9734;
|
|
402
542
|
var Zap = 9735;
|
|
403
543
|
var Highlights = 9802;
|
|
404
|
-
var PollResponse = 1018;
|
|
405
544
|
var Mutelist = 1e4;
|
|
406
545
|
var Pinlist = 10001;
|
|
407
546
|
var RelayList = 10002;
|
|
@@ -410,37 +549,74 @@ var CommunitiesList = 10004;
|
|
|
410
549
|
var PublicChatsList = 10005;
|
|
411
550
|
var BlockedRelaysList = 10006;
|
|
412
551
|
var SearchRelaysList = 10007;
|
|
552
|
+
var SimpleGroupList = 10009;
|
|
413
553
|
var FavoriteRelays = 10012;
|
|
554
|
+
var PrivateEventRelayList = 10013;
|
|
414
555
|
var InterestsList = 10015;
|
|
556
|
+
var NutZapInfo = 10019;
|
|
557
|
+
var MediaFollows = 10020;
|
|
415
558
|
var UserEmojiList = 10030;
|
|
559
|
+
var DecoupledKeyAnnouncement = 10044;
|
|
416
560
|
var DirectMessageRelaysList = 10050;
|
|
417
|
-
var
|
|
561
|
+
var FavoritePodcasts = 10054;
|
|
418
562
|
var BlossomServerList = 10063;
|
|
563
|
+
var FileServerPreference = 10096;
|
|
564
|
+
var GoodWikiAuthorList = 10101;
|
|
565
|
+
var GoodWikiRelayList = 10102;
|
|
566
|
+
var PodcastMetadata = 10154;
|
|
567
|
+
var AuthoredPodcasts = 10164;
|
|
568
|
+
var RelayMonitorAnnouncement = 10166;
|
|
569
|
+
var RoomPresence = 10312;
|
|
570
|
+
var UserGraspList = 10317;
|
|
571
|
+
var ProxyAnnouncement = 10377;
|
|
572
|
+
var TransportMethodAnnouncement = 11111;
|
|
419
573
|
var NWCWalletInfo = 13194;
|
|
574
|
+
var NsiteRoot = 15128;
|
|
575
|
+
var CashuWalletEvent = 17375;
|
|
420
576
|
var LightningPubRPC = 21e3;
|
|
421
577
|
var ClientAuth = 22242;
|
|
422
578
|
var NWCWalletRequest = 23194;
|
|
423
579
|
var NWCWalletResponse = 23195;
|
|
424
580
|
var NostrConnect = 24133;
|
|
581
|
+
var BlobsAuth = 24242;
|
|
425
582
|
var HTTPAuth = 27235;
|
|
426
583
|
var Followsets = 3e4;
|
|
427
584
|
var Genericlists = 30001;
|
|
428
585
|
var Relaysets = 30002;
|
|
429
586
|
var Bookmarksets = 30003;
|
|
430
587
|
var Curationsets = 30004;
|
|
588
|
+
var CuratedVideoSets = 30005;
|
|
589
|
+
var MuteSets = 30007;
|
|
431
590
|
var ProfileBadges = 30008;
|
|
432
591
|
var BadgeDefinition = 30009;
|
|
433
592
|
var Interestsets = 30015;
|
|
434
593
|
var CreateOrUpdateStall = 30017;
|
|
435
594
|
var CreateOrUpdateProduct = 30018;
|
|
595
|
+
var MarketplaceUI = 30019;
|
|
596
|
+
var ProductSoldAsAuction = 30020;
|
|
436
597
|
var LongFormArticle = 30023;
|
|
437
598
|
var DraftLong = 30024;
|
|
438
599
|
var Emojisets = 30030;
|
|
600
|
+
var ModularArticleHeader = 30040;
|
|
601
|
+
var ModularArticleContent = 30041;
|
|
602
|
+
var ReleaseArtifactSets = 30063;
|
|
439
603
|
var Application = 30078;
|
|
604
|
+
var RelayDiscovery = 30166;
|
|
605
|
+
var AppCurationSet = 30267;
|
|
440
606
|
var LiveEvent = 30311;
|
|
607
|
+
var InteractiveRoom = 30312;
|
|
608
|
+
var ConferenceEvent = 30313;
|
|
441
609
|
var UserStatuses = 30315;
|
|
610
|
+
var SlideSet = 30388;
|
|
442
611
|
var ClassifiedListing = 30402;
|
|
443
612
|
var DraftClassifiedListing = 30403;
|
|
613
|
+
var RepositoryAnnouncement = 30617;
|
|
614
|
+
var RepositoryState = 30618;
|
|
615
|
+
var WikiArticle = 30818;
|
|
616
|
+
var Redirects = 30819;
|
|
617
|
+
var DraftEvent = 31234;
|
|
618
|
+
var LinkSet = 31388;
|
|
619
|
+
var Feed = 31890;
|
|
444
620
|
var Date2 = 31922;
|
|
445
621
|
var Time = 31923;
|
|
446
622
|
var Calendar = 31924;
|
|
@@ -448,8 +624,24 @@ var CalendarEventRSVP = 31925;
|
|
|
448
624
|
var RelayReview = 31987;
|
|
449
625
|
var Handlerrecommendation = 31989;
|
|
450
626
|
var Handlerinformation = 31990;
|
|
627
|
+
var SoftwareApplication = 32267;
|
|
628
|
+
var LegacyNsiteFile = 34128;
|
|
629
|
+
var VideoViewEvent = 34237;
|
|
451
630
|
var CommunityDefinition = 34550;
|
|
631
|
+
var NsiteNamed = 35128;
|
|
632
|
+
var GeocacheListing = 37515;
|
|
633
|
+
var GeocacheLogEntry = 37516;
|
|
634
|
+
var CashuMintAnnouncement = 38172;
|
|
635
|
+
var FedimintAnnouncement = 38173;
|
|
636
|
+
var PeerToPeerOrderEvents = 38383;
|
|
452
637
|
var GroupMetadata = 39e3;
|
|
638
|
+
var SimpleGroupAdmins = 39001;
|
|
639
|
+
var SimpleGroupMembers = 39002;
|
|
640
|
+
var SimpleGroupRoles = 39003;
|
|
641
|
+
var SimpleGroupLiveKitParticipants = 39004;
|
|
642
|
+
var StarterPacks = 39089;
|
|
643
|
+
var MediaStarterPacks = 39092;
|
|
644
|
+
var WebBookmarks = 39701;
|
|
453
645
|
|
|
454
646
|
// filter.ts
|
|
455
647
|
function matchFilter(filter, event) {
|
|
@@ -692,7 +884,9 @@ var AbstractRelay = class {
|
|
|
692
884
|
connectionTimeoutHandle = setTimeout(() => {
|
|
693
885
|
reject("connection timed out");
|
|
694
886
|
this.connectionPromise = void 0;
|
|
695
|
-
this.
|
|
887
|
+
if (this.reconnectAttempts === 0) {
|
|
888
|
+
this.skipReconnection = true;
|
|
889
|
+
}
|
|
696
890
|
this.onclose?.();
|
|
697
891
|
this.handleHardClose("relay connection timed out");
|
|
698
892
|
}, opts.timeout);
|
|
@@ -736,7 +930,9 @@ var AbstractRelay = class {
|
|
|
736
930
|
clearTimeout(connectionTimeoutHandle);
|
|
737
931
|
reject("connection failed");
|
|
738
932
|
this.connectionPromise = void 0;
|
|
739
|
-
this.
|
|
933
|
+
if (this.reconnectAttempts === 0) {
|
|
934
|
+
this.skipReconnection = true;
|
|
935
|
+
}
|
|
740
936
|
this.onclose?.();
|
|
741
937
|
this.handleHardClose("relay connection failed");
|
|
742
938
|
};
|
|
@@ -837,19 +1033,38 @@ var AbstractRelay = class {
|
|
|
837
1033
|
}, this.publishTimeout);
|
|
838
1034
|
this.openEventPublishes.set(event.id, { resolve, reject, timeout });
|
|
839
1035
|
});
|
|
840
|
-
|
|
1036
|
+
try {
|
|
1037
|
+
await this.send('["EVENT",' + JSON.stringify(event) + "]");
|
|
1038
|
+
} catch (err) {
|
|
1039
|
+
const ep = this.openEventPublishes.get(event.id);
|
|
1040
|
+
if (ep) {
|
|
1041
|
+
ep.reject(err);
|
|
1042
|
+
this.openEventPublishes.delete(event.id);
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
841
1045
|
this.ongoingOperations--;
|
|
842
1046
|
if (this.ongoingOperations === 0)
|
|
843
1047
|
this.idleSince = Date.now();
|
|
844
1048
|
return ret;
|
|
845
1049
|
}
|
|
846
1050
|
async count(filters, params) {
|
|
1051
|
+
return (await this.countWithHLL(filters, params)).count;
|
|
1052
|
+
}
|
|
1053
|
+
async countWithHLL(filters, params) {
|
|
847
1054
|
this.serial++;
|
|
848
1055
|
const id = params?.id || "count:" + this.serial;
|
|
849
1056
|
const ret = new Promise((resolve, reject) => {
|
|
850
1057
|
this.openCountRequests.set(id, { resolve, reject });
|
|
851
1058
|
});
|
|
852
|
-
|
|
1059
|
+
try {
|
|
1060
|
+
await this.send('["COUNT","' + id + '",' + JSON.stringify(filters).substring(1));
|
|
1061
|
+
} catch (err) {
|
|
1062
|
+
const cr = this.openCountRequests.get(id);
|
|
1063
|
+
if (cr) {
|
|
1064
|
+
cr.reject(err);
|
|
1065
|
+
this.openCountRequests.delete(id);
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
853
1068
|
return ret;
|
|
854
1069
|
}
|
|
855
1070
|
subscribe(filters, params) {
|
|
@@ -927,7 +1142,7 @@ var AbstractRelay = class {
|
|
|
927
1142
|
const payload = data[2];
|
|
928
1143
|
const cr = this.openCountRequests.get(id);
|
|
929
1144
|
if (cr) {
|
|
930
|
-
cr.resolve(payload
|
|
1145
|
+
cr.resolve(payload);
|
|
931
1146
|
this.openCountRequests.delete(id);
|
|
932
1147
|
}
|
|
933
1148
|
return;
|
|
@@ -957,8 +1172,14 @@ var AbstractRelay = class {
|
|
|
957
1172
|
case "CLOSED": {
|
|
958
1173
|
const id = data[1];
|
|
959
1174
|
const so = this.openSubs.get(id);
|
|
960
|
-
if (!so)
|
|
1175
|
+
if (!so) {
|
|
1176
|
+
const cr = this.openCountRequests.get(id);
|
|
1177
|
+
if (cr) {
|
|
1178
|
+
cr.reject(new Error(data[2]));
|
|
1179
|
+
this.openCountRequests.delete(id);
|
|
1180
|
+
}
|
|
961
1181
|
return;
|
|
1182
|
+
}
|
|
962
1183
|
so.closed = true;
|
|
963
1184
|
so.close(data[2]);
|
|
964
1185
|
return;
|
|
@@ -1084,6 +1305,63 @@ var alwaysTrue = (t) => {
|
|
|
1084
1305
|
return true;
|
|
1085
1306
|
};
|
|
1086
1307
|
|
|
1308
|
+
// nip45.ts
|
|
1309
|
+
import { sha256 as sha2562 } from "@noble/hashes/sha2.js";
|
|
1310
|
+
import { bytesToHex as bytesToHex3 } from "@noble/hashes/utils.js";
|
|
1311
|
+
var M = 256;
|
|
1312
|
+
var HLL_HEX_LENGTH = M * 2;
|
|
1313
|
+
var utf8Encoder2 = new TextEncoder();
|
|
1314
|
+
function getCountManyFilter(target, directive) {
|
|
1315
|
+
switch (directive) {
|
|
1316
|
+
case "reactions":
|
|
1317
|
+
return { "#e": [target], kinds: [7] };
|
|
1318
|
+
case "reposts":
|
|
1319
|
+
return { "#e": [target], kinds: [6] };
|
|
1320
|
+
case "quotes":
|
|
1321
|
+
return { "#q": [target], kinds: [1, 1111] };
|
|
1322
|
+
case "replies":
|
|
1323
|
+
return { "#e": [target], kinds: [1] };
|
|
1324
|
+
case "comments":
|
|
1325
|
+
return { "#E": [target], kinds: [1111] };
|
|
1326
|
+
case "followers":
|
|
1327
|
+
return { "#p": [target], kinds: [3] };
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
function newHll() {
|
|
1331
|
+
return new Uint8Array(M);
|
|
1332
|
+
}
|
|
1333
|
+
function hllDecode(hex) {
|
|
1334
|
+
if (hex.length !== HLL_HEX_LENGTH || !/^[0-9a-fA-F]+$/.test(hex))
|
|
1335
|
+
return void 0;
|
|
1336
|
+
const registers = new Uint8Array(M);
|
|
1337
|
+
for (let i2 = 0; i2 < M; i2++) {
|
|
1338
|
+
registers[i2] = parseInt(hex.slice(i2 * 2, i2 * 2 + 2), 16);
|
|
1339
|
+
}
|
|
1340
|
+
return registers;
|
|
1341
|
+
}
|
|
1342
|
+
function hllEncode(registers) {
|
|
1343
|
+
if (registers.length !== M)
|
|
1344
|
+
throw new Error(`invalid number of registers ${registers.length}`);
|
|
1345
|
+
let hex = "";
|
|
1346
|
+
for (let i2 = 0; i2 < M; i2++) {
|
|
1347
|
+
hex += registers[i2].toString(16).padStart(2, "0");
|
|
1348
|
+
}
|
|
1349
|
+
return hex;
|
|
1350
|
+
}
|
|
1351
|
+
function mergeHll(target, source) {
|
|
1352
|
+
if (target.length === 0)
|
|
1353
|
+
target = newHll();
|
|
1354
|
+
if (target.length !== M)
|
|
1355
|
+
throw new Error(`invalid number of registers ${target.length}`);
|
|
1356
|
+
if (source.length !== M)
|
|
1357
|
+
throw new Error(`invalid number of registers ${source.length}`);
|
|
1358
|
+
for (let i2 = 0; i2 < M; i2++) {
|
|
1359
|
+
if (source[i2] > target[i2])
|
|
1360
|
+
target[i2] = source[i2];
|
|
1361
|
+
}
|
|
1362
|
+
return target;
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1087
1365
|
// abstract-pool.ts
|
|
1088
1366
|
var AbstractSimplePool = class {
|
|
1089
1367
|
relays = /* @__PURE__ */ new Map();
|
|
@@ -1311,6 +1589,48 @@ var AbstractSimplePool = class {
|
|
|
1311
1589
|
events.sort((a, b) => b.created_at - a.created_at);
|
|
1312
1590
|
return events[0] || null;
|
|
1313
1591
|
}
|
|
1592
|
+
async countMany(relays, target, directive, params) {
|
|
1593
|
+
const filter = getCountManyFilter(target, directive);
|
|
1594
|
+
const urls = [];
|
|
1595
|
+
for (let i2 = 0; i2 < relays.length; i2++) {
|
|
1596
|
+
const url = normalizeURL(relays[i2]);
|
|
1597
|
+
if (urls.indexOf(url) === -1)
|
|
1598
|
+
urls.push(url);
|
|
1599
|
+
}
|
|
1600
|
+
const responses = await Promise.all(
|
|
1601
|
+
urls.map(async (url) => {
|
|
1602
|
+
if (this.allowConnectingToRelay?.(url, ["read", [filter]]) === false)
|
|
1603
|
+
return null;
|
|
1604
|
+
let relay;
|
|
1605
|
+
try {
|
|
1606
|
+
relay = await this.ensureRelay(url, {
|
|
1607
|
+
connectionTimeout: this.maxWaitForConnection < (params?.maxWait || 0) ? Math.max(params.maxWait * 0.8, params.maxWait - 1e3) : this.maxWaitForConnection,
|
|
1608
|
+
abort: params?.abort
|
|
1609
|
+
});
|
|
1610
|
+
} catch (err) {
|
|
1611
|
+
this.onRelayConnectionFailure?.(url);
|
|
1612
|
+
return null;
|
|
1613
|
+
}
|
|
1614
|
+
this.onRelayConnectionSuccess?.(url);
|
|
1615
|
+
return relay.countWithHLL([filter], { id: params?.id }).catch(() => null);
|
|
1616
|
+
})
|
|
1617
|
+
);
|
|
1618
|
+
let count = 0;
|
|
1619
|
+
let hll;
|
|
1620
|
+
for (const response of responses) {
|
|
1621
|
+
if (!response)
|
|
1622
|
+
continue;
|
|
1623
|
+
if (response.count > count)
|
|
1624
|
+
count = response.count;
|
|
1625
|
+
if (!response.hll || response.hll.length !== 512)
|
|
1626
|
+
continue;
|
|
1627
|
+
const registers = hllDecode(response.hll);
|
|
1628
|
+
if (!registers)
|
|
1629
|
+
continue;
|
|
1630
|
+
hll = mergeHll(hll || new Uint8Array(0), registers);
|
|
1631
|
+
}
|
|
1632
|
+
return hll ? { count, hll: hllEncode(hll) } : { count };
|
|
1633
|
+
}
|
|
1314
1634
|
publish(relays, event, params) {
|
|
1315
1635
|
return relays.map(normalizeURL).map(async (url, i2, arr) => {
|
|
1316
1636
|
if (arr.indexOf(url) !== i2) {
|
|
@@ -1398,7 +1718,7 @@ __export(nip19_exports, {
|
|
|
1398
1718
|
npubEncode: () => npubEncode,
|
|
1399
1719
|
nsecEncode: () => nsecEncode
|
|
1400
1720
|
});
|
|
1401
|
-
import { bytesToHex as
|
|
1721
|
+
import { bytesToHex as bytesToHex4, concatBytes, hexToBytes as hexToBytes3 } from "@noble/hashes/utils.js";
|
|
1402
1722
|
import { bech32 } from "@scure/base";
|
|
1403
1723
|
var NostrTypeGuard = {
|
|
1404
1724
|
isNProfile: (value) => /^nprofile1[a-z\d]+$/.test(value || ""),
|
|
@@ -1441,7 +1761,7 @@ function decode(code) {
|
|
|
1441
1761
|
return {
|
|
1442
1762
|
type: "nprofile",
|
|
1443
1763
|
data: {
|
|
1444
|
-
pubkey:
|
|
1764
|
+
pubkey: bytesToHex4(tlv[0][0]),
|
|
1445
1765
|
relays: tlv[1] ? tlv[1].map((d) => utf8Decoder.decode(d)) : []
|
|
1446
1766
|
}
|
|
1447
1767
|
};
|
|
@@ -1459,10 +1779,10 @@ function decode(code) {
|
|
|
1459
1779
|
return {
|
|
1460
1780
|
type: "nevent",
|
|
1461
1781
|
data: {
|
|
1462
|
-
id:
|
|
1782
|
+
id: bytesToHex4(tlv[0][0]),
|
|
1463
1783
|
relays: tlv[1] ? tlv[1].map((d) => utf8Decoder.decode(d)) : [],
|
|
1464
|
-
author: tlv[2]?.[0] ?
|
|
1465
|
-
kind: tlv[3]?.[0] ? parseInt(
|
|
1784
|
+
author: tlv[2]?.[0] ? bytesToHex4(tlv[2][0]) : void 0,
|
|
1785
|
+
kind: tlv[3]?.[0] ? parseInt(bytesToHex4(tlv[3][0]), 16) : void 0
|
|
1466
1786
|
}
|
|
1467
1787
|
};
|
|
1468
1788
|
}
|
|
@@ -1482,8 +1802,8 @@ function decode(code) {
|
|
|
1482
1802
|
type: "naddr",
|
|
1483
1803
|
data: {
|
|
1484
1804
|
identifier: utf8Decoder.decode(tlv[0][0]),
|
|
1485
|
-
pubkey:
|
|
1486
|
-
kind: parseInt(
|
|
1805
|
+
pubkey: bytesToHex4(tlv[2][0]),
|
|
1806
|
+
kind: parseInt(bytesToHex4(tlv[3][0]), 16),
|
|
1487
1807
|
relays: tlv[1] ? tlv[1].map((d) => utf8Decoder.decode(d)) : []
|
|
1488
1808
|
}
|
|
1489
1809
|
};
|
|
@@ -1492,7 +1812,7 @@ function decode(code) {
|
|
|
1492
1812
|
return { type: prefix, data };
|
|
1493
1813
|
case "npub":
|
|
1494
1814
|
case "note":
|
|
1495
|
-
return { type: prefix, data:
|
|
1815
|
+
return { type: prefix, data: bytesToHex4(data) };
|
|
1496
1816
|
default:
|
|
1497
1817
|
throw new Error(`unknown prefix ${prefix}`);
|
|
1498
1818
|
}
|
|
@@ -1501,6 +1821,8 @@ function parseTLV(data) {
|
|
|
1501
1821
|
let result = {};
|
|
1502
1822
|
let rest = data;
|
|
1503
1823
|
while (rest.length > 0) {
|
|
1824
|
+
if (rest.length < 2)
|
|
1825
|
+
throw new Error("not enough data to read TLV");
|
|
1504
1826
|
let t = rest[0];
|
|
1505
1827
|
let l = rest[1];
|
|
1506
1828
|
let v = rest.slice(2, 2 + l);
|
|
@@ -1759,6 +2081,7 @@ var nip10_exports = {};
|
|
|
1759
2081
|
__export(nip10_exports, {
|
|
1760
2082
|
parse: () => parse
|
|
1761
2083
|
});
|
|
2084
|
+
var HEX64 = /^[0-9a-fA-F]{64}$/;
|
|
1762
2085
|
function parse(event) {
|
|
1763
2086
|
const result = {
|
|
1764
2087
|
reply: void 0,
|
|
@@ -1771,12 +2094,12 @@ function parse(event) {
|
|
|
1771
2094
|
let maybeRoot;
|
|
1772
2095
|
for (let i2 = event.tags.length - 1; i2 >= 0; i2--) {
|
|
1773
2096
|
const tag = event.tags[i2];
|
|
1774
|
-
if (tag[0] === "e" && tag[1]) {
|
|
2097
|
+
if (tag[0] === "e" && tag[1] && HEX64.test(tag[1])) {
|
|
1775
2098
|
const [_, eTagEventId, eTagRelayUrl, eTagMarker, eTagAuthor] = tag;
|
|
1776
2099
|
const eventPointer = {
|
|
1777
2100
|
id: eTagEventId,
|
|
1778
2101
|
relays: eTagRelayUrl ? [eTagRelayUrl] : [],
|
|
1779
|
-
author: eTagAuthor
|
|
2102
|
+
author: eTagAuthor && HEX64.test(eTagAuthor) ? eTagAuthor : void 0
|
|
1780
2103
|
};
|
|
1781
2104
|
if (eTagMarker === "root") {
|
|
1782
2105
|
result.root = eventPointer;
|
|
@@ -1798,14 +2121,14 @@ function parse(event) {
|
|
|
1798
2121
|
result.mentions.push(eventPointer);
|
|
1799
2122
|
continue;
|
|
1800
2123
|
}
|
|
1801
|
-
if (tag[0] === "q" && tag[1]) {
|
|
2124
|
+
if (tag[0] === "q" && tag[1] && HEX64.test(tag[1])) {
|
|
1802
2125
|
const [_, eTagEventId, eTagRelayUrl] = tag;
|
|
1803
2126
|
result.quotes.push({
|
|
1804
2127
|
id: eTagEventId,
|
|
1805
2128
|
relays: eTagRelayUrl ? [eTagRelayUrl] : []
|
|
1806
2129
|
});
|
|
1807
2130
|
}
|
|
1808
|
-
if (tag[0] === "p" && tag[1]) {
|
|
2131
|
+
if (tag[0] === "p" && tag[1] && HEX64.test(tag[1])) {
|
|
1809
2132
|
result.profiles.push({
|
|
1810
2133
|
pubkey: tag[1],
|
|
1811
2134
|
relays: tag[2] ? [tag[2]] : []
|
|
@@ -1885,8 +2208,8 @@ __export(nip13_exports, {
|
|
|
1885
2208
|
getPow: () => getPow,
|
|
1886
2209
|
minePow: () => minePow
|
|
1887
2210
|
});
|
|
1888
|
-
import { bytesToHex as
|
|
1889
|
-
import { sha256 as
|
|
2211
|
+
import { bytesToHex as bytesToHex5 } from "@noble/hashes/utils.js";
|
|
2212
|
+
import { sha256 as sha2563 } from "@noble/hashes/sha2.js";
|
|
1890
2213
|
function getPow(hex) {
|
|
1891
2214
|
let count = 0;
|
|
1892
2215
|
for (let i2 = 0; i2 < 64; i2 += 8) {
|
|
@@ -1925,11 +2248,11 @@ function minePow(unsigned, difficulty) {
|
|
|
1925
2248
|
event.created_at = now2;
|
|
1926
2249
|
}
|
|
1927
2250
|
tag[1] = (++count).toString();
|
|
1928
|
-
const hash =
|
|
2251
|
+
const hash = sha2563(
|
|
1929
2252
|
utf8Encoder.encode(JSON.stringify([0, event.pubkey, event.created_at, event.kind, event.tags, event.content]))
|
|
1930
2253
|
);
|
|
1931
2254
|
if (getPowFromBytes(hash) >= difficulty) {
|
|
1932
|
-
event.id =
|
|
2255
|
+
event.id = bytesToHex5(hash);
|
|
1933
2256
|
break;
|
|
1934
2257
|
}
|
|
1935
2258
|
}
|
|
@@ -1970,7 +2293,7 @@ import { equalBytes } from "@noble/ciphers/utils.js";
|
|
|
1970
2293
|
import { secp256k1 as secp256k12 } from "@noble/curves/secp256k1.js";
|
|
1971
2294
|
import { extract as hkdf_extract, expand as hkdf_expand } from "@noble/hashes/hkdf.js";
|
|
1972
2295
|
import { hmac } from "@noble/hashes/hmac.js";
|
|
1973
|
-
import { sha256 as
|
|
2296
|
+
import { sha256 as sha2564 } from "@noble/hashes/sha2.js";
|
|
1974
2297
|
import { concatBytes as concatBytes2, hexToBytes as hexToBytes5, randomBytes as randomBytes2 } from "@noble/hashes/utils.js";
|
|
1975
2298
|
import { base64 as base642 } from "@scure/base";
|
|
1976
2299
|
var minPlaintextSize = 1;
|
|
@@ -1978,10 +2301,10 @@ var maxPlaintextSize = 4294967295;
|
|
|
1978
2301
|
var extendedPrefixThreshold = 65536;
|
|
1979
2302
|
function getConversationKey(privkeyA, pubkeyB) {
|
|
1980
2303
|
const sharedX = secp256k12.getSharedSecret(privkeyA, hexToBytes5("02" + pubkeyB)).subarray(1, 33);
|
|
1981
|
-
return hkdf_extract(
|
|
2304
|
+
return hkdf_extract(sha2564, sharedX, utf8Encoder.encode("nip44-v2"));
|
|
1982
2305
|
}
|
|
1983
2306
|
function getMessageKeys(conversationKey, nonce) {
|
|
1984
|
-
const keys = hkdf_expand(
|
|
2307
|
+
const keys = hkdf_expand(sha2564, conversationKey, nonce, 76);
|
|
1985
2308
|
return {
|
|
1986
2309
|
chacha_key: keys.subarray(0, 32),
|
|
1987
2310
|
chacha_nonce: keys.subarray(32, 44),
|
|
@@ -2043,7 +2366,7 @@ function hmacAad(key, message, aad) {
|
|
|
2043
2366
|
if (aad.length !== 32)
|
|
2044
2367
|
throw new Error("AAD associated data must be 32 bytes");
|
|
2045
2368
|
const combined = concatBytes2(aad, message);
|
|
2046
|
-
return hmac(
|
|
2369
|
+
return hmac(sha2564, key, combined);
|
|
2047
2370
|
}
|
|
2048
2371
|
function decodePayload(payload) {
|
|
2049
2372
|
if (typeof payload !== "string")
|
|
@@ -2302,6 +2625,7 @@ var nip22_exports = {};
|
|
|
2302
2625
|
__export(nip22_exports, {
|
|
2303
2626
|
parse: () => parse3
|
|
2304
2627
|
});
|
|
2628
|
+
var HEX642 = /^[0-9a-fA-F]{64}$/;
|
|
2305
2629
|
function parseKind(kind) {
|
|
2306
2630
|
if (!kind)
|
|
2307
2631
|
return void 0;
|
|
@@ -2315,9 +2639,12 @@ function parseAddressPointer(value, relayUrl) {
|
|
|
2315
2639
|
const kind = parseInt(value.slice(0, idx), 10);
|
|
2316
2640
|
if (Number.isNaN(kind))
|
|
2317
2641
|
return void 0;
|
|
2642
|
+
const pubkey = value.slice(idx + 1, idx2);
|
|
2643
|
+
if (!HEX642.test(pubkey))
|
|
2644
|
+
return void 0;
|
|
2318
2645
|
return {
|
|
2319
2646
|
kind,
|
|
2320
|
-
pubkey
|
|
2647
|
+
pubkey,
|
|
2321
2648
|
identifier: value.slice(idx2 + 1),
|
|
2322
2649
|
relays: relayUrl ? [relayUrl] : []
|
|
2323
2650
|
};
|
|
@@ -2326,12 +2653,12 @@ function parsePointer(tag) {
|
|
|
2326
2653
|
switch (tag[0]) {
|
|
2327
2654
|
case "E":
|
|
2328
2655
|
case "e":
|
|
2329
|
-
if (!tag[1])
|
|
2656
|
+
if (!tag[1] || !HEX642.test(tag[1]))
|
|
2330
2657
|
return void 0;
|
|
2331
2658
|
return {
|
|
2332
2659
|
id: tag[1],
|
|
2333
2660
|
relays: tag[2] ? [tag[2]] : [],
|
|
2334
|
-
author: tag[3]
|
|
2661
|
+
author: tag[3] && HEX642.test(tag[3]) ? tag[3] : void 0
|
|
2335
2662
|
};
|
|
2336
2663
|
case "A":
|
|
2337
2664
|
case "a":
|
|
@@ -2354,10 +2681,12 @@ function parseQuote(tag) {
|
|
|
2354
2681
|
if (tag[1].includes(":")) {
|
|
2355
2682
|
return parseAddressPointer(tag[1], tag[2]);
|
|
2356
2683
|
}
|
|
2684
|
+
if (!HEX642.test(tag[1]))
|
|
2685
|
+
return void 0;
|
|
2357
2686
|
return {
|
|
2358
2687
|
id: tag[1],
|
|
2359
2688
|
relays: tag[2] ? [tag[2]] : [],
|
|
2360
|
-
author: tag[3]
|
|
2689
|
+
author: tag[3] && HEX642.test(tag[3]) ? tag[3] : void 0
|
|
2361
2690
|
};
|
|
2362
2691
|
}
|
|
2363
2692
|
function choosePointer(candidates) {
|
|
@@ -2417,7 +2746,7 @@ function parse3(event) {
|
|
|
2417
2746
|
result.quotes.push(pointer);
|
|
2418
2747
|
continue;
|
|
2419
2748
|
}
|
|
2420
|
-
if ((tag[0] === "P" || tag[0] === "p") && tag[1]) {
|
|
2749
|
+
if ((tag[0] === "P" || tag[0] === "p") && tag[1] && HEX642.test(tag[1])) {
|
|
2421
2750
|
result.profiles.push({
|
|
2422
2751
|
pubkey: tag[1],
|
|
2423
2752
|
relays: tag[2] ? [tag[2]] : []
|
|
@@ -2996,8 +3325,8 @@ __export(nip77_exports, {
|
|
|
2996
3325
|
NegentropyStorageVector: () => NegentropyStorageVector,
|
|
2997
3326
|
NegentropySync: () => NegentropySync
|
|
2998
3327
|
});
|
|
2999
|
-
import { bytesToHex as
|
|
3000
|
-
import { sha256 as
|
|
3328
|
+
import { bytesToHex as bytesToHex6, hexToBytes as hexToBytes6 } from "@noble/hashes/utils.js";
|
|
3329
|
+
import { sha256 as sha2565 } from "@noble/hashes/sha2.js";
|
|
3001
3330
|
var PROTOCOL_VERSION = 97;
|
|
3002
3331
|
var ID_SIZE = 32;
|
|
3003
3332
|
var FINGERPRINT_SIZE = 16;
|
|
@@ -3128,7 +3457,7 @@ var Accumulator = class {
|
|
|
3128
3457
|
let input = new WrappedBuffer();
|
|
3129
3458
|
input.extend(this.buf);
|
|
3130
3459
|
input.extend(encodeVarInt(n));
|
|
3131
|
-
let hash =
|
|
3460
|
+
let hash = sha2565(input.unwrap());
|
|
3132
3461
|
return hash.subarray(0, FINGERPRINT_SIZE);
|
|
3133
3462
|
}
|
|
3134
3463
|
};
|
|
@@ -3236,7 +3565,7 @@ var Negentropy = class {
|
|
|
3236
3565
|
let output = new WrappedBuffer();
|
|
3237
3566
|
output.extend(new Uint8Array([PROTOCOL_VERSION]));
|
|
3238
3567
|
this.splitRange(0, this.storage.size(), this._bound(Number.MAX_VALUE), output);
|
|
3239
|
-
return
|
|
3568
|
+
return bytesToHex6(output.unwrap());
|
|
3240
3569
|
}
|
|
3241
3570
|
reconcile(queryMsg, onhave, onneed) {
|
|
3242
3571
|
const query = new WrappedBuffer(hexToBytes6(queryMsg));
|
|
@@ -3282,22 +3611,22 @@ var Negentropy = class {
|
|
|
3282
3611
|
let theirElems = {};
|
|
3283
3612
|
for (let i2 = 0; i2 < numIds; i2++) {
|
|
3284
3613
|
let e = getBytes(query, ID_SIZE);
|
|
3285
|
-
theirElems[
|
|
3614
|
+
theirElems[bytesToHex6(e)] = e;
|
|
3286
3615
|
}
|
|
3287
3616
|
skip = true;
|
|
3288
3617
|
this.storage.iterate(lower, upper, (item) => {
|
|
3289
3618
|
let k = item.id;
|
|
3290
|
-
const id =
|
|
3619
|
+
const id = bytesToHex6(k);
|
|
3291
3620
|
if (!theirElems[id]) {
|
|
3292
3621
|
onhave?.(id);
|
|
3293
3622
|
} else {
|
|
3294
|
-
delete theirElems[
|
|
3623
|
+
delete theirElems[bytesToHex6(k)];
|
|
3295
3624
|
}
|
|
3296
3625
|
return true;
|
|
3297
3626
|
});
|
|
3298
3627
|
if (onneed) {
|
|
3299
3628
|
for (let v of Object.values(theirElems)) {
|
|
3300
|
-
onneed(
|
|
3629
|
+
onneed(bytesToHex6(v));
|
|
3301
3630
|
}
|
|
3302
3631
|
}
|
|
3303
3632
|
} else {
|
|
@@ -3315,7 +3644,7 @@ var Negentropy = class {
|
|
|
3315
3644
|
prevIndex = upper;
|
|
3316
3645
|
prevBound = currBound;
|
|
3317
3646
|
}
|
|
3318
|
-
return fullOutput.length === 1 ? null :
|
|
3647
|
+
return fullOutput.length === 1 ? null : bytesToHex6(fullOutput.unwrap());
|
|
3319
3648
|
}
|
|
3320
3649
|
splitRange(lower, upper, upperBound, o) {
|
|
3321
3650
|
let numElems = upper - lower;
|
|
@@ -3503,8 +3832,8 @@ __export(nip98_exports, {
|
|
|
3503
3832
|
validateEventUrlTag: () => validateEventUrlTag,
|
|
3504
3833
|
validateToken: () => validateToken
|
|
3505
3834
|
});
|
|
3506
|
-
import { sha256 as
|
|
3507
|
-
import { bytesToHex as
|
|
3835
|
+
import { sha256 as sha2566 } from "@noble/hashes/sha2.js";
|
|
3836
|
+
import { bytesToHex as bytesToHex7 } from "@noble/hashes/utils.js";
|
|
3508
3837
|
import { base64 as base643 } from "@scure/base";
|
|
3509
3838
|
var _authorizationScheme = "Nostr ";
|
|
3510
3839
|
async function getToken(loginUrl, httpMethod, sign, includeAuthorizationScheme = false, payload) {
|
|
@@ -3569,8 +3898,8 @@ function validateEventMethodTag(event, method) {
|
|
|
3569
3898
|
return methodTag.length > 0 && methodTag[1].toLowerCase() === method.toLowerCase();
|
|
3570
3899
|
}
|
|
3571
3900
|
function hashPayload(payload) {
|
|
3572
|
-
const hash =
|
|
3573
|
-
return
|
|
3901
|
+
const hash = sha2566(utf8Encoder.encode(JSON.stringify(payload)));
|
|
3902
|
+
return bytesToHex7(hash);
|
|
3574
3903
|
}
|
|
3575
3904
|
function validateEventPayloadTag(event, payload) {
|
|
3576
3905
|
const payloadTag = event.tags.find((t) => t[0] === "payload");
|