nostr-tools 2.23.3 → 2.23.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.
Files changed (122) hide show
  1. package/lib/cjs/index.js +175 -15
  2. package/lib/cjs/index.js.map +4 -4
  3. package/lib/cjs/nip17.js +31 -9
  4. package/lib/cjs/nip17.js.map +2 -2
  5. package/lib/cjs/nip22.js +154 -0
  6. package/lib/cjs/nip22.js.map +7 -0
  7. package/lib/cjs/nip44.js +34 -10
  8. package/lib/cjs/nip44.js.map +2 -2
  9. package/lib/cjs/nip46.js +34 -10
  10. package/lib/cjs/nip46.js.map +2 -2
  11. package/lib/cjs/nip47.js +3 -3
  12. package/lib/cjs/nip47.js.map +2 -2
  13. package/lib/cjs/nip59.js +31 -9
  14. package/lib/cjs/nip59.js.map +2 -2
  15. package/lib/esm/index.js +175 -15
  16. package/lib/esm/index.js.map +4 -4
  17. package/lib/esm/nip17.js +31 -9
  18. package/lib/esm/nip17.js.map +2 -2
  19. package/lib/esm/nip22.js +133 -0
  20. package/lib/esm/nip22.js.map +7 -0
  21. package/lib/esm/nip44.js +34 -10
  22. package/lib/esm/nip44.js.map +2 -2
  23. package/lib/esm/nip46.js +34 -10
  24. package/lib/esm/nip46.js.map +2 -2
  25. package/lib/esm/nip47.js +3 -3
  26. package/lib/esm/nip47.js.map +2 -2
  27. package/lib/esm/nip59.js +31 -9
  28. package/lib/esm/nip59.js.map +2 -2
  29. package/lib/nostr.bundle.js +175 -15
  30. package/lib/nostr.bundle.js.map +4 -4
  31. package/package.json +8 -2
  32. package/lib/types/abstract-pool.d.ts +0 -60
  33. package/lib/types/abstract-relay.d.ts +0 -110
  34. package/lib/types/benchmarks.d.ts +0 -1
  35. package/lib/types/core.d.ts +0 -32
  36. package/lib/types/core.test.d.ts +0 -1
  37. package/lib/types/fakejson.d.ts +0 -6
  38. package/lib/types/fakejson.test.d.ts +0 -1
  39. package/lib/types/filter.d.ts +0 -19
  40. package/lib/types/filter.test.d.ts +0 -1
  41. package/lib/types/helpers.d.ts +0 -2
  42. package/lib/types/index.d.ts +0 -30
  43. package/lib/types/kinds.d.ts +0 -200
  44. package/lib/types/kinds.test.d.ts +0 -1
  45. package/lib/types/nip04.d.ts +0 -2
  46. package/lib/types/nip04.test.d.ts +0 -1
  47. package/lib/types/nip05.d.ts +0 -17
  48. package/lib/types/nip05.test.d.ts +0 -1
  49. package/lib/types/nip06.d.ts +0 -15
  50. package/lib/types/nip06.test.d.ts +0 -1
  51. package/lib/types/nip07.d.ts +0 -13
  52. package/lib/types/nip10.d.ts +0 -24
  53. package/lib/types/nip10.test.d.ts +0 -1
  54. package/lib/types/nip11.d.ts +0 -266
  55. package/lib/types/nip11.test.d.ts +0 -1
  56. package/lib/types/nip13.d.ts +0 -8
  57. package/lib/types/nip13.test.d.ts +0 -1
  58. package/lib/types/nip17.d.ts +0 -15
  59. package/lib/types/nip17.test.d.ts +0 -1
  60. package/lib/types/nip18.d.ts +0 -22
  61. package/lib/types/nip18.test.d.ts +0 -1
  62. package/lib/types/nip19.d.ts +0 -81
  63. package/lib/types/nip19.test.d.ts +0 -1
  64. package/lib/types/nip21.d.ts +0 -34
  65. package/lib/types/nip21.test.d.ts +0 -1
  66. package/lib/types/nip25.d.ts +0 -15
  67. package/lib/types/nip25.test.d.ts +0 -1
  68. package/lib/types/nip27.d.ts +0 -32
  69. package/lib/types/nip27.test.d.ts +0 -1
  70. package/lib/types/nip28.d.ts +0 -46
  71. package/lib/types/nip28.test.d.ts +0 -1
  72. package/lib/types/nip29.d.ts +0 -265
  73. package/lib/types/nip30.d.ts +0 -22
  74. package/lib/types/nip30.test.d.ts +0 -1
  75. package/lib/types/nip39.d.ts +0 -2
  76. package/lib/types/nip39.test.d.ts +0 -1
  77. package/lib/types/nip40.d.ts +0 -10
  78. package/lib/types/nip40.test.d.ts +0 -1
  79. package/lib/types/nip42.d.ts +0 -5
  80. package/lib/types/nip42.test.d.ts +0 -1
  81. package/lib/types/nip44.d.ts +0 -13
  82. package/lib/types/nip44.test.d.ts +0 -1
  83. package/lib/types/nip46.d.ts +0 -117
  84. package/lib/types/nip47.d.ts +0 -9
  85. package/lib/types/nip47.test.d.ts +0 -1
  86. package/lib/types/nip49.d.ts +0 -3
  87. package/lib/types/nip49.test.d.ts +0 -1
  88. package/lib/types/nip54.d.ts +0 -1
  89. package/lib/types/nip54.test.d.ts +0 -1
  90. package/lib/types/nip55.d.ts +0 -30
  91. package/lib/types/nip55.test.d.ts +0 -1
  92. package/lib/types/nip57.d.ts +0 -25
  93. package/lib/types/nip57.test.d.ts +0 -1
  94. package/lib/types/nip58.d.ts +0 -134
  95. package/lib/types/nip58.test.d.ts +0 -1
  96. package/lib/types/nip59.d.ts +0 -12
  97. package/lib/types/nip59.test.d.ts +0 -1
  98. package/lib/types/nip75.d.ts +0 -61
  99. package/lib/types/nip75.test.d.ts +0 -1
  100. package/lib/types/nip77.d.ts +0 -102
  101. package/lib/types/nip77.test.d.ts +0 -1
  102. package/lib/types/nip94.d.ts +0 -87
  103. package/lib/types/nip94.test.d.ts +0 -1
  104. package/lib/types/nip98.d.ts +0 -74
  105. package/lib/types/nip98.test.d.ts +0 -1
  106. package/lib/types/nip99.d.ts +0 -92
  107. package/lib/types/nip99.test.d.ts +0 -1
  108. package/lib/types/nipb7.d.ts +0 -23
  109. package/lib/types/nipb7.test.d.ts +0 -1
  110. package/lib/types/pool.d.ts +0 -6
  111. package/lib/types/pool.test.d.ts +0 -1
  112. package/lib/types/pure.d.ts +0 -8
  113. package/lib/types/pure.test.d.ts +0 -1
  114. package/lib/types/references.d.ts +0 -10
  115. package/lib/types/references.test.d.ts +0 -1
  116. package/lib/types/relay.d.ts +0 -11
  117. package/lib/types/relay.test.d.ts +0 -1
  118. package/lib/types/signer.d.ts +0 -11
  119. package/lib/types/test-helpers.d.ts +0 -14
  120. package/lib/types/utils.d.ts +0 -9
  121. package/lib/types/utils.test.d.ts +0 -1
  122. package/lib/types/wasm.d.ts +0 -8
