nostr-tools 2.23.8 → 2.23.9

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.
Files changed (73) hide show
  1. package/lib/cjs/abstract-pool.js +128 -4
  2. package/lib/cjs/abstract-pool.js.map +4 -4
  3. package/lib/cjs/abstract-relay.js +29 -4
  4. package/lib/cjs/abstract-relay.js.map +2 -2
  5. package/lib/cjs/filter.js.map +1 -1
  6. package/lib/cjs/index.js +377 -61
  7. package/lib/cjs/index.js.map +4 -4
  8. package/lib/cjs/kinds.js +196 -4
  9. package/lib/cjs/kinds.js.map +2 -2
  10. package/lib/cjs/nip17.js.map +2 -2
  11. package/lib/cjs/nip18.js.map +2 -2
  12. package/lib/cjs/nip25.js.map +1 -1
  13. package/lib/cjs/nip28.js.map +2 -2
  14. package/lib/cjs/nip42.js.map +2 -2
  15. package/lib/cjs/nip45.js +183 -0
  16. package/lib/cjs/nip45.js.map +7 -0
  17. package/lib/cjs/nip46.js +128 -4
  18. package/lib/cjs/nip46.js.map +4 -4
  19. package/lib/cjs/nip47.js.map +2 -2
  20. package/lib/cjs/nip57.js.map +1 -1
  21. package/lib/cjs/nip58.js.map +2 -2
  22. package/lib/cjs/nip59.js.map +2 -2
  23. package/lib/cjs/nip75.js.map +2 -2
  24. package/lib/cjs/nip94.js.map +2 -2
  25. package/lib/cjs/nip98.js.map +2 -2
  26. package/lib/cjs/nip99.js.map +2 -2
  27. package/lib/cjs/nipb0.js +1064 -0
  28. package/lib/cjs/nipb0.js.map +7 -0
  29. package/lib/cjs/pool.js +128 -4
  30. package/lib/cjs/pool.js.map +4 -4
  31. package/lib/cjs/relay.js +29 -4
  32. package/lib/cjs/relay.js.map +2 -2
  33. package/lib/esm/abstract-pool.js +128 -4
  34. package/lib/esm/abstract-pool.js.map +4 -4
  35. package/lib/esm/abstract-relay.js +29 -4
  36. package/lib/esm/abstract-relay.js.map +2 -2
  37. package/lib/esm/filter.js.map +1 -1
  38. package/lib/esm/index.js +353 -37
  39. package/lib/esm/index.js.map +4 -4
  40. package/lib/esm/kinds.js +196 -4
  41. package/lib/esm/kinds.js.map +2 -2
  42. package/lib/esm/nip17.js.map +2 -2
  43. package/lib/esm/nip18.js.map +2 -2
  44. package/lib/esm/nip25.js.map +1 -1
  45. package/lib/esm/nip28.js.map +2 -2
  46. package/lib/esm/nip42.js.map +2 -2
  47. package/lib/esm/nip45.js +162 -0
  48. package/lib/esm/nip45.js.map +7 -0
  49. package/lib/esm/nip46.js +128 -4
  50. package/lib/esm/nip46.js.map +4 -4
  51. package/lib/esm/nip47.js.map +2 -2
  52. package/lib/esm/nip57.js.map +1 -1
  53. package/lib/esm/nip58.js.map +2 -2
  54. package/lib/esm/nip59.js.map +2 -2
  55. package/lib/esm/nip75.js.map +2 -2
  56. package/lib/esm/nip94.js.map +2 -2
  57. package/lib/esm/nip98.js.map +2 -2
  58. package/lib/esm/nip99.js.map +2 -2
  59. package/lib/esm/nipb0.js +1049 -0
  60. package/lib/esm/nipb0.js.map +7 -0
  61. package/lib/esm/pool.js +128 -4
  62. package/lib/esm/pool.js.map +4 -4
  63. package/lib/esm/relay.js +29 -4
  64. package/lib/esm/relay.js.map +2 -2
  65. package/lib/nostr.bundle.js +326 -12
  66. package/lib/nostr.bundle.js.map +4 -4
  67. package/lib/types/abstract-pool.d.ts +9 -0
  68. package/lib/types/abstract-relay.d.ts +10 -1
  69. package/lib/types/kinds.d.ts +200 -8
  70. package/lib/types/nip45.d.ts +13 -0
  71. package/lib/types/nip45.test.d.ts +1 -0
  72. package/lib/types/nipb0.d.ts +129 -0
  73. package/package.json +13 -1
package/lib/cjs/index.js CHANGED
@@ -293,39 +293,61 @@ var verifyEvent = i.verifyEvent;
293
293
  // kinds.ts
294
294
  var kinds_exports = {};
