@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
|
@@ -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
|
|
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) {
|
|
@@ -753,7 +945,9 @@ var AbstractRelay = class {
|
|
|
753
945
|
connectionTimeoutHandle = setTimeout(() => {
|
|
754
946
|
reject("connection timed out");
|
|
755
947
|
this.connectionPromise = void 0;
|
|
756
|
-
this.
|
|
948
|
+
if (this.reconnectAttempts === 0) {
|
|
949
|
+
this.skipReconnection = true;
|
|
950
|
+
}
|
|
757
951
|
this.onclose?.();
|
|
758
952
|
this.handleHardClose("relay connection timed out");
|
|
759
953
|
}, opts.timeout);
|
|
@@ -797,7 +991,9 @@ var AbstractRelay = class {
|
|
|
797
991
|
clearTimeout(connectionTimeoutHandle);
|
|
798
992
|
reject("connection failed");
|
|
799
993
|
this.connectionPromise = void 0;
|
|
800
|
-
this.
|
|
994
|
+
if (this.reconnectAttempts === 0) {
|
|
995
|
+
this.skipReconnection = true;
|
|
996
|
+
}
|
|
801
997
|
this.onclose?.();
|
|
802
998
|
this.handleHardClose("relay connection failed");
|
|
803
999
|
};
|
|
@@ -898,19 +1094,38 @@ var AbstractRelay = class {
|
|
|
898
1094
|
}, this.publishTimeout);
|
|
899
1095
|
this.openEventPublishes.set(event.id, { resolve, reject, timeout });
|
|
900
1096
|
});
|
|
901
|
-
|
|
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
|
+
}
|
|
902
1106
|
this.ongoingOperations--;
|
|
903
1107
|
if (this.ongoingOperations === 0)
|
|
904
1108
|
this.idleSince = Date.now();
|
|
905
1109
|
return ret;
|
|
906
1110
|
}
|
|
907
1111
|
async count(filters, params) {
|
|
1112
|
+
return (await this.countWithHLL(filters, params)).count;
|
|
1113
|
+
}
|
|
1114
|
+
async countWithHLL(filters, params) {
|
|
908
1115
|
this.serial++;
|
|
909
1116
|
const id = params?.id || "count:" + this.serial;
|
|
910
1117
|
const ret = new Promise((resolve, reject) => {
|
|
911
1118
|
this.openCountRequests.set(id, { resolve, reject });
|
|
912
1119
|
});
|
|
913
|
-
|
|
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
|
+
}
|
|
914
1129
|
return ret;
|
|
915
1130
|
}
|
|
916
1131
|
subscribe(filters, params) {
|
|
@@ -988,7 +1203,7 @@ var AbstractRelay = class {
|
|
|
988
1203
|
const payload = data[2];
|
|
989
1204
|
const cr = this.openCountRequests.get(id);
|
|
990
1205
|
if (cr) {
|
|
991
|
-
cr.resolve(payload
|
|
1206
|
+
cr.resolve(payload);
|
|
992
1207
|
this.openCountRequests.delete(id);
|
|
993
1208
|
}
|
|
994
1209
|
return;
|
|
@@ -1018,8 +1233,14 @@ var AbstractRelay = class {
|
|
|
1018
1233
|
case "CLOSED": {
|
|
1019
1234
|
const id = data[1];
|
|
1020
1235
|
const so = this.openSubs.get(id);
|
|
1021
|
-
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
|
+
}
|
|
1022
1242
|
return;
|
|
1243
|
+
}
|
|
1023
1244
|
so.closed = true;
|
|
1024
1245
|
so.close(data[2]);
|
|
1025
1246
|
return;
|
|
@@ -1145,6 +1366,63 @@ var alwaysTrue = (t) => {
|
|
|
1145
1366
|
return true;
|
|
1146
1367
|
};
|
|
1147
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
|
+
|
|
1148
1426
|
// abstract-pool.ts
|
|
1149
1427
|
var AbstractSimplePool = class {
|
|
1150
1428
|
relays = /* @__PURE__ */ new Map();
|
|
@@ -1372,6 +1650,48 @@ var AbstractSimplePool = class {
|
|
|
1372
1650
|
events.sort((a, b) => b.created_at - a.created_at);
|
|
1373
1651
|
return events[0] || null;
|
|
1374
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
|
+
}
|
|
1375
1695
|
publish(relays, event, params) {
|
|
1376
1696
|
return relays.map(normalizeURL).map(async (url, i2, arr) => {
|
|
1377
1697
|
if (arr.indexOf(url) !== i2) {
|
|
@@ -1459,7 +1779,7 @@ __export(nip19_exports, {
|
|
|
1459
1779
|
npubEncode: () => npubEncode,
|
|
1460
1780
|
nsecEncode: () => nsecEncode
|
|
1461
1781
|
});
|
|
1462
|
-
var
|
|
1782
|
+
var import_utils7 = require("@noble/hashes/utils.js");
|
|
1463
1783
|
var import_base = require("@scure/base");
|
|
1464
1784
|
var NostrTypeGuard = {
|
|
1465
1785
|
isNProfile: (value) => /^nprofile1[a-z\d]+$/.test(value || ""),
|
|
@@ -1502,7 +1822,7 @@ function decode(code) {
|
|
|
1502
1822
|
return {
|
|
1503
1823
|
type: "nprofile",
|
|
1504
1824
|
data: {
|
|
1505
|
-
pubkey: (0,
|
|
1825
|
+
pubkey: (0, import_utils7.bytesToHex)(tlv[0][0]),
|
|
1506
1826
|
relays: tlv[1] ? tlv[1].map((d) => utf8Decoder.decode(d)) : []
|
|
1507
1827
|
}
|
|
1508
1828
|
};
|
|
@@ -1520,10 +1840,10 @@ function decode(code) {
|
|
|
1520
1840
|
return {
|
|
1521
1841
|
type: "nevent",
|
|
1522
1842
|
data: {
|
|
1523
|
-
id: (0,
|
|
1843
|
+
id: (0, import_utils7.bytesToHex)(tlv[0][0]),
|
|
1524
1844
|
relays: tlv[1] ? tlv[1].map((d) => utf8Decoder.decode(d)) : [],
|
|
1525
|
-
author: tlv[2]?.[0] ? (0,
|
|
1526
|
-
kind: tlv[3]?.[0] ? parseInt((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
|
|
1527
1847
|
}
|
|
1528
1848
|
};
|
|
1529
1849
|
}
|
|
@@ -1543,8 +1863,8 @@ function decode(code) {
|
|
|
1543
1863
|
type: "naddr",
|
|
1544
1864
|
data: {
|
|
1545
1865
|
identifier: utf8Decoder.decode(tlv[0][0]),
|
|
1546
|
-
pubkey: (0,
|
|
1547
|
-
kind: parseInt((0,
|
|
1866
|
+
pubkey: (0, import_utils7.bytesToHex)(tlv[2][0]),
|
|
1867
|
+
kind: parseInt((0, import_utils7.bytesToHex)(tlv[3][0]), 16),
|
|
1548
1868
|
relays: tlv[1] ? tlv[1].map((d) => utf8Decoder.decode(d)) : []
|
|
1549
1869
|
}
|
|
1550
1870
|
};
|
|
@@ -1553,7 +1873,7 @@ function decode(code) {
|
|
|
1553
1873
|
return { type: prefix, data };
|
|
1554
1874
|
case "npub":
|
|
1555
1875
|
case "note":
|
|
1556
|
-
return { type: prefix, data: (0,
|
|
1876
|
+
return { type: prefix, data: (0, import_utils7.bytesToHex)(data) };
|
|
1557
1877
|
default:
|
|
1558
1878
|
throw new Error(`unknown prefix ${prefix}`);
|
|
1559
1879
|
}
|
|
@@ -1562,6 +1882,8 @@ function parseTLV(data) {
|
|
|
1562
1882
|
let result = {};
|
|
1563
1883
|
let rest = data;
|
|
1564
1884
|
while (rest.length > 0) {
|
|
1885
|
+
if (rest.length < 2)
|
|
1886
|
+
throw new Error("not enough data to read TLV");
|
|
1565
1887
|
let t = rest[0];
|
|
1566
1888
|
let l = rest[1];
|
|
1567
1889
|
let v = rest.slice(2, 2 + l);
|
|
@@ -1577,10 +1899,10 @@ function nsecEncode(key) {
|
|
|
1577
1899
|
return encodeBytes("nsec", key);
|
|
1578
1900
|
}
|
|
1579
1901
|
function npubEncode(hex) {
|
|
1580
|
-
return encodeBytes("npub", (0,
|
|
1902
|
+
return encodeBytes("npub", (0, import_utils7.hexToBytes)(hex));
|
|
1581
1903
|
}
|
|
1582
1904
|
function noteEncode(hex) {
|
|
1583
|
-
return encodeBytes("note", (0,
|
|
1905
|
+
return encodeBytes("note", (0, import_utils7.hexToBytes)(hex));
|
|
1584
1906
|
}
|
|
1585
1907
|
function encodeBech32(prefix, data) {
|
|
1586
1908
|
let words = import_base.bech32.toWords(data);
|
|
@@ -1591,7 +1913,7 @@ function encodeBytes(prefix, bytes) {
|
|
|
1591
1913
|
}
|
|
1592
1914
|
function nprofileEncode(profile) {
|
|
1593
1915
|
let data = encodeTLV({
|
|
1594
|
-
0: [(0,
|
|
1916
|
+
0: [(0, import_utils7.hexToBytes)(profile.pubkey)],
|
|
1595
1917
|
1: (profile.relays || []).map((url) => utf8Encoder.encode(url))
|
|
1596
1918
|
});
|
|
1597
1919
|
return encodeBech32("nprofile", data);
|
|
@@ -1602,9 +1924,9 @@ function neventEncode(event) {
|
|
|
1602
1924
|
kindArray = integerToUint8Array(event.kind);
|
|
1603
1925
|
}
|
|
1604
1926
|
let data = encodeTLV({
|
|
1605
|
-
0: [(0,
|
|
1927
|
+
0: [(0, import_utils7.hexToBytes)(event.id)],
|
|
1606
1928
|
1: (event.relays || []).map((url) => utf8Encoder.encode(url)),
|
|
1607
|
-
2: event.author ? [(0,
|
|
1929
|
+
2: event.author ? [(0, import_utils7.hexToBytes)(event.author)] : [],
|
|
1608
1930
|
3: kindArray ? [new Uint8Array(kindArray)] : []
|
|
1609
1931
|
});
|
|
1610
1932
|
return encodeBech32("nevent", data);
|
|
@@ -1615,7 +1937,7 @@ function naddrEncode(addr) {
|
|
|
1615
1937
|
let data = encodeTLV({
|
|
1616
1938
|
0: [utf8Encoder.encode(addr.identifier)],
|
|
1617
1939
|
1: (addr.relays || []).map((url) => utf8Encoder.encode(url)),
|
|
1618
|
-
2: [(0,
|
|
1940
|
+
2: [(0, import_utils7.hexToBytes)(addr.pubkey)],
|
|
1619
1941
|
3: [new Uint8Array(kind)]
|
|
1620
1942
|
});
|
|
1621
1943
|
return encodeBech32("naddr", data);
|
|
@@ -1631,7 +1953,7 @@ function encodeTLV(tlv) {
|
|
|
1631
1953
|
entries.push(entry);
|
|
1632
1954
|
});
|
|
1633
1955
|
});
|
|
1634
|
-
return (0,
|
|
1956
|
+
return (0, import_utils7.concatBytes)(...entries);
|
|
1635
1957
|
}
|
|
1636
1958
|
|
|
1637
1959
|
// references.ts
|
|
@@ -1729,15 +2051,15 @@ __export(nip04_exports, {
|
|
|
1729
2051
|
decrypt: () => decrypt,
|
|
1730
2052
|
encrypt: () => encrypt
|
|
1731
2053
|
});
|
|
1732
|
-
var
|
|
2054
|
+
var import_utils9 = require("@noble/hashes/utils.js");
|
|
1733
2055
|
var import_secp256k12 = require("@noble/curves/secp256k1.js");
|
|
1734
2056
|
var import_aes = require("@noble/ciphers/aes.js");
|
|
1735
2057
|
var import_base2 = require("@scure/base");
|
|
1736
2058
|
function encrypt(secretKey, pubkey, text) {
|
|
1737
|
-
const privkey = secretKey instanceof Uint8Array ? secretKey : (0,
|
|
1738
|
-
const key = import_secp256k12.secp256k1.getSharedSecret(privkey, (0,
|
|
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));
|
|
1739
2061
|
const normalizedKey = getNormalizedX(key);
|
|
1740
|
-
let iv = Uint8Array.from((0,
|
|
2062
|
+
let iv = Uint8Array.from((0, import_utils9.randomBytes)(16));
|
|
1741
2063
|
let plaintext = utf8Encoder.encode(text);
|
|
1742
2064
|
let ciphertext = (0, import_aes.cbc)(normalizedKey, iv).encrypt(plaintext);
|
|
1743
2065
|
let ctb64 = import_base2.base64.encode(new Uint8Array(ciphertext));
|
|
@@ -1745,9 +2067,9 @@ function encrypt(secretKey, pubkey, text) {
|
|
|
1745
2067
|
return `${ctb64}?iv=${ivb64}`;
|
|
1746
2068
|
}
|
|
1747
2069
|
function decrypt(secretKey, pubkey, data) {
|
|
1748
|
-
const privkey = secretKey instanceof Uint8Array ? secretKey : (0,
|
|
2070
|
+
const privkey = secretKey instanceof Uint8Array ? secretKey : (0, import_utils9.hexToBytes)(secretKey);
|
|
1749
2071
|
let [ctb64, ivb64] = data.split("?iv=");
|
|
1750
|
-
let key = import_secp256k12.secp256k1.getSharedSecret(privkey, (0,
|
|
2072
|
+
let key = import_secp256k12.secp256k1.getSharedSecret(privkey, (0, import_utils9.hexToBytes)("02" + pubkey));
|
|
1751
2073
|
let normalizedKey = getNormalizedX(key);
|
|
1752
2074
|
let iv = import_base2.base64.decode(ivb64);
|
|
1753
2075
|
let ciphertext = import_base2.base64.decode(ctb64);
|
|
@@ -1820,6 +2142,7 @@ var nip10_exports = {};
|
|
|
1820
2142
|
__export(nip10_exports, {
|
|
1821
2143
|
parse: () => parse
|
|
1822
2144
|
});
|
|
2145
|
+
var HEX64 = /^[0-9a-fA-F]{64}$/;
|
|
1823
2146
|
function parse(event) {
|
|
1824
2147
|
const result = {
|
|
1825
2148
|
reply: void 0,
|
|
@@ -1832,12 +2155,12 @@ function parse(event) {
|
|
|
1832
2155
|
let maybeRoot;
|
|
1833
2156
|
for (let i2 = event.tags.length - 1; i2 >= 0; i2--) {
|
|
1834
2157
|
const tag = event.tags[i2];
|
|
1835
|
-
if (tag[0] === "e" && tag[1]) {
|
|
2158
|
+
if (tag[0] === "e" && tag[1] && HEX64.test(tag[1])) {
|
|
1836
2159
|
const [_, eTagEventId, eTagRelayUrl, eTagMarker, eTagAuthor] = tag;
|
|
1837
2160
|
const eventPointer = {
|
|
1838
2161
|
id: eTagEventId,
|
|
1839
2162
|
relays: eTagRelayUrl ? [eTagRelayUrl] : [],
|
|
1840
|
-
author: eTagAuthor
|
|
2163
|
+
author: eTagAuthor && HEX64.test(eTagAuthor) ? eTagAuthor : void 0
|
|
1841
2164
|
};
|
|
1842
2165
|
if (eTagMarker === "root") {
|
|
1843
2166
|
result.root = eventPointer;
|
|
@@ -1859,14 +2182,14 @@ function parse(event) {
|
|
|
1859
2182
|
result.mentions.push(eventPointer);
|
|
1860
2183
|
continue;
|
|
1861
2184
|
}
|
|
1862
|
-
if (tag[0] === "q" && tag[1]) {
|
|
2185
|
+
if (tag[0] === "q" && tag[1] && HEX64.test(tag[1])) {
|
|
1863
2186
|
const [_, eTagEventId, eTagRelayUrl] = tag;
|
|
1864
2187
|
result.quotes.push({
|
|
1865
2188
|
id: eTagEventId,
|
|
1866
2189
|
relays: eTagRelayUrl ? [eTagRelayUrl] : []
|
|
1867
2190
|
});
|
|
1868
2191
|
}
|
|
1869
|
-
if (tag[0] === "p" && tag[1]) {
|
|
2192
|
+
if (tag[0] === "p" && tag[1] && HEX64.test(tag[1])) {
|
|
1870
2193
|
result.profiles.push({
|
|
1871
2194
|
pubkey: tag[1],
|
|
1872
2195
|
relays: tag[2] ? [tag[2]] : []
|
|
@@ -1946,8 +2269,8 @@ __export(nip13_exports, {
|
|
|
1946
2269
|
getPow: () => getPow,
|
|
1947
2270
|
minePow: () => minePow
|
|
1948
2271
|
});
|
|
1949
|
-
var
|
|
1950
|
-
var
|
|
2272
|
+
var import_utils11 = require("@noble/hashes/utils.js");
|
|
2273
|
+
var import_sha23 = require("@noble/hashes/sha2.js");
|
|
1951
2274
|
function getPow(hex) {
|
|
1952
2275
|
let count = 0;
|
|
1953
2276
|
for (let i2 = 0; i2 < 64; i2 += 8) {
|
|
@@ -1986,11 +2309,11 @@ function minePow(unsigned, difficulty) {
|
|
|
1986
2309
|
event.created_at = now2;
|
|
1987
2310
|
}
|
|
1988
2311
|
tag[1] = (++count).toString();
|
|
1989
|
-
const hash = (0,
|
|
2312
|
+
const hash = (0, import_sha23.sha256)(
|
|
1990
2313
|
utf8Encoder.encode(JSON.stringify([0, event.pubkey, event.created_at, event.kind, event.tags, event.content]))
|
|
1991
2314
|
);
|
|
1992
2315
|
if (getPowFromBytes(hash) >= difficulty) {
|
|
1993
|
-
event.id = (0,
|
|
2316
|
+
event.id = (0, import_utils11.bytesToHex)(hash);
|
|
1994
2317
|
break;
|
|
1995
2318
|
}
|
|
1996
2319
|
}
|
|
@@ -2027,22 +2350,22 @@ __export(nip44_exports, {
|
|
|
2027
2350
|
v2: () => v2
|
|
2028
2351
|
});
|
|
2029
2352
|
var import_chacha = require("@noble/ciphers/chacha.js");
|
|
2030
|
-
var
|
|
2353
|
+
var import_utils13 = require("@noble/ciphers/utils.js");
|
|
2031
2354
|
var import_secp256k13 = require("@noble/curves/secp256k1.js");
|
|
2032
2355
|
var import_hkdf = require("@noble/hashes/hkdf.js");
|
|
2033
2356
|
var import_hmac = require("@noble/hashes/hmac.js");
|
|
2034
|
-
var
|
|
2035
|
-
var
|
|
2357
|
+
var import_sha24 = require("@noble/hashes/sha2.js");
|
|
2358
|
+
var import_utils14 = require("@noble/hashes/utils.js");
|
|
2036
2359
|
var import_base3 = require("@scure/base");
|
|
2037
2360
|
var minPlaintextSize = 1;
|
|
2038
2361
|
var maxPlaintextSize = 4294967295;
|
|
2039
2362
|
var extendedPrefixThreshold = 65536;
|
|
2040
2363
|
function getConversationKey(privkeyA, pubkeyB) {
|
|
2041
|
-
const sharedX = import_secp256k13.secp256k1.getSharedSecret(privkeyA, (0,
|
|
2042
|
-
return (0, import_hkdf.extract)(
|
|
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"));
|
|
2043
2366
|
}
|
|
2044
2367
|
function getMessageKeys(conversationKey, nonce) {
|
|
2045
|
-
const keys = (0, import_hkdf.expand)(
|
|
2368
|
+
const keys = (0, import_hkdf.expand)(import_sha24.sha256, conversationKey, nonce, 76);
|
|
2046
2369
|
return {
|
|
2047
2370
|
chacha_key: keys.subarray(0, 32),
|
|
2048
2371
|
chacha_nonce: keys.subarray(32, 44),
|
|
@@ -2077,9 +2400,9 @@ function pad(plaintext) {
|
|
|
2077
2400
|
const unpaddedLen = unpadded.length;
|
|
2078
2401
|
if (unpaddedLen < minPlaintextSize || unpaddedLen > maxPlaintextSize)
|
|
2079
2402
|
throw new Error("invalid plaintext size: must be between 1 and 4294967295 bytes");
|
|
2080
|
-
const prefix = unpaddedLen >= extendedPrefixThreshold ? (0,
|
|
2403
|
+
const prefix = unpaddedLen >= extendedPrefixThreshold ? (0, import_utils14.concatBytes)(new Uint8Array([0, 0]), writeU32BE(unpaddedLen)) : writeU16BE(unpaddedLen);
|
|
2081
2404
|
const suffix = new Uint8Array(calcPaddedLen(unpaddedLen) - unpaddedLen);
|
|
2082
|
-
return (0,
|
|
2405
|
+
return (0, import_utils14.concatBytes)(prefix, unpadded, suffix);
|
|
2083
2406
|
}
|
|
2084
2407
|
function unpad(padded) {
|
|
2085
2408
|
const dv = new DataView(padded.buffer, padded.byteOffset, padded.byteLength);
|
|
@@ -2103,8 +2426,8 @@ function unpad(padded) {
|
|
|
2103
2426
|
function hmacAad(key, message, aad) {
|
|
2104
2427
|
if (aad.length !== 32)
|
|
2105
2428
|
throw new Error("AAD associated data must be 32 bytes");
|
|
2106
|
-
const combined = (0,
|
|
2107
|
-
return (0, import_hmac.hmac)(
|
|
2429
|
+
const combined = (0, import_utils14.concatBytes)(aad, message);
|
|
2430
|
+
return (0, import_hmac.hmac)(import_sha24.sha256, key, combined);
|
|
2108
2431
|
}
|
|
2109
2432
|
function decodePayload(payload) {
|
|
2110
2433
|
if (typeof payload !== "string")
|
|
@@ -2132,18 +2455,18 @@ function decodePayload(payload) {
|
|
|
2132
2455
|
mac: data.subarray(-32)
|
|
2133
2456
|
};
|
|
2134
2457
|
}
|
|
2135
|
-
function encrypt2(plaintext, conversationKey, nonce = (0,
|
|
2458
|
+
function encrypt2(plaintext, conversationKey, nonce = (0, import_utils14.randomBytes)(32)) {
|
|
2136
2459
|
const { chacha_key, chacha_nonce, hmac_key } = getMessageKeys(conversationKey, nonce);
|
|
2137
2460
|
const padded = pad(plaintext);
|
|
2138
2461
|
const ciphertext = (0, import_chacha.chacha20)(chacha_key, chacha_nonce, padded);
|
|
2139
2462
|
const mac = hmacAad(hmac_key, ciphertext, nonce);
|
|
2140
|
-
return import_base3.base64.encode((0,
|
|
2463
|
+
return import_base3.base64.encode((0, import_utils14.concatBytes)(new Uint8Array([2]), nonce, ciphertext, mac));
|
|
2141
2464
|
}
|
|
2142
2465
|
function decrypt2(payload, conversationKey) {
|
|
2143
2466
|
const { nonce, ciphertext, mac } = decodePayload(payload);
|
|
2144
2467
|
const { chacha_key, chacha_nonce, hmac_key } = getMessageKeys(conversationKey, nonce);
|
|
2145
2468
|
const calculatedMac = hmacAad(hmac_key, ciphertext, nonce);
|
|
2146
|
-
if (!(0,
|
|
2469
|
+
if (!(0, import_utils13.equalBytes)(calculatedMac, mac))
|
|
2147
2470
|
throw new Error("invalid MAC");
|
|
2148
2471
|
const padded = (0, import_chacha.chacha20)(chacha_key, chacha_nonce, ciphertext);
|
|
2149
2472
|
return unpad(padded);
|
|
@@ -2363,6 +2686,7 @@ var nip22_exports = {};
|
|
|
2363
2686
|
__export(nip22_exports, {
|
|
2364
2687
|
parse: () => parse3
|
|
2365
2688
|
});
|
|
2689
|
+
var HEX642 = /^[0-9a-fA-F]{64}$/;
|
|
2366
2690
|
function parseKind(kind) {
|
|
2367
2691
|
if (!kind)
|
|
2368
2692
|
return void 0;
|
|
@@ -2376,9 +2700,12 @@ function parseAddressPointer(value, relayUrl) {
|
|
|
2376
2700
|
const kind = parseInt(value.slice(0, idx), 10);
|
|
2377
2701
|
if (Number.isNaN(kind))
|
|
2378
2702
|
return void 0;
|
|
2703
|
+
const pubkey = value.slice(idx + 1, idx2);
|
|
2704
|
+
if (!HEX642.test(pubkey))
|
|
2705
|
+
return void 0;
|
|
2379
2706
|
return {
|
|
2380
2707
|
kind,
|
|
2381
|
-
pubkey
|
|
2708
|
+
pubkey,
|
|
2382
2709
|
identifier: value.slice(idx2 + 1),
|
|
2383
2710
|
relays: relayUrl ? [relayUrl] : []
|
|
2384
2711
|
};
|
|
@@ -2387,12 +2714,12 @@ function parsePointer(tag) {
|
|
|
2387
2714
|
switch (tag[0]) {
|
|
2388
2715
|
case "E":
|
|
2389
2716
|
case "e":
|
|
2390
|
-
if (!tag[1])
|
|
2717
|
+
if (!tag[1] || !HEX642.test(tag[1]))
|
|
2391
2718
|
return void 0;
|
|
2392
2719
|
return {
|
|
2393
2720
|
id: tag[1],
|
|
2394
2721
|
relays: tag[2] ? [tag[2]] : [],
|
|
2395
|
-
author: tag[3]
|
|
2722
|
+
author: tag[3] && HEX642.test(tag[3]) ? tag[3] : void 0
|
|
2396
2723
|
};
|
|
2397
2724
|
case "A":
|
|
2398
2725
|
case "a":
|
|
@@ -2415,10 +2742,12 @@ function parseQuote(tag) {
|
|
|
2415
2742
|
if (tag[1].includes(":")) {
|
|
2416
2743
|
return parseAddressPointer(tag[1], tag[2]);
|
|
2417
2744
|
}
|
|
2745
|
+
if (!HEX642.test(tag[1]))
|
|
2746
|
+
return void 0;
|
|
2418
2747
|
return {
|
|
2419
2748
|
id: tag[1],
|
|
2420
2749
|
relays: tag[2] ? [tag[2]] : [],
|
|
2421
|
-
author: tag[3]
|
|
2750
|
+
author: tag[3] && HEX642.test(tag[3]) ? tag[3] : void 0
|
|
2422
2751
|
};
|
|
2423
2752
|
}
|
|
2424
2753
|
function choosePointer(candidates) {
|
|
@@ -2478,7 +2807,7 @@ function parse3(event) {
|
|
|
2478
2807
|
result.quotes.push(pointer);
|
|
2479
2808
|
continue;
|
|
2480
2809
|
}
|
|
2481
|
-
if ((tag[0] === "P" || tag[0] === "p") && tag[1]) {
|
|
2810
|
+
if ((tag[0] === "P" || tag[0] === "p") && tag[1] && HEX642.test(tag[1])) {
|
|
2482
2811
|
result.profiles.push({
|
|
2483
2812
|
pubkey: tag[1],
|
|
2484
2813
|
relays: tag[2] ? [tag[2]] : []
|
|
@@ -3057,8 +3386,8 @@ __export(nip77_exports, {
|
|
|
3057
3386
|
NegentropyStorageVector: () => NegentropyStorageVector,
|
|
3058
3387
|
NegentropySync: () => NegentropySync
|
|
3059
3388
|
});
|
|
3060
|
-
var
|
|
3061
|
-
var
|
|
3389
|
+
var import_utils17 = require("@noble/hashes/utils.js");
|
|
3390
|
+
var import_sha25 = require("@noble/hashes/sha2.js");
|
|
3062
3391
|
var PROTOCOL_VERSION = 97;
|
|
3063
3392
|
var ID_SIZE = 32;
|
|
3064
3393
|
var FINGERPRINT_SIZE = 16;
|
|
@@ -3189,7 +3518,7 @@ var Accumulator = class {
|
|
|
3189
3518
|
let input = new WrappedBuffer();
|
|
3190
3519
|
input.extend(this.buf);
|
|
3191
3520
|
input.extend(encodeVarInt(n));
|
|
3192
|
-
let hash = (0,
|
|
3521
|
+
let hash = (0, import_sha25.sha256)(input.unwrap());
|
|
3193
3522
|
return hash.subarray(0, FINGERPRINT_SIZE);
|
|
3194
3523
|
}
|
|
3195
3524
|
};
|
|
@@ -3203,7 +3532,7 @@ var NegentropyStorageVector = class {
|
|
|
3203
3532
|
insert(timestamp, id) {
|
|
3204
3533
|
if (this.sealed)
|
|
3205
3534
|
throw Error("already sealed");
|
|
3206
|
-
const idb = (0,
|
|
3535
|
+
const idb = (0, import_utils17.hexToBytes)(id);
|
|
3207
3536
|
if (idb.byteLength !== ID_SIZE)
|
|
3208
3537
|
throw Error("bad id size for added item");
|
|
3209
3538
|
this.items.push({ timestamp, id: idb });
|
|
@@ -3297,10 +3626,10 @@ var Negentropy = class {
|
|
|
3297
3626
|
let output = new WrappedBuffer();
|
|
3298
3627
|
output.extend(new Uint8Array([PROTOCOL_VERSION]));
|
|
3299
3628
|
this.splitRange(0, this.storage.size(), this._bound(Number.MAX_VALUE), output);
|
|
3300
|
-
return (0,
|
|
3629
|
+
return (0, import_utils17.bytesToHex)(output.unwrap());
|
|
3301
3630
|
}
|
|
3302
3631
|
reconcile(queryMsg, onhave, onneed) {
|
|
3303
|
-
const query = new WrappedBuffer((0,
|
|
3632
|
+
const query = new WrappedBuffer((0, import_utils17.hexToBytes)(queryMsg));
|
|
3304
3633
|
this.lastTimestampIn = this.lastTimestampOut = 0;
|
|
3305
3634
|
let fullOutput = new WrappedBuffer();
|
|
3306
3635
|
fullOutput.extend(new Uint8Array([PROTOCOL_VERSION]));
|
|
@@ -3343,22 +3672,22 @@ var Negentropy = class {
|
|
|
3343
3672
|
let theirElems = {};
|
|
3344
3673
|
for (let i2 = 0; i2 < numIds; i2++) {
|
|
3345
3674
|
let e = getBytes(query, ID_SIZE);
|
|
3346
|
-
theirElems[(0,
|
|
3675
|
+
theirElems[(0, import_utils17.bytesToHex)(e)] = e;
|
|
3347
3676
|
}
|
|
3348
3677
|
skip = true;
|
|
3349
3678
|
this.storage.iterate(lower, upper, (item) => {
|
|
3350
3679
|
let k = item.id;
|
|
3351
|
-
const id = (0,
|
|
3680
|
+
const id = (0, import_utils17.bytesToHex)(k);
|
|
3352
3681
|
if (!theirElems[id]) {
|
|
3353
3682
|
onhave?.(id);
|
|
3354
3683
|
} else {
|
|
3355
|
-
delete theirElems[(0,
|
|
3684
|
+
delete theirElems[(0, import_utils17.bytesToHex)(k)];
|
|
3356
3685
|
}
|
|
3357
3686
|
return true;
|
|
3358
3687
|
});
|
|
3359
3688
|
if (onneed) {
|
|
3360
3689
|
for (let v of Object.values(theirElems)) {
|
|
3361
|
-
onneed((0,
|
|
3690
|
+
onneed((0, import_utils17.bytesToHex)(v));
|
|
3362
3691
|
}
|
|
3363
3692
|
}
|
|
3364
3693
|
} else {
|
|
@@ -3376,7 +3705,7 @@ var Negentropy = class {
|
|
|
3376
3705
|
prevIndex = upper;
|
|
3377
3706
|
prevBound = currBound;
|
|
3378
3707
|
}
|
|
3379
|
-
return fullOutput.length === 1 ? null : (0,
|
|
3708
|
+
return fullOutput.length === 1 ? null : (0, import_utils17.bytesToHex)(fullOutput.unwrap());
|
|
3380
3709
|
}
|
|
3381
3710
|
splitRange(lower, upper, upperBound, o) {
|
|
3382
3711
|
let numElems = upper - lower;
|
|
@@ -3564,8 +3893,8 @@ __export(nip98_exports, {
|
|
|
3564
3893
|
validateEventUrlTag: () => validateEventUrlTag,
|
|
3565
3894
|
validateToken: () => validateToken
|
|
3566
3895
|
});
|
|
3567
|
-
var
|
|
3568
|
-
var
|
|
3896
|
+
var import_sha26 = require("@noble/hashes/sha2.js");
|
|
3897
|
+
var import_utils18 = require("@noble/hashes/utils.js");
|
|
3569
3898
|
var import_base5 = require("@scure/base");
|
|
3570
3899
|
var _authorizationScheme = "Nostr ";
|
|
3571
3900
|
async function getToken(loginUrl, httpMethod, sign, includeAuthorizationScheme = false, payload) {
|
|
@@ -3630,8 +3959,8 @@ function validateEventMethodTag(event, method) {
|
|
|
3630
3959
|
return methodTag.length > 0 && methodTag[1].toLowerCase() === method.toLowerCase();
|
|
3631
3960
|
}
|
|
3632
3961
|
function hashPayload(payload) {
|
|
3633
|
-
const hash = (0,
|
|
3634
|
-
return (0,
|
|
3962
|
+
const hash = (0, import_sha26.sha256)(utf8Encoder.encode(JSON.stringify(payload)));
|
|
3963
|
+
return (0, import_utils18.bytesToHex)(hash);
|
|
3635
3964
|
}
|
|
3636
3965
|
function validateEventPayloadTag(event, payload) {
|
|
3637
3966
|
const payloadTag = event.tags.find((t) => t[0] === "payload");
|