@@ -1,266 +0,0 @@
1
- export declare function useFetchImplementation(fetchImplementation: any): void;
2
- export declare function fetchRelayInformation(url: string): Promise<RelayInformation>;
3
- /**
4
- * ## Relay Information Document
5
-
6
- * Relays may provide server metadata to clients to inform
7
- * them of capabilities, administrative contacts, and
8
- * various server attributes. This is made available as a
9
- * JSON document over HTTP, on the same URI as the relay's
10
- * websocket.
11
-
12
- * Any field may be omitted, and clients MUST ignore any
13
- * additional fields they do not understand. Relays MUST
14
- * accept CORS requests by sending
15
- * `Access-Control-Allow-Origin`,
16
- * `Access-Control-Allow-Headers`, and
17
- * `Access-Control-Allow-Methods` headers.
18
- * @param name string identifying relay
19
- * @param description string with detailed information
20
- * @param pubkey administrative contact pubkey
21
- * @param contact: administrative alternate contact
22
- * @param supported_nips a list of NIP numbers supported by
23
- * the relay
24
- * @param software identifying relay software URL
25
- * @param version string version identifier
26
- */
27
- export interface BasicRelayInformation {
28
- name: string;
29
- description: string;
30
- pubkey: string;
31
- contact: string;
32
- supported_nips: number[];
33
- software: string;
34
- version: string;
35
- }
36
- /**
37
- * * ## Extra Fields
38
-
39
- * * ### Server Limitations
40
-
41
- * These are limitations imposed by the relay on clients.
42
- * Your client should expect that requests which exceed
43
- * these practical_ limitations are rejected or fail immediately.
44
- * @param max_message_length this is the maximum number of
45
- * bytes for incoming JSON that the relay will attempt to
46
- * decode and act upon. When you send large subscriptions,
47
- * you will be limited by this value. It also effectively
48
- * limits the maximum size of any event. Value is calculated
49
- * from `[` to `]` and is after UTF-8 serialization (so some
50
- * unicode characters will cost 2-3 bytes). It is equal to
51
- * the maximum size of the WebSocket message frame.
52
- * @param max_subscriptions total number of subscriptions
53
- * that may be active on a single websocket connection to
54
- * this relay. It's possible that authenticated clients with
55
- * a (paid) relationship to the relay may have higher limits.
56
- * @param max_filters maximum number of filter values in
57
- * each subscription. Must be one or higher.
58
- * @param max_limit the relay server will clamp each
59
- * filter's `limit` value to this number.
60
- * This means the client won't be able to get more than this
61
- * number of events from a single subscription filter. This
62
- * clamping is typically done silently by the relay, but
63
- * with this number, you can know that there are additional
64
- * results if you narrowed your filter's time range or other
65
- * parameters.
66
- * @param max_subid_length maximum length of subscription id as a
67
- * string.
68
- * @param min_prefix for `authors` and `ids` filters which
69
- * are to match against a hex prefix, you must provide at
70
- * least this many hex digits in the prefix.
71
- * @param max_event_tags in any event, this is the maximum
72
- * number of elements in the `tags` list.
73
- * @param max_content_length maximum number of characters in
74
- * the `content` field of any event. This is a count of
75
- * unicode characters. After serializing into JSON it may be
76
- * larger (in bytes), and is still subject to the
77
- * max_message_length`, if defined.
78
- * @param min_pow_difficulty new events will require at
79
- * least this difficulty of PoW, based on [NIP-13](13.md),
80
- * or they will be rejected by this server.
81
- * @param auth_required this relay requires [NIP-42](42.md)
82
- * authentication to happen before a new connection may
83
- * perform any other action. Even if set to False,
84
- * authentication may be required for specific actions.
85
- * @param restricted_writes: this relay requires some kind
86
- * of condition to be fulfilled in order to accept events
87
- * (not necessarily, but including
88
- * @param payment_required this relay requires payment
89
- * before a new connection may perform any action.
90
- * @param created_at_lower_limit: 'created_at' lower limit
91
- * @param created_at_upper_limit: 'created_at' upper limit
92
- */
93
- export interface Limitations {
94
- max_message_length: number;
95
- max_subscriptions: number;
96
- max_filters: number;
97
- max_limit: number;
98
- max_subid_length: number;
99
- min_prefix: number;
100
- max_event_tags: number;
101
- max_content_length: number;
102
- min_pow_difficulty: number;
103
- auth_required: boolean;
104
- payment_required: boolean;
105
- created_at_lower_limit: number;
106
- created_at_upper_limit: number;
107
- restricted_writes: boolean;
108
- }
109
- export interface RetentionDetails {
110
- kinds: (number | number[])[];
111
- time?: number | null;
112
- count?: number | null;
113
- }
114
- type AnyRetentionDetails = RetentionDetails;
115
- /**
116
- * ### Event Retention
117
-
118
- * There may be a cost associated with storing data forever,
119
- * so relays may wish to state retention times. The values
120
- * stated here are defaults for unauthenticated users and
121
- * visitors. Paid users would likely have other policies.
122
-
123
- * Retention times are given in seconds, with `null`
124
- * indicating infinity. If zero is provided, this means the
125
- * event will not be stored at all, and preferably an error
126
- * will be provided when those are received.
127
- * ```json
128
- {
129
- ...
130
- "retention": [
131
- { "kinds": [0, 1, [5, 7], [40, 49]], "time": 3600 },
132
- { "kinds": [[40000, 49999]], "time": 100 },
133
- { "kinds": [[30000, 39999]], "count": 1000 },
134
- { "time": 3600, "count": 10000 }
135
- ]
136
- ...
137
- }
138
- ```
139
- * @param retention is a list of specifications: each will
140
- * apply to either all kinds, or a subset of kinds. Ranges
141
- * may be specified for the kind field as a tuple of
142
- * inclusive start and end values. Events of indicated kind
143
- * (or all) are then limited to a `count` and/or time
144
- * period.
145
-
146
- * It is possible to effectively blacklist Nostr-based
147
- * protocols that rely on a specific `kind` number, by
148
- * giving a retention time of zero for those `kind` values.
149
- * While that is unfortunate, it does allow clients to
150
- * discover servers that will support their protocol quickly
151
- * via a single HTTP fetch.
152
-
153
- * There is no need to specify retention times for
154
- * _ephemeral events_ as defined in [NIP-16](16.md) since
155
- * they are not retained.
156
- */
157
- export interface Retention {
158
- retention: AnyRetentionDetails[];
159
- }
160
- /**
161
- * Some relays may be governed by the arbitrary laws of a
162
- * nation state. This may limit what content can be stored
163
- * in cleartext on those relays. All clients are encouraged
164
- * to use encryption to work around this limitation.
165
-
166
- * It is not possible to describe the limitations of each
167
- * country's laws and policies which themselves are
168
- * typically vague and constantly shifting.
169
-
170
- * Therefore, this field allows the relay operator to
171
- * indicate which countries' laws might end up being
172
- * enforced on them, and then indirectly on their users'
173
- * content.
174
-
175
- * Users should be able to avoid relays in countries they
176
- * don't like, and/or select relays in more favourable
177
- * zones. Exposing this flexibility is up to the client
178
- * software.
179
-
180
- * @param relay_countries a list of two-level ISO country
181
- * codes (ISO 3166-1 alpha-2) whose laws and policies may
182
- * affect this relay. `EU` may be used for European Union
183
- * countries.
184
-
185
- * Remember that a relay may be hosted in a country which is
186
- * not the country of the legal entities who own the relay,
187
- * so it's very likely a number of countries are involved.
188
- */
189
- export interface ContentLimitations {
190
- relay_countries: string[];
191
- }
192
- /**
193
- * ### Community Preferences
194
-
195
- * For public text notes at least, a relay may try to foster
196
- * a local community. This would encourage users to follow
197
- * the global feed on that relay, in addition to their usual
198
- * individual follows. To support this goal, relays MAY
199
- * specify some of the following values.
200
-
201
- * @param language_tags is an ordered list of [IETF
202
- * language
203
- * tags](https://en.wikipedia.org/wiki/IETF_language_tag
204
- * indicating the major languages spoken on the relay.
205
- * @param tags is a list of limitations on the topics to be
206
- * discussed. For example `sfw-only` indicates that only
207
- * "Safe For Work" content is encouraged on this relay. This
208
- * relies on assumptions of what the "work" "community"
209
- * feels "safe" talking about. In time, a common set of tags
210
- * may emerge that allow users to find relays that suit
211
- * their needs, and client software will be able to parse
212
- * these tags easily. The `bitcoin-only` tag indicates that
213
- * any _altcoin_, _"crypto"_ or _blockchain_ comments will
214
- * be ridiculed without mercy.
215
- * @param posting_policy is a link to a human-readable page
216
- * which specifies the community policies for the relay. In
217
- * cases where `sfw-only` is True, it's important to link to
218
- * a page which gets into the specifics of your posting
219
- * policy.
220
-
221
- * The `description` field should be used to describe your
222
- * community goals and values, in brief. The
223
- * `posting_policy` is for additional detail and legal
224
- * terms. Use the `tags` field to signify limitations on
225
- * content, or topics to be discussed, which could be
226
- * machine processed by appropriate client software.
227
- */
228
- export interface CommunityPreferences {
229
- language_tags: string[];
230
- tags: string[];
231
- posting_policy: string;
232
- }
233
- export interface Amount {
234
- amount: number;
235
- unit: 'msat';
236
- }
237
- export interface PublicationAmount extends Amount {
238
- kinds: number[];
239
- }
240
- export interface Subscription extends Amount {
241
- period: number;
242
- }
243
- export interface Fees {
244
- admission: Amount[];
245
- subscription: Subscription[];
246
- publication: PublicationAmount[];
247
- }
248
- /**
249
- * Relays that require payments may want to expose their fee
250
- * schedules.
251
- */
252
- export interface PayToRelay {
253
- payments_url: string;
254
- fees: Fees;
255
- }
256
- /**
257
- * A URL pointing to an image to be used as an icon for the
258
- * relay. Recommended to be squared in shape.
259
- */
260
- export interface Icon {
261
- icon: string;
262
- }
263
- export type RelayInformation = BasicRelayInformation & Partial<Retention> & {
264
- limitation?: Partial<Limitations>;
265
- } & Partial<ContentLimitations> & Partial<CommunityPreferences> & Partial<PayToRelay> & Partial<Icon>;
266
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,8 +0,0 @@
1
- import { type UnsignedEvent, type Event } from './pure.ts';
2
- /** Get POW difficulty from a Nostr hex ID. */
3
- export declare function getPow(hex: string): number;
4
- /**
5
- * Mine an event with the desired POW. This function mutates the event.
6
- * Note that this operation is synchronous and should be run in a worker context to avoid blocking the main thread.
7
- */
8
- export declare function minePow(unsigned: UnsignedEvent, difficulty: number): Omit<Event, 'sig'>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,15 +0,0 @@
1
- import { NostrEvent } from './pure.ts';
2
- import * as nip59 from './nip59.ts';
3
- type Recipient = {
4
- publicKey: string;
5
- relayUrl?: string;
6
- };
7
- type ReplyTo = {
8
- eventId: string;
9
- relayUrl?: string;
10
- };
11
- export declare function wrapEvent(senderPrivateKey: Uint8Array, recipient: Recipient, message: string, conversationTitle?: string, replyTo?: ReplyTo): NostrEvent;
12
- export declare function wrapManyEvents(senderPrivateKey: Uint8Array, recipients: Recipient[], message: string, conversationTitle?: string, replyTo?: ReplyTo): NostrEvent[];
13
- export declare const unwrapEvent: typeof nip59.unwrapEvent;
14
- export declare const unwrapManyEvents: typeof nip59.unwrapManyEvents;
15
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,22 +0,0 @@
1
- import { EventPointer } from './nip19.ts';
2
- import { Event } from './pure.ts';
3
- export type RepostEventTemplate = {
4
- /**
5
- * Pass only non-nip18 tags if you have to.
6
- * Nip18 tags ('e' and 'p' tags pointing to the reposted event) will be added automatically.
7
- */
8
- tags?: string[][];
9
- /**
10
- * Pass an empty string to NOT include the stringified JSON of the reposted event.
11
- * Any other content will be ignored and replaced with the stringified JSON of the reposted event.
12
- * @default Stringified JSON of the reposted event
13
- */
14
- content?: '';
15
- created_at: number;
16
- };
17
- export declare function finishRepostEvent(t: RepostEventTemplate, reposted: Event, relayUrl: string, privateKey: Uint8Array): Event;
18
- export declare function getRepostedEventPointer(event: Event): undefined | EventPointer;
19
- export type GetRepostedEventOptions = {
20
- skipVerification?: boolean;
21
- };
22
- export declare function getRepostedEvent(event: Event, { skipVerification }?: GetRepostedEventOptions): undefined | Event;
@@ -1 +0,0 @@
1
- export {};
@@ -1,81 +0,0 @@
1
- export type NProfile = `nprofile1${string}`;
2
- export type NEvent = `nevent1${string}`;
3
- export type NAddr = `naddr1${string}`;
4
- export type NSec = `nsec1${string}`;
5
- export type NPub = `npub1${string}`;
6
- export type Note = `note1${string}`;
7
- export type Ncryptsec = `ncryptsec1${string}`;
8
- export declare const NostrTypeGuard: {
9
- isNProfile: (value?: string | null) => value is NProfile;
10
- isNEvent: (value?: string | null) => value is NEvent;
11
- isNAddr: (value?: string | null) => value is NAddr;
12
- isNSec: (value?: string | null) => value is NSec;
13
- isNPub: (value?: string | null) => value is NPub;
14
- isNote: (value?: string | null) => value is Note;
15
- isNcryptsec: (value?: string | null) => value is Ncryptsec;
16
- };
17
- export declare const Bech32MaxSize = 5000;
18
- /**
19
- * Bech32 regex.
20
- * @see https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#bech32
21
- */
22
- export declare const BECH32_REGEX: RegExp;
23
- export type ProfilePointer = {
24
- pubkey: string;
25
- relays?: string[];
26
- };
27
- export type EventPointer = {
28
- id: string;
29
- relays?: string[];
30
- author?: string;
31
- kind?: number;
32
- };
33
- export type AddressPointer = {
34
- identifier: string;
35
- pubkey: string;
36
- kind: number;
37
- relays?: string[];
38
- };
39
- export declare function decodeNostrURI(nip19code: string): ReturnType<typeof decode> | {
40
- type: 'invalid';
41
- data: null;
42
- };
43
- export type DecodedNevent = {
44
- type: 'nevent';
45
- data: EventPointer;
46
- };
47
- export type DecodedNprofile = {
48
- type: 'nprofile';
49
- data: ProfilePointer;
50
- };
51
- export type DecodedNaddr = {
52
- type: 'naddr';
53
- data: AddressPointer;
54
- };
55
- export type DecodedNsec = {
56
- type: 'nsec';
57
- data: Uint8Array;
58
- };
59
- export type DecodedNpub = {
60
- type: 'npub';
61
- data: string;
62
- };
63
- export type DecodedNote = {
64
- type: 'note';
65
- data: string;
66
- };
67
- export type DecodedResult = DecodedNevent | DecodedNprofile | DecodedNaddr | DecodedNpub | DecodedNsec | DecodedNote;
68
- export declare function decode(nip19: NEvent): DecodedNevent;
69
- export declare function decode(nip19: NProfile): DecodedNprofile;
70
- export declare function decode(nip19: NAddr): DecodedNaddr;
71
- export declare function decode(nip19: NSec): DecodedNsec;
72
- export declare function decode(nip19: NPub): DecodedNpub;
73
- export declare function decode(nip19: Note): DecodedNote;
74
- export declare function decode(code: string): DecodedResult;
75
- export declare function nsecEncode(key: Uint8Array): NSec;
76
- export declare function npubEncode(hex: string): NPub;
77
- export declare function noteEncode(hex: string): Note;
78
- export declare function encodeBytes<Prefix extends string>(prefix: Prefix, bytes: Uint8Array): `${Prefix}1${string}`;
79
- export declare function nprofileEncode(profile: ProfilePointer): NProfile;
80
- export declare function neventEncode(event: EventPointer): NEvent;
81
- export declare function naddrEncode(addr: AddressPointer): NAddr;
@@ -1 +0,0 @@
1
- export {};
@@ -1,34 +0,0 @@
1
- import { AddressPointer, EventPointer, ProfilePointer } from './nip19.ts';
2
- /** Nostr URI regex, eg `nostr:npub1...` */
3
- export declare const NOSTR_URI_REGEX: RegExp;
4
- /** Test whether the value is a Nostr URI. */
5
- export declare function test(value: unknown): value is `nostr:${string}`;
6
- /** Parsed Nostr URI data. */
7
- export interface NostrURI {
8
- /** Full URI including the `nostr:` protocol. */
9
- uri: `nostr:${string}`;
10
- /** The bech32-encoded data (eg `npub1...`). */
11
- value: string;
12
- /** Decoded bech32 string, according to NIP-19. */
13
- decoded: {
14
- type: 'nevent';
15
- data: EventPointer;
16
- } | {
17
- type: 'nprofile';
18
- data: ProfilePointer;
19
- } | {
20
- type: 'naddr';
21
- data: AddressPointer;
22
- } | {
23
- type: 'npub';
24
- data: string;
25
- } | {
26
- type: 'nsec';
27
- data: Uint8Array;
28
- } | {
29
- type: 'note';
30
- data: string;
31
- };
32
- }
33
- /** Parse and decode a Nostr URI. */
34
- export declare function parse(uri: string): NostrURI;
@@ -1 +0,0 @@
1
- export {};
@@ -1,15 +0,0 @@
1
- import { Event } from './pure.ts';
2
- import type { EventPointer } from './nip19.ts';
3
- export type ReactionEventTemplate = {
4
- /**
5
- * Pass only non-nip25 tags if you have to. Nip25 tags ('e' and 'p' tags from reacted event) will be added automatically.
6
- */
7
- tags?: string[][];
8
- /**
9
- * @default '+'
10
- */
11
- content?: string;
12
- created_at: number;
13
- };
14
- export declare function finishReactionEvent(t: ReactionEventTemplate, reacted: Event, privateKey: Uint8Array): Event;
15
- export declare function getReactedEventPointer(event: Event): undefined | EventPointer;
@@ -1 +0,0 @@
1
- export {};
@@ -1,32 +0,0 @@
1
- import { NostrEvent } from './core.ts';
2
- import { AddressPointer, EventPointer, ProfilePointer } from './nip19.ts';
3
- export type Block = {
4
- type: 'text';
5
- text: string;
6
- } | {
7
- type: 'reference';
8
- pointer: ProfilePointer | AddressPointer | EventPointer;
9
- } | {
10
- type: 'url';
11
- url: string;
12
- } | {
13
- type: 'relay';
14
- url: string;
15
- } | {
16
- type: 'image';
17
- url: string;
18
- } | {
19
- type: 'video';
20
- url: string;
21
- } | {
22
- type: 'audio';
23
- url: string;
24
- } | {
25
- type: 'emoji';
26
- shortcode: string;
27
- url: string;
28
- } | {
29
- type: 'hashtag';
30
- value: string;
31
- };
32
- export declare function parse(content: string | NostrEvent): Iterable<Block>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,46 +0,0 @@
1
- import { Event } from './pure.ts';
2
- export interface ChannelMetadata {
3
- name: string;
4
- about: string;
5
- picture: string;
6
- }
7
- export interface ChannelCreateEventTemplate {
8
- content: string | ChannelMetadata;
9
- created_at: number;
10
- tags?: string[][];
11
- }
12
- export interface ChannelMetadataEventTemplate {
13
- channel_create_event_id: string;
14
- content: string | ChannelMetadata;
15
- created_at: number;
16
- tags?: string[][];
17
- }
18
- export interface ChannelMessageEventTemplate {
19
- channel_create_event_id: string;
20
- reply_to_channel_message_event_id?: string;
21
- relay_url: string;
22
- content: string;
23
- created_at: number;
24
- tags?: string[][];
25
- }
26
- export interface ChannelHideMessageEventTemplate {
27
- channel_message_event_id: string;
28
- content: string | {
29
- reason: string;
30
- };
31
- created_at: number;
32
- tags?: string[][];
33
- }
34
- export interface ChannelMuteUserEventTemplate {
35
- content: string | {
36
- reason: string;
37
- };
38
- created_at: number;
39
- pubkey_to_mute: string;
40
- tags?: string[][];
41
- }
42
- export declare const channelCreateEvent: (t: ChannelCreateEventTemplate, privateKey: Uint8Array) => Event | undefined;
43
- export declare const channelMetadataEvent: (t: ChannelMetadataEventTemplate, privateKey: Uint8Array) => Event | undefined;
44
- export declare const channelMessageEvent: (t: ChannelMessageEventTemplate, privateKey: Uint8Array) => Event;
45
- export declare const channelHideMessageEvent: (t: ChannelHideMessageEventTemplate, privateKey: Uint8Array) => Event | undefined;
46
- export declare const channelMuteUserEvent: (t: ChannelMuteUserEventTemplate, privateKey: Uint8Array) => Event | undefined;
@@ -1 +0,0 @@
1
- export {};