295
295
  __export(kinds_exports, {
296
+ AIEmbeddings: () => AIEmbeddings,
297
+ AppCurationSet: () => AppCurationSet,
296
298
  Application: () => Application,
299
+ AuthoredPodcasts: () => AuthoredPodcasts,
297
300
  BadgeAward: () => BadgeAward,
298
301
  BadgeDefinition: () => BadgeDefinition,
302
+ Bid: () => Bid,
303
+ BidConfirmation: () => BidConfirmation,
304
+ BlobsAuth: () => BlobsAuth,
299
305
  BlockedRelaysList: () => BlockedRelaysList,
300
306
  BlossomServerList: () => BlossomServerList,
301
307
  BookmarkList: () => BookmarkList,
302
308
  Bookmarksets: () => Bookmarksets,
303
309
  Calendar: () => Calendar,
304
310
  CalendarEventRSVP: () => CalendarEventRSVP,
311
+ CashuMintAnnouncement: () => CashuMintAnnouncement,
312
+ CashuWalletEvent: () => CashuWalletEvent,
313
+ CashuWalletHistory: () => CashuWalletHistory,
314
+ CashuWalletTokens: () => CashuWalletTokens,
305
315
  ChannelCreation: () => ChannelCreation,
306
316
  ChannelHideMessage: () => ChannelHideMessage,
307
317
  ChannelMessage: () => ChannelMessage,
308
318
  ChannelMetadata: () => ChannelMetadata,
309
319
  ChannelMuteUser: () => ChannelMuteUser,
310
320
  ChatMessage: () => ChatMessage,
321
+ Chess: () => Chess,
311
322
  ClassifiedListing: () => ClassifiedListing,
312
323
  ClientAuth: () => ClientAuth,
324
+ CodeSnippet: () => CodeSnippet,
325
+ CoinjoinPool: () => CoinjoinPool,
313
326
  Comment: () => Comment,
314
327
  CommunitiesList: () => CommunitiesList,
315
328
  CommunityDefinition: () => CommunityDefinition,
316
329
  CommunityPostApproval: () => CommunityPostApproval,
330
+ ConferenceEvent: () => ConferenceEvent,
317
331
  Contacts: () => Contacts,
318
332
  CreateOrUpdateProduct: () => CreateOrUpdateProduct,
319
333
  CreateOrUpdateStall: () => CreateOrUpdateStall,
334
+ CuratedVideoSets: () => CuratedVideoSets,
320
335
  Curationsets: () => Curationsets,
321
336
  Date: () => Date2,
337
+ DecoupledEncryptionKeyDistribution: () => DecoupledEncryptionKeyDistribution,
338
+ DecoupledKeyAnnouncement: () => DecoupledKeyAnnouncement,
339
+ DecoupledKeyClientAnnouncement: () => DecoupledKeyClientAnnouncement,
322
340
  DirectMessageRelaysList: () => DirectMessageRelaysList,
323
341
  DraftClassifiedListing: () => DraftClassifiedListing,
342
+ DraftEvent: () => DraftEvent,
324
343
  DraftLong: () => DraftLong,
325
344
  Emojisets: () => Emojisets,
326
345
  EncryptedDirectMessage: () => EncryptedDirectMessage,
327
346
  EventDeletion: () => EventDeletion,
347
+ FavoritePodcasts: () => FavoritePodcasts,
328
348
  FavoriteRelays: () => FavoriteRelays,
349
+ FedimintAnnouncement: () => FedimintAnnouncement,
350
+ Feed: () => Feed,
329
351
  FileMessage: () => FileMessage,
330
352
  FileMetadata: () => FileMetadata,
331
353
  FileServerPreference: () => FileServerPreference,
@@ -333,55 +355,129 @@ __export(kinds_exports, {
333
355
  ForumThread: () => ForumThread,
334
356
  GenericRepost: () => GenericRepost,
335
357
  Genericlists: () => Genericlists,
358
+ GeocacheListing: () => GeocacheListing,
359
+ GeocacheLog: () => GeocacheLog,
360
+ GeocacheLogEntry: () => GeocacheLogEntry,
361
+ GeocacheProofOfFind: () => GeocacheProofOfFind,
336
362
  GiftWrap: () => GiftWrap,
363
+ GitPullRequest: () => GitPullRequest,
364
+ GitPullRequestUpdate: () => GitPullRequestUpdate,
365
+ GoodWikiAuthorList: () => GoodWikiAuthorList,
366
+ GoodWikiRelayList: () => GoodWikiRelayList,
337
367
  GroupMetadata: () => GroupMetadata,
338
368
  HTTPAuth: () => HTTPAuth,
339
369
  Handlerinformation: () => Handlerinformation,
340
370
  Handlerrecommendation: () => Handlerrecommendation,
341
371
  Highlights: () => Highlights,
372
+ InteractiveRoom: () => InteractiveRoom,
342
373
  InterestsList: () => InterestsList,
343
374
  Interestsets: () => Interestsets,
375
+ Issue: () => Issue,
344
376
  JobFeedback: () => JobFeedback,
345
377
  JobRequest: () => JobRequest,
346
378
  JobResult: () => JobResult,
347
379
  Label: () => Label,
380
+ LegacyNsiteFile: () => LegacyNsiteFile,
348
381
  LightningPubRPC: () => LightningPubRPC,
382
+ LinkSet: () => LinkSet,
349
383
  LiveChatMessage: () => LiveChatMessage,
350
384
  LiveEvent: () => LiveEvent,
351
385
  LongFormArticle: () => LongFormArticle,
386
+ MarketplaceUI: () => MarketplaceUI,
387
+ MediaFollows: () => MediaFollows,
388
+ MediaStarterPacks: () => MediaStarterPacks,
389
+ MergeRequests: () => MergeRequests,
352
390
  Metadata: () => Metadata,
391
+ ModularArticleContent: () => ModularArticleContent,
392
+ ModularArticleHeader: () => ModularArticleHeader,
393
+ MuteSets: () => MuteSets,
353
394
  Mutelist: () => Mutelist,
354
395
  NWCWalletInfo: () => NWCWalletInfo,
355
396
  NWCWalletRequest: () => NWCWalletRequest,
356
397
  NWCWalletResponse: () => NWCWalletResponse,
357
398
  NormalVideo: () => NormalVideo,
358
399
  NostrConnect: () => NostrConnect,
400
+ NsiteNamed: () => NsiteNamed,
401
+ NsiteRoot: () => NsiteRoot,
402
+ NutZap: () => NutZap,
403
+ NutZapInfo: () => NutZapInfo,
359
404
  OpenTimestamps: () => OpenTimestamps,
405
+ Patch: () => Patch,
406
+ PeerToPeerOrderEvents: () => PeerToPeerOrderEvents,
360
407
  Photo: () => Photo,
361
408
  Pinlist: () => Pinlist,
409
+ PodcastEpisode: () => PodcastEpisode,
410
+ PodcastMetadata: () => PodcastMetadata,
362
411
  Poll: () => Poll,
363
412
  PollResponse: () => PollResponse,
364
413
  PrivateDirectMessage: () => PrivateDirectMessage,
414
+ PrivateEventRelayList: () => PrivateEventRelayList,
365
415
  ProblemTracker: () => ProblemTracker,
416
+ ProductSoldAsAuction: () => ProductSoldAsAuction,
366
417
  ProfileBadges: () => ProfileBadges,
418
+ ProxyAnnouncement: () => ProxyAnnouncement,
367
419
  PublicChatsList: () => PublicChatsList,
420
+ PublicMessage: () => PublicMessage,
368
421
  Reaction: () => Reaction,
422
+ ReactionToWebsite: () => ReactionToWebsite,
369
423
  RecommendRelay: () => RecommendRelay,
424
+ Redirects: () => Redirects,
425
+ RelayDiscovery: () => RelayDiscovery,
370
426
  RelayList: () => RelayList,
427
+ RelayMonitorAnnouncement: () => RelayMonitorAnnouncement,
371
428
  RelayReview: () => RelayReview,
429
+ RelayReviews: () => RelayReviews,
372
430
  Relaysets: () => Relaysets,
431
+ ReleaseArtifactSets: () => ReleaseArtifactSets,
432
+ Reply: () => Reply,
373
433
  Report: () => Report,
374
434
  Reporting: () => Reporting,
435
+ RepositoryAnnouncement: () => RepositoryAnnouncement,
436
+ RepositoryState: () => RepositoryState,
375
437
  Repost: () => Repost,
438
+ ReservedCashuWalletTokens: () => ReservedCashuWalletTokens,
439
+ RoomPresence: () => RoomPresence,
440
+ Scroll: () => Scroll,
376
441
  Seal: () => Seal,
377
442
  SearchRelaysList: () => SearchRelaysList,
378
443
  ShortTextNote: () => ShortTextNote,
379
444
  ShortVideo: () => ShortVideo,
445
+ SimpleGroupAdmins: () => SimpleGroupAdmins,
446
+ SimpleGroupCreateGroup: () => SimpleGroupCreateGroup,
447
+ SimpleGroupCreateInvite: () => SimpleGroupCreateInvite,
448
+ SimpleGroupDeleteEvent: () => SimpleGroupDeleteEvent,
449
+ SimpleGroupDeleteGroup: () => SimpleGroupDeleteGroup,
450
+ SimpleGroupEditMetadata: () => SimpleGroupEditMetadata,
451
+ SimpleGroupJoinRequest: () => SimpleGroupJoinRequest,
452
+ SimpleGroupLeaveRequest: () => SimpleGroupLeaveRequest,
453
+ SimpleGroupList: () => SimpleGroupList,
454
+ SimpleGroupLiveKitParticipants: () => SimpleGroupLiveKitParticipants,
455
+ SimpleGroupMembers: () => SimpleGroupMembers,
456
+ SimpleGroupPutUser: () => SimpleGroupPutUser,
457
+ SimpleGroupRemoveUser: () => SimpleGroupRemoveUser,
458
+ SimpleGroupReply: () => SimpleGroupReply,
459
+ SimpleGroupRoles: () => SimpleGroupRoles,
460
+ SimpleGroupThreadedReply: () => SimpleGroupThreadedReply,
461
+ SlideSet: () => SlideSet,
462
+ SoftwareApplication: () => SoftwareApplication,
463
+ StarterPacks: () => StarterPacks,
464
+ StatusApplied: () => StatusApplied,
465
+ StatusClosed: () => StatusClosed,
466
+ StatusDraft: () => StatusDraft,
467
+ StatusOpen: () => StatusOpen,
468
+ TidalLogin: () => TidalLogin,
380
469
  Time: () => Time,
470
+ Torrent: () => Torrent,
471
+ TorrentComment: () => TorrentComment,
472
+ TransportMethodAnnouncement: () => TransportMethodAnnouncement,
381
473
  UserEmojiList: () => UserEmojiList,
474
+ UserGraspList: () => UserGraspList,
382
475
  UserStatuses: () => UserStatuses,
476
+ VideoViewEvent: () => VideoViewEvent,
383
477
  Voice: () => Voice,
384
478
  VoiceComment: () => VoiceComment,
479
+ WebBookmarks: () => WebBookmarks,
480
+ WikiArticle: () => WikiArticle,
385
481
  Zap: () => Zap,
386
482
  ZapGoal: () => ZapGoal,
387
483
  ZapRequest: () => ZapRequest,
@@ -429,40 +525,83 @@ var Repost = 6;
429
525
  var Reaction = 7;
430
526
  var BadgeAward = 8;
431
527
  var ChatMessage = 9;
528
+ var SimpleGroupThreadedReply = 10;
432
529
  var ForumThread = 11;
530
+ var SimpleGroupReply = 12;
433
531
  var Seal = 13;
434
532
  var PrivateDirectMessage = 14;
435
533
  var FileMessage = 15;
436
534
  var GenericRepost = 16;
535
+ var ReactionToWebsite = 17;
437
536
  var Photo = 20;
438
537
  var NormalVideo = 21;
439
538
  var ShortVideo = 22;
539
+ var PublicMessage = 24;
440
540
  var ChannelCreation = 40;
441
541
  var ChannelMetadata = 41;
442
542
  var ChannelMessage = 42;
443
543
  var ChannelHideMessage = 43;
444
544
  var ChannelMuteUser = 44;
545
+ var PodcastEpisode = 54;
546
+ var Chess = 64;
547
+ var MergeRequests = 818;
548
+ var PollResponse = 1018;
549
+ var Bid = 1021;
550
+ var BidConfirmation = 1022;
445
551
  var OpenTimestamps = 1040;
446
552
  var GiftWrap = 1059;
447
- var Poll = 1068;
448
553
  var FileMetadata = 1063;
554
+ var Poll = 1068;
449
555
  var Comment = 1111;
450
- var LiveChatMessage = 1311;
451
556
  var Voice = 1222;
557
+ var Scroll = 1227;
452
558
  var VoiceComment = 1244;
559
+ var LiveChatMessage = 1311;
560
+ var CodeSnippet = 1337;
561
+ var Patch = 1617;
562
+ var GitPullRequest = 1618;
563
+ var GitPullRequestUpdate = 1619;
564
+ var Issue = 1621;
565
+ var Reply = 1622;
566
+ var StatusOpen = 1630;
567
+ var StatusApplied = 1631;
568
+ var StatusClosed = 1632;
569
+ var StatusDraft = 1633;
453
570
  var ProblemTracker = 1971;
454
571
  var Report = 1984;
455
572
  var Reporting = 1984;
456
573
  var Label = 1985;
574
+ var RelayReviews = 1986;
575
+ var AIEmbeddings = 1987;
576
+ var Torrent = 2003;
577
+ var TorrentComment = 2004;
578
+ var CoinjoinPool = 2022;
579
+ var DecoupledKeyClientAnnouncement = 4454;
580
+ var DecoupledEncryptionKeyDistribution = 4455;
457
581
  var CommunityPostApproval = 4550;
458
582
  var JobRequest = 5999;
459
583
  var JobResult = 6999;
460
584
  var JobFeedback = 7e3;
585
+ var ReservedCashuWalletTokens = 7374;
586
+ var CashuWalletTokens = 7375;
587
+ var CashuWalletHistory = 7376;
588
+ var GeocacheLog = 7516;
589
+ var GeocacheProofOfFind = 7517;
590
+ var SimpleGroupPutUser = 9e3;
591
+ var SimpleGroupRemoveUser = 9001;
592
+ var SimpleGroupEditMetadata = 9002;
593
+ var SimpleGroupDeleteEvent = 9005;
594
+ var SimpleGroupCreateGroup = 9007;
595
+ var SimpleGroupDeleteGroup = 9008;
596
+ var SimpleGroupCreateInvite = 9009;
597
+ var SimpleGroupJoinRequest = 9021;
598
+ var SimpleGroupLeaveRequest = 9022;
461
599
  var ZapGoal = 9041;
600
+ var NutZap = 9321;
601
+ var TidalLogin = 9467;
462
602
  var ZapRequest = 9734;
463
603
  var Zap = 9735;
464
604
  var Highlights = 9802;
465
- var PollResponse = 1018;
466
605
  var Mutelist = 1e4;
467
606
  var Pinlist = 10001;
468
607
  var RelayList = 10002;
@@ -471,37 +610,74 @@ var CommunitiesList = 10004;
471
610
  var PublicChatsList = 10005;
472
611
  var BlockedRelaysList = 10006;
473
612
  var SearchRelaysList = 10007;
613
+ var SimpleGroupList = 10009;
474
614
  var FavoriteRelays = 10012;
615
+ var PrivateEventRelayList = 10013;
475
616
  var InterestsList = 10015;
617
+ var NutZapInfo = 10019;
618
+ var MediaFollows = 10020;
476
619
  var UserEmojiList = 10030;
620
+ var DecoupledKeyAnnouncement = 10044;
477
621
  var DirectMessageRelaysList = 10050;
478
- var FileServerPreference = 10096;
622
+ var FavoritePodcasts = 10054;
479
623
  var BlossomServerList = 10063;
624
+ var FileServerPreference = 10096;
625
+ var GoodWikiAuthorList = 10101;
626
+ var GoodWikiRelayList = 10102;
627
+ var PodcastMetadata = 10154;
628
+ var AuthoredPodcasts = 10164;
629
+ var RelayMonitorAnnouncement = 10166;
630
+ var RoomPresence = 10312;
631
+ var UserGraspList = 10317;
632
+ var ProxyAnnouncement = 10377;
633
+ var TransportMethodAnnouncement = 11111;
480
634
  var NWCWalletInfo = 13194;
635
+ var NsiteRoot = 15128;
636
+ var CashuWalletEvent = 17375;
481
637
  var LightningPubRPC = 21e3;
482
638
  var ClientAuth = 22242;
483
639
  var NWCWalletRequest = 23194;
484
640
  var NWCWalletResponse = 23195;
485
641
  var NostrConnect = 24133;
642
+ var BlobsAuth = 24242;
486
643
  var HTTPAuth = 27235;
487
644
  var Followsets = 3e4;
488
645
  var Genericlists = 30001;
489
646
  var Relaysets = 30002;
490
647
  var Bookmarksets = 30003;
491
648
  var Curationsets = 30004;
649
+ var CuratedVideoSets = 30005;
650
+ var MuteSets = 30007;
492
651
  var ProfileBadges = 30008;
493
652
  var BadgeDefinition = 30009;
494
653
  var Interestsets = 30015;
495
654
  var CreateOrUpdateStall = 30017;
496
655
  var CreateOrUpdateProduct = 30018;
656
+ var MarketplaceUI = 30019;
657
+ var ProductSoldAsAuction = 30020;
497
658
  var LongFormArticle = 30023;
498
659
  var DraftLong = 30024;
499
660
  var Emojisets = 30030;
661
+ var ModularArticleHeader = 30040;
662
+ var ModularArticleContent = 30041;
663
+ var ReleaseArtifactSets = 30063;
500
664
  var Application = 30078;
665
+ var RelayDiscovery = 30166;
666
+ var AppCurationSet = 30267;
501
667
  var LiveEvent = 30311;
668
+ var InteractiveRoom = 30312;
669
+ var ConferenceEvent = 30313;
502
670
  var UserStatuses = 30315;
671
+ var SlideSet = 30388;
503
672
  var ClassifiedListing = 30402;
504
673
  var DraftClassifiedListing = 30403;
674
+ var RepositoryAnnouncement = 30617;
675
+ var RepositoryState = 30618;
676
+ var WikiArticle = 30818;
677
+ var Redirects = 30819;
678
+ var DraftEvent = 31234;
679
+ var LinkSet = 31388;
680
+ var Feed = 31890;
505
681
  var Date2 = 31922;
506
682
  var Time = 31923;
507
683
  var Calendar = 31924;
@@ -509,8 +685,24 @@ var CalendarEventRSVP = 31925;
509
685
  var RelayReview = 31987;
510
686
  var Handlerrecommendation = 31989;
511
687
  var Handlerinformation = 31990;
688
+ var SoftwareApplication = 32267;
689
+ var LegacyNsiteFile = 34128;
690
+ var VideoViewEvent = 34237;
512
691
  var CommunityDefinition = 34550;
692
+ var NsiteNamed = 35128;
693
+ var GeocacheListing = 37515;
694
+ var GeocacheLogEntry = 37516;
695
+ var CashuMintAnnouncement = 38172;
696
+ var FedimintAnnouncement = 38173;
697
+ var PeerToPeerOrderEvents = 38383;
513
698
  var GroupMetadata = 39e3;
699
+ var SimpleGroupAdmins = 39001;
700
+ var SimpleGroupMembers = 39002;
701
+ var SimpleGroupRoles = 39003;
702
+ var SimpleGroupLiveKitParticipants = 39004;
703
+ var StarterPacks = 39089;
704
+ var MediaStarterPacks = 39092;
705
+ var WebBookmarks = 39701;
514
706
 
515
707
  // filter.ts
516
708
  function matchFilter(filter, event) {
@@ -902,19 +1094,38 @@ var AbstractRelay = class {
902
1094
  }, this.publishTimeout);
903
1095
  this.openEventPublishes.set(event.id, { resolve, reject, timeout });
904
1096
  });
905
- this.send('["EVENT",' + JSON.stringify(event) + "]");
1097
+ try {
1098
+ await this.send('["EVENT",' + JSON.stringify(event) + "]");
1099
+ } catch (err) {
1100
+ const ep = this.openEventPublishes.get(event.id);
1101
+ if (ep) {
1102
+ ep.reject(err);
1103
+ this.openEventPublishes.delete(event.id);
1104
+ }
1105
+ }
906
1106
  this.ongoingOperations--;
907
1107
  if (this.ongoingOperations === 0)
908
1108
  this.idleSince = Date.now();
909
1109
  return ret;
910
1110
  }
911
1111
  async count(filters, params) {
1112
+ return (await this.countWithHLL(filters, params)).count;
1113
+ }
1114
+ async countWithHLL(filters, params) {
912
1115
  this.serial++;
913
1116
  const id = params?.id || "count:" + this.serial;
914
1117
  const ret = new Promise((resolve, reject) => {
915
1118
  this.openCountRequests.set(id, { resolve, reject });
916
1119
  });
917
- this.send('["COUNT","' + id + '",' + JSON.stringify(filters).substring(1));
1120
+ try {
1121
+ await this.send('["COUNT","' + id + '",' + JSON.stringify(filters).substring(1));
1122
+ } catch (err) {
1123
+ const cr = this.openCountRequests.get(id);
1124
+ if (cr) {
1125
+ cr.reject(err);
1126
+ this.openCountRequests.delete(id);
1127
+ }
1128
+ }
918
1129
  return ret;
919
1130
  }
920
1131
  subscribe(filters, params) {
@@ -992,7 +1203,7 @@ var AbstractRelay = class {
992
1203
  const payload = data[2];
993
1204
  const cr = this.openCountRequests.get(id);
994
1205
  if (cr) {
995
- cr.resolve(payload.count);
1206
+ cr.resolve(payload);
996
1207
  this.openCountRequests.delete(id);
997
1208
  }
998
1209
  return;
@@ -1022,8 +1233,14 @@ var AbstractRelay = class {
1022
1233
  case "CLOSED": {
1023
1234
  const id = data[1];
1024
1235
  const so = this.openSubs.get(id);
1025
- if (!so)
1236
+ if (!so) {
1237
+ const cr = this.openCountRequests.get(id);
1238
+ if (cr) {
1239
+ cr.reject(new Error(data[2]));
1240
+ this.openCountRequests.delete(id);
1241
+ }
1026
1242
  return;
1243
+ }
1027
1244
  so.closed = true;
1028
1245
  so.close(data[2]);
1029
1246
  return;
@@ -1149,6 +1366,63 @@ var alwaysTrue = (t) => {
1149
1366
  return true;
1150
1367
  };
1151
1368
 
1369
+ // nip45.ts
1370
+ var import_sha22 = require("@noble/hashes/sha2.js");
1371
+ var import_utils5 = require("@noble/hashes/utils.js");
1372
+ var M = 256;
1373
+ var HLL_HEX_LENGTH = M * 2;
1374
+ var utf8Encoder2 = new TextEncoder();
1375
+ function getCountManyFilter(target, directive) {
1376
+ switch (directive) {
1377
+ case "reactions":
1378
+ return { "#e": [target], kinds: [7] };
1379
+ case "reposts":
1380
+ return { "#e": [target], kinds: [6] };
1381
+ case "quotes":
1382
+ return { "#q": [target], kinds: [1, 1111] };
1383
+ case "replies":
1384
+ return { "#e": [target], kinds: [1] };
1385
+ case "comments":
1386
+ return { "#E": [target], kinds: [1111] };
1387
+ case "followers":
1388
+ return { "#p": [target], kinds: [3] };
1389
+ }
1390
+ }
1391
+ function newHll() {
1392
+ return new Uint8Array(M);
1393
+ }
1394
+ function hllDecode(hex) {
1395
+ if (hex.length !== HLL_HEX_LENGTH || !/^[0-9a-fA-F]+$/.test(hex))
1396
+ return void 0;
1397
+ const registers = new Uint8Array(M);
1398
+ for (let i2 = 0; i2 < M; i2++) {
1399
+ registers[i2] = parseInt(hex.slice(i2 * 2, i2 * 2 + 2), 16);
1400
+ }
1401
+ return registers;
1402
+ }
1403
+ function hllEncode(registers) {
1404
+ if (registers.length !== M)
1405
+ throw new Error(`invalid number of registers ${registers.length}`);
1406
+ let hex = "";
1407
+ for (let i2 = 0; i2 < M; i2++) {
1408
+ hex += registers[i2].toString(16).padStart(2, "0");
1409
+ }
1410
+ return hex;
1411
+ }
1412
+ function mergeHll(target, source) {
1413
+ if (target.length === 0)
1414
+ target = newHll();
1415
+ if (target.length !== M)
1416
+ throw new Error(`invalid number of registers ${target.length}`);
1417
+ if (source.length !== M)
1418
+ throw new Error(`invalid number of registers ${source.length}`);
1419
+ for (let i2 = 0; i2 < M; i2++) {
1420
+ if (source[i2] > target[i2])
1421
+ target[i2] = source[i2];
1422
+ }
1423
+ return target;
1424
+ }
1425
+
1152
1426
  // abstract-pool.ts
1153
1427
  var AbstractSimplePool = class {
1154
1428
  relays = /* @__PURE__ */ new Map();
@@ -1376,6 +1650,48 @@ var AbstractSimplePool = class {
1376
1650
  events.sort((a, b) => b.created_at - a.created_at);
1377
1651
  return events[0] || null;
1378
1652
  }
1653
+ async countMany(relays, target, directive, params) {
1654
+ const filter = getCountManyFilter(target, directive);
1655
+ const urls = [];
1656
+ for (let i2 = 0; i2 < relays.length; i2++) {
1657
+ const url = normalizeURL(relays[i2]);
1658
+ if (urls.indexOf(url) === -1)
1659
+ urls.push(url);
1660
+ }
1661
+ const responses = await Promise.all(
1662
+ urls.map(async (url) => {
1663
+ if (this.allowConnectingToRelay?.(url, ["read", [filter]]) === false)
1664
+ return null;
1665
+ let relay;
1666
+ try {
1667
+ relay = await this.ensureRelay(url, {
1668
+ connectionTimeout: this.maxWaitForConnection < (params?.maxWait || 0) ? Math.max(params.maxWait * 0.8, params.maxWait - 1e3) : this.maxWaitForConnection,
1669
+ abort: params?.abort
1670
+ });
1671
+ } catch (err) {
1672
+ this.onRelayConnectionFailure?.(url);
1673
+ return null;
1674
+ }
1675
+ this.onRelayConnectionSuccess?.(url);
1676
+ return relay.countWithHLL([filter], { id: params?.id }).catch(() => null);
1677
+ })
1678
+ );
1679
+ let count = 0;
1680
+ let hll;
1681
+ for (const response of responses) {
1682
+ if (!response)
1683
+ continue;
1684
+ if (response.count > count)
1685
+ count = response.count;
1686
+ if (!response.hll || response.hll.length !== 512)
1687
+ continue;
1688
+ const registers = hllDecode(response.hll);
1689
+ if (!registers)
1690
+ continue;
1691
+ hll = mergeHll(hll || new Uint8Array(0), registers);
1692
+ }
1693
+ return hll ? { count, hll: hllEncode(hll) } : { count };
1694
+ }
1379
1695
  publish(relays, event, params) {
1380
1696
  return relays.map(normalizeURL).map(async (url, i2, arr) => {
1381
1697
  if (arr.indexOf(url) !== i2) {
@@ -1463,7 +1779,7 @@ __export(nip19_exports, {
1463
1779
  npubEncode: () => npubEncode,
1464
1780
  nsecEncode: () => nsecEncode
1465
1781
  });
1466
- var import_utils6 = require("@noble/hashes/utils.js");
1782
+ var import_utils7 = require("@noble/hashes/utils.js");
1467
1783
  var import_base = require("@scure/base");
1468
1784
  var NostrTypeGuard = {
1469
1785
  isNProfile: (value) => /^nprofile1[a-z\d]+$/.test(value || ""),
@@ -1506,7 +1822,7 @@ function decode(code) {
1506
1822
  return {
1507
1823
  type: "nprofile",
1508
1824
  data: {
1509
- pubkey: (0, import_utils6.bytesToHex)(tlv[0][0]),
1825
+ pubkey: (0, import_utils7.bytesToHex)(tlv[0][0]),
1510
1826
  relays: tlv[1] ? tlv[1].map((d) => utf8Decoder.decode(d)) : []
1511
1827
  }
1512
1828
  };
@@ -1524,10 +1840,10 @@ function decode(code) {
1524
1840
  return {
1525
1841
  type: "nevent",
1526
1842
  data: {
1527
- id: (0, import_utils6.bytesToHex)(tlv[0][0]),
1843
+ id: (0, import_utils7.bytesToHex)(tlv[0][0]),
1528
1844
  relays: tlv[1] ? tlv[1].map((d) => utf8Decoder.decode(d)) : [],
1529
- author: tlv[2]?.[0] ? (0, import_utils6.bytesToHex)(tlv[2][0]) : void 0,
1530
- kind: tlv[3]?.[0] ? parseInt((0, import_utils6.bytesToHex)(tlv[3][0]), 16) : void 0
1845
+ author: tlv[2]?.[0] ? (0, import_utils7.bytesToHex)(tlv[2][0]) : void 0,
1846
+ kind: tlv[3]?.[0] ? parseInt((0, import_utils7.bytesToHex)(tlv[3][0]), 16) : void 0
1531
1847
  }
1532
1848
  };
1533
1849
  }
@@ -1547,8 +1863,8 @@ function decode(code) {
1547
1863
  type: "naddr",
1548
1864
  data: {
1549
1865
  identifier: utf8Decoder.decode(tlv[0][0]),
1550
- pubkey: (0, import_utils6.bytesToHex)(tlv[2][0]),
1551
- kind: parseInt((0, import_utils6.bytesToHex)(tlv[3][0]), 16),
1866
+ pubkey: (0, import_utils7.bytesToHex)(tlv[2][0]),
1867
+ kind: parseInt((0, import_utils7.bytesToHex)(tlv[3][0]), 16),
1552
1868
  relays: tlv[1] ? tlv[1].map((d) => utf8Decoder.decode(d)) : []
1553
1869
  }
1554
1870
  };
@@ -1557,7 +1873,7 @@ function decode(code) {
1557
1873
  return { type: prefix, data };
1558
1874
  case "npub":
1559
1875
  case "note":
1560
- return { type: prefix, data: (0, import_utils6.bytesToHex)(data) };
1876
+ return { type: prefix, data: (0, import_utils7.bytesToHex)(data) };
1561
1877
  default:
1562
1878
  throw new Error(`unknown prefix ${prefix}`);
1563
1879
  }
@@ -1583,10 +1899,10 @@ function nsecEncode(key) {
1583
1899
  return encodeBytes("nsec", key);
1584
1900
  }
1585
1901
  function npubEncode(hex) {
1586
- return encodeBytes("npub", (0, import_utils6.hexToBytes)(hex));
1902
+ return encodeBytes("npub", (0, import_utils7.hexToBytes)(hex));
1587
1903
  }
1588
1904
  function noteEncode(hex) {
1589
- return encodeBytes("note", (0, import_utils6.hexToBytes)(hex));
1905
+ return encodeBytes("note", (0, import_utils7.hexToBytes)(hex));
1590
1906
  }
1591
1907
  function encodeBech32(prefix, data) {
1592
1908
  let words = import_base.bech32.toWords(data);
@@ -1597,7 +1913,7 @@ function encodeBytes(prefix, bytes) {
1597
1913
  }
1598
1914
  function nprofileEncode(profile) {
1599
1915
  let data = encodeTLV({
1600
- 0: [(0, import_utils6.hexToBytes)(profile.pubkey)],
1916
+ 0: [(0, import_utils7.hexToBytes)(profile.pubkey)],
1601
1917
  1: (profile.relays || []).map((url) => utf8Encoder.encode(url))
1602
1918
  });
1603
1919
  return encodeBech32("nprofile", data);
@@ -1608,9 +1924,9 @@ function neventEncode(event) {
1608
1924
  kindArray = integerToUint8Array(event.kind);
1609
1925
  }
1610
1926
  let data = encodeTLV({
1611
- 0: [(0, import_utils6.hexToBytes)(event.id)],
1927
+ 0: [(0, import_utils7.hexToBytes)(event.id)],
1612
1928
  1: (event.relays || []).map((url) => utf8Encoder.encode(url)),
1613
- 2: event.author ? [(0, import_utils6.hexToBytes)(event.author)] : [],
1929
+ 2: event.author ? [(0, import_utils7.hexToBytes)(event.author)] : [],
1614
1930
  3: kindArray ? [new Uint8Array(kindArray)] : []
1615
1931
  });
1616
1932
  return encodeBech32("nevent", data);
@@ -1621,7 +1937,7 @@ function naddrEncode(addr) {
1621
1937
  let data = encodeTLV({
1622
1938
  0: [utf8Encoder.encode(addr.identifier)],
1623
1939
  1: (addr.relays || []).map((url) => utf8Encoder.encode(url)),
1624
- 2: [(0, import_utils6.hexToBytes)(addr.pubkey)],
1940
+ 2: [(0, import_utils7.hexToBytes)(addr.pubkey)],
1625
1941
  3: [new Uint8Array(kind)]
1626
1942
  });
1627
1943
  return encodeBech32("naddr", data);
@@ -1637,7 +1953,7 @@ function encodeTLV(tlv) {
1637
1953
  entries.push(entry);
1638
1954
  });
1639
1955
  });
1640
- return (0, import_utils6.concatBytes)(...entries);
1956
+ return (0, import_utils7.concatBytes)(...entries);
1641
1957
  }
1642
1958
 
1643
1959
  // references.ts
@@ -1735,15 +2051,15 @@ __export(nip04_exports, {
1735
2051
  decrypt: () => decrypt,
1736
2052
  encrypt: () => encrypt
1737
2053
  });
1738
- var import_utils8 = require("@noble/hashes/utils.js");
2054
+ var import_utils9 = require("@noble/hashes/utils.js");
1739
2055
  var import_secp256k12 = require("@noble/curves/secp256k1.js");
1740
2056
  var import_aes = require("@noble/ciphers/aes.js");
1741
2057
  var import_base2 = require("@scure/base");
1742
2058
  function encrypt(secretKey, pubkey, text) {
1743
- const privkey = secretKey instanceof Uint8Array ? secretKey : (0, import_utils8.hexToBytes)(secretKey);
1744
- const key = import_secp256k12.secp256k1.getSharedSecret(privkey, (0, import_utils8.hexToBytes)("02" + pubkey));
2059
+ const privkey = secretKey instanceof Uint8Array ? secretKey : (0, import_utils9.hexToBytes)(secretKey);
2060
+ const key = import_secp256k12.secp256k1.getSharedSecret(privkey, (0, import_utils9.hexToBytes)("02" + pubkey));
1745
2061
  const normalizedKey = getNormalizedX(key);
1746
- let iv = Uint8Array.from((0, import_utils8.randomBytes)(16));
2062
+ let iv = Uint8Array.from((0, import_utils9.randomBytes)(16));
1747
2063
  let plaintext = utf8Encoder.encode(text);
1748
2064
  let ciphertext = (0, import_aes.cbc)(normalizedKey, iv).encrypt(plaintext);
1749
2065
  let ctb64 = import_base2.base64.encode(new Uint8Array(ciphertext));
@@ -1751,9 +2067,9 @@ function encrypt(secretKey, pubkey, text) {
1751
2067
  return `${ctb64}?iv=${ivb64}`;
1752
2068
  }
1753
2069
  function decrypt(secretKey, pubkey, data) {
1754
- const privkey = secretKey instanceof Uint8Array ? secretKey : (0, import_utils8.hexToBytes)(secretKey);
2070
+ const privkey = secretKey instanceof Uint8Array ? secretKey : (0, import_utils9.hexToBytes)(secretKey);
1755
2071
  let [ctb64, ivb64] = data.split("?iv=");
1756
- let key = import_secp256k12.secp256k1.getSharedSecret(privkey, (0, import_utils8.hexToBytes)("02" + pubkey));
2072
+ let key = import_secp256k12.secp256k1.getSharedSecret(privkey, (0, import_utils9.hexToBytes)("02" + pubkey));
1757
2073
  let normalizedKey = getNormalizedX(key);
1758
2074
  let iv = import_base2.base64.decode(ivb64);
1759
2075
  let ciphertext = import_base2.base64.decode(ctb64);
@@ -1953,8 +2269,8 @@ __export(nip13_exports, {
1953
2269
  getPow: () => getPow,
1954
2270
  minePow: () => minePow
1955
2271
  });
1956
- var import_utils10 = require("@noble/hashes/utils.js");
1957
- var import_sha22 = require("@noble/hashes/sha2.js");
2272
+ var import_utils11 = require("@noble/hashes/utils.js");
2273
+ var import_sha23 = require("@noble/hashes/sha2.js");
1958
2274
  function getPow(hex) {
1959
2275
  let count = 0;
1960
2276
  for (let i2 = 0; i2 < 64; i2 += 8) {
@@ -1993,11 +2309,11 @@ function minePow(unsigned, difficulty) {
1993
2309
  event.created_at = now2;
1994
2310
  }
1995
2311
  tag[1] = (++count).toString();
1996
- const hash = (0, import_sha22.sha256)(
2312
+ const hash = (0, import_sha23.sha256)(
1997
2313
  utf8Encoder.encode(JSON.stringify([0, event.pubkey, event.created_at, event.kind, event.tags, event.content]))
1998
2314
  );
1999
2315
  if (getPowFromBytes(hash) >= difficulty) {
2000
- event.id = (0, import_utils10.bytesToHex)(hash);
2316
+ event.id = (0, import_utils11.bytesToHex)(hash);
2001
2317
  break;
2002
2318
  }
2003
2319
  }
@@ -2034,22 +2350,22 @@ __export(nip44_exports, {
2034
2350
  v2: () => v2
2035
2351
  });
2036
2352
  var import_chacha = require("@noble/ciphers/chacha.js");
2037
- var import_utils12 = require("@noble/ciphers/utils.js");
2353
+ var import_utils13 = require("@noble/ciphers/utils.js");
2038
2354
  var import_secp256k13 = require("@noble/curves/secp256k1.js");
2039
2355
  var import_hkdf = require("@noble/hashes/hkdf.js");
2040
2356
  var import_hmac = require("@noble/hashes/hmac.js");
2041
- var import_sha23 = require("@noble/hashes/sha2.js");
2042
- var import_utils13 = require("@noble/hashes/utils.js");
2357
+ var import_sha24 = require("@noble/hashes/sha2.js");
2358
+ var import_utils14 = require("@noble/hashes/utils.js");
2043
2359
  var import_base3 = require("@scure/base");
2044
2360
  var minPlaintextSize = 1;
2045
2361
  var maxPlaintextSize = 4294967295;
2046
2362
  var extendedPrefixThreshold = 65536;
2047
2363
  function getConversationKey(privkeyA, pubkeyB) {
2048
- const sharedX = import_secp256k13.secp256k1.getSharedSecret(privkeyA, (0, import_utils13.hexToBytes)("02" + pubkeyB)).subarray(1, 33);
2049
- return (0, import_hkdf.extract)(import_sha23.sha256, sharedX, utf8Encoder.encode("nip44-v2"));
2364
+ const sharedX = import_secp256k13.secp256k1.getSharedSecret(privkeyA, (0, import_utils14.hexToBytes)("02" + pubkeyB)).subarray(1, 33);
2365
+ return (0, import_hkdf.extract)(import_sha24.sha256, sharedX, utf8Encoder.encode("nip44-v2"));
2050
2366
  }
2051
2367
  function getMessageKeys(conversationKey, nonce) {
2052
- const keys = (0, import_hkdf.expand)(import_sha23.sha256, conversationKey, nonce, 76);
2368
+ const keys = (0, import_hkdf.expand)(import_sha24.sha256, conversationKey, nonce, 76);
2053
2369
  return {
2054
2370
  chacha_key: keys.subarray(0, 32),
2055
2371
  chacha_nonce: keys.subarray(32, 44),
@@ -2084,9 +2400,9 @@ function pad(plaintext) {
2084
2400
  const unpaddedLen = unpadded.length;
2085
2401
  if (unpaddedLen < minPlaintextSize || unpaddedLen > maxPlaintextSize)
2086
2402
  throw new Error("invalid plaintext size: must be between 1 and 4294967295 bytes");
2087
- const prefix = unpaddedLen >= extendedPrefixThreshold ? (0, import_utils13.concatBytes)(new Uint8Array([0, 0]), writeU32BE(unpaddedLen)) : writeU16BE(unpaddedLen);
2403
+ const prefix = unpaddedLen >= extendedPrefixThreshold ? (0, import_utils14.concatBytes)(new Uint8Array([0, 0]), writeU32BE(unpaddedLen)) : writeU16BE(unpaddedLen);
2088
2404
  const suffix = new Uint8Array(calcPaddedLen(unpaddedLen) - unpaddedLen);
2089
- return (0, import_utils13.concatBytes)(prefix, unpadded, suffix);
2405
+ return (0, import_utils14.concatBytes)(prefix, unpadded, suffix);
2090
2406
  }
2091
2407
  function unpad(padded) {
2092
2408
  const dv = new DataView(padded.buffer, padded.byteOffset, padded.byteLength);
@@ -2110,8 +2426,8 @@ function unpad(padded) {
2110
2426
  function hmacAad(key, message, aad) {
2111
2427
  if (aad.length !== 32)
2112
2428
  throw new Error("AAD associated data must be 32 bytes");
2113
- const combined = (0, import_utils13.concatBytes)(aad, message);
2114
- return (0, import_hmac.hmac)(import_sha23.sha256, key, combined);
2429
+ const combined = (0, import_utils14.concatBytes)(aad, message);
2430
+ return (0, import_hmac.hmac)(import_sha24.sha256, key, combined);
2115
2431
  }
2116
2432
  function decodePayload(payload) {
2117
2433
  if (typeof payload !== "string")
@@ -2139,18 +2455,18 @@ function decodePayload(payload) {
2139
2455
  mac: data.subarray(-32)
2140
2456
  };
2141
2457
  }
2142
- function encrypt2(plaintext, conversationKey, nonce = (0, import_utils13.randomBytes)(32)) {
2458
+ function encrypt2(plaintext, conversationKey, nonce = (0, import_utils14.randomBytes)(32)) {
2143
2459
  const { chacha_key, chacha_nonce, hmac_key } = getMessageKeys(conversationKey, nonce);
2144
2460
  const padded = pad(plaintext);
2145
2461
  const ciphertext = (0, import_chacha.chacha20)(chacha_key, chacha_nonce, padded);
2146
2462
  const mac = hmacAad(hmac_key, ciphertext, nonce);
2147
- return import_base3.base64.encode((0, import_utils13.concatBytes)(new Uint8Array([2]), nonce, ciphertext, mac));
2463
+ return import_base3.base64.encode((0, import_utils14.concatBytes)(new Uint8Array([2]), nonce, ciphertext, mac));
2148
2464
  }
2149
2465
  function decrypt2(payload, conversationKey) {
2150
2466
  const { nonce, ciphertext, mac } = decodePayload(payload);
2151
2467
  const { chacha_key, chacha_nonce, hmac_key } = getMessageKeys(conversationKey, nonce);
2152
2468
  const calculatedMac = hmacAad(hmac_key, ciphertext, nonce);
2153
- if (!(0, import_utils12.equalBytes)(calculatedMac, mac))
2469
+ if (!(0, import_utils13.equalBytes)(calculatedMac, mac))
2154
2470
  throw new Error("invalid MAC");
2155
2471
  const padded = (0, import_chacha.chacha20)(chacha_key, chacha_nonce, ciphertext);
2156
2472
  return unpad(padded);
@@ -3070,8 +3386,8 @@ __export(nip77_exports, {
3070
3386
  NegentropyStorageVector: () => NegentropyStorageVector,
3071
3387
  NegentropySync: () => NegentropySync
3072
3388
  });
3073
- var import_utils16 = require("@noble/hashes/utils.js");
3074
- var import_sha24 = require("@noble/hashes/sha2.js");
3389
+ var import_utils17 = require("@noble/hashes/utils.js");
3390
+ var import_sha25 = require("@noble/hashes/sha2.js");
3075
3391
  var PROTOCOL_VERSION = 97;
3076
3392
  var ID_SIZE = 32;
3077
3393
  var FINGERPRINT_SIZE = 16;
@@ -3202,7 +3518,7 @@ var Accumulator = class {
3202
3518
  let input = new WrappedBuffer();
3203
3519
  input.extend(this.buf);
3204
3520
  input.extend(encodeVarInt(n));
3205
- let hash = (0, import_sha24.sha256)(input.unwrap());
3521
+ let hash = (0, import_sha25.sha256)(input.unwrap());
3206
3522
  return hash.subarray(0, FINGERPRINT_SIZE);
3207
3523
  }
3208
3524
  };
@@ -3216,7 +3532,7 @@ var NegentropyStorageVector = class {
3216
3532
  insert(timestamp, id) {
3217
3533
  if (this.sealed)
3218
3534
  throw Error("already sealed");
3219
- const idb = (0, import_utils16.hexToBytes)(id);
3535
+ const idb = (0, import_utils17.hexToBytes)(id);
3220
3536
  if (idb.byteLength !== ID_SIZE)
3221
3537
  throw Error("bad id size for added item");
3222
3538
  this.items.push({ timestamp, id: idb });
@@ -3310,10 +3626,10 @@ var Negentropy = class {
3310
3626
  let output = new WrappedBuffer();
3311
3627
  output.extend(new Uint8Array([PROTOCOL_VERSION]));
3312
3628
  this.splitRange(0, this.storage.size(), this._bound(Number.MAX_VALUE), output);
3313
- return (0, import_utils16.bytesToHex)(output.unwrap());
3629
+ return (0, import_utils17.bytesToHex)(output.unwrap());
3314
3630
  }
3315
3631
  reconcile(queryMsg, onhave, onneed) {
3316
- const query = new WrappedBuffer((0, import_utils16.hexToBytes)(queryMsg));
3632
+ const query = new WrappedBuffer((0, import_utils17.hexToBytes)(queryMsg));
3317
3633
  this.lastTimestampIn = this.lastTimestampOut = 0;
3318
3634
  let fullOutput = new WrappedBuffer();
3319
3635
  fullOutput.extend(new Uint8Array([PROTOCOL_VERSION]));
@@ -3356,22 +3672,22 @@ var Negentropy = class {
3356
3672
  let theirElems = {};
3357
3673
  for (let i2 = 0; i2 < numIds; i2++) {
3358
3674
  let e = getBytes(query, ID_SIZE);
3359
- theirElems[(0, import_utils16.bytesToHex)(e)] = e;
3675
+ theirElems[(0, import_utils17.bytesToHex)(e)] = e;
3360
3676
  }
3361
3677
  skip = true;
3362
3678
  this.storage.iterate(lower, upper, (item) => {
3363
3679
  let k = item.id;
3364
- const id = (0, import_utils16.bytesToHex)(k);
3680
+ const id = (0, import_utils17.bytesToHex)(k);
3365
3681
  if (!theirElems[id]) {
3366
3682
  onhave?.(id);
3367
3683
  } else {
3368
- delete theirElems[(0, import_utils16.bytesToHex)(k)];
3684
+ delete theirElems[(0, import_utils17.bytesToHex)(k)];
3369
3685
  }
3370
3686
  return true;
3371
3687
  });
3372
3688
  if (onneed) {
3373
3689
  for (let v of Object.values(theirElems)) {
3374
- onneed((0, import_utils16.bytesToHex)(v));
3690
+ onneed((0, import_utils17.bytesToHex)(v));
3375
3691
  }
3376
3692
  }
3377
3693
  } else {
@@ -3389,7 +3705,7 @@ var Negentropy = class {
3389
3705
  prevIndex = upper;
3390
3706
  prevBound = currBound;
3391
3707
  }
3392
- return fullOutput.length === 1 ? null : (0, import_utils16.bytesToHex)(fullOutput.unwrap());
3708
+ return fullOutput.length === 1 ? null : (0, import_utils17.bytesToHex)(fullOutput.unwrap());
3393
3709
  }
3394
3710
  splitRange(lower, upper, upperBound, o) {
3395
3711
  let numElems = upper - lower;
@@ -3577,8 +3893,8 @@ __export(nip98_exports, {
3577
3893
  validateEventUrlTag: () => validateEventUrlTag,
3578
3894
  validateToken: () => validateToken
3579
3895
  });
3580
- var import_sha25 = require("@noble/hashes/sha2.js");
3581
- var import_utils17 = require("@noble/hashes/utils.js");
3896
+ var import_sha26 = require("@noble/hashes/sha2.js");
3897
+ var import_utils18 = require("@noble/hashes/utils.js");
3582
3898
  var import_base5 = require("@scure/base");
3583
3899
  var _authorizationScheme = "Nostr ";
3584
3900
  async function getToken(loginUrl, httpMethod, sign, includeAuthorizationScheme = false, payload) {
@@ -3643,8 +3959,8 @@ function validateEventMethodTag(event, method) {
3643
3959
  return methodTag.length > 0 && methodTag[1].toLowerCase() === method.toLowerCase();
3644
3960
  }
3645
3961
  function hashPayload(payload) {
3646
- const hash = (0, import_sha25.sha256)(utf8Encoder.encode(JSON.stringify(payload)));
3647
- return (0, import_utils17.bytesToHex)(hash);
3962
+ const hash = (0, import_sha26.sha256)(utf8Encoder.encode(JSON.stringify(payload)));
3963
+ return (0, import_utils18.bytesToHex)(hash);
3648
3964
  }
3649
3965
  function validateEventPayloadTag(event, payload) {
3650
3966
  const payloadTag = event.tags.find((t) => t[0] === "payload");