nostr-tools 2.23.2 → 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.
- package/lib/cjs/abstract-pool.js +6 -2
- package/lib/cjs/abstract-pool.js.map +2 -2
- package/lib/cjs/abstract-relay.js +6 -2
- package/lib/cjs/abstract-relay.js.map +2 -2
- package/lib/cjs/index.js +181 -17
- package/lib/cjs/index.js.map +4 -4
- package/lib/cjs/nip17.js +31 -9
- package/lib/cjs/nip17.js.map +2 -2
- package/lib/cjs/nip22.js +154 -0
- package/lib/cjs/nip22.js.map +7 -0
- package/lib/cjs/nip44.js +34 -10
- package/lib/cjs/nip44.js.map +2 -2
- package/lib/cjs/nip46.js +40 -12
- package/lib/cjs/nip46.js.map +2 -2
- package/lib/cjs/nip47.js +3 -3
- package/lib/cjs/nip47.js.map +2 -2
- package/lib/cjs/nip59.js +31 -9
- package/lib/cjs/nip59.js.map +2 -2
- package/lib/cjs/pool.js +6 -2
- package/lib/cjs/pool.js.map +2 -2
- package/lib/cjs/relay.js +6 -2
- package/lib/cjs/relay.js.map +2 -2
- package/lib/esm/abstract-pool.js +6 -2
- package/lib/esm/abstract-pool.js.map +2 -2
- package/lib/esm/abstract-relay.js +6 -2
- package/lib/esm/abstract-relay.js.map +2 -2
- package/lib/esm/index.js +181 -17
- package/lib/esm/index.js.map +4 -4
- package/lib/esm/nip17.js +31 -9
- package/lib/esm/nip17.js.map +2 -2
- package/lib/esm/nip22.js +133 -0
- package/lib/esm/nip22.js.map +7 -0
- package/lib/esm/nip44.js +34 -10
- package/lib/esm/nip44.js.map +2 -2
- package/lib/esm/nip46.js +40 -12
- package/lib/esm/nip46.js.map +2 -2
- package/lib/esm/nip47.js +3 -3
- package/lib/esm/nip47.js.map +2 -2
- package/lib/esm/nip59.js +31 -9
- package/lib/esm/nip59.js.map +2 -2
- package/lib/esm/pool.js +6 -2
- package/lib/esm/pool.js.map +2 -2
- package/lib/esm/relay.js +6 -2
- package/lib/esm/relay.js.map +2 -2
- package/lib/nostr.bundle.js +189 -25
- package/lib/nostr.bundle.js.map +4 -4
- package/package.json +8 -2
- package/lib/types/abstract-pool.d.ts +0 -60
- package/lib/types/abstract-relay.d.ts +0 -110
- package/lib/types/benchmarks.d.ts +0 -1
- package/lib/types/core.d.ts +0 -32
- package/lib/types/core.test.d.ts +0 -1
- package/lib/types/fakejson.d.ts +0 -6
- package/lib/types/fakejson.test.d.ts +0 -1
- package/lib/types/filter.d.ts +0 -19
- package/lib/types/filter.test.d.ts +0 -1
- package/lib/types/helpers.d.ts +0 -2
- package/lib/types/index.d.ts +0 -30
- package/lib/types/kinds.d.ts +0 -200
- package/lib/types/kinds.test.d.ts +0 -1
- package/lib/types/nip04.d.ts +0 -2
- package/lib/types/nip04.test.d.ts +0 -1
- package/lib/types/nip05.d.ts +0 -17
- package/lib/types/nip05.test.d.ts +0 -1
- package/lib/types/nip06.d.ts +0 -15
- package/lib/types/nip06.test.d.ts +0 -1
- package/lib/types/nip07.d.ts +0 -13
- package/lib/types/nip10.d.ts +0 -24
- package/lib/types/nip10.test.d.ts +0 -1
- package/lib/types/nip11.d.ts +0 -266
- package/lib/types/nip11.test.d.ts +0 -1
- package/lib/types/nip13.d.ts +0 -8
- package/lib/types/nip13.test.d.ts +0 -1
- package/lib/types/nip17.d.ts +0 -15
- package/lib/types/nip17.test.d.ts +0 -1
- package/lib/types/nip18.d.ts +0 -22
- package/lib/types/nip18.test.d.ts +0 -1
- package/lib/types/nip19.d.ts +0 -81
- package/lib/types/nip19.test.d.ts +0 -1
- package/lib/types/nip21.d.ts +0 -34
- package/lib/types/nip21.test.d.ts +0 -1
- package/lib/types/nip25.d.ts +0 -15
- package/lib/types/nip25.test.d.ts +0 -1
- package/lib/types/nip27.d.ts +0 -32
- package/lib/types/nip27.test.d.ts +0 -1
- package/lib/types/nip28.d.ts +0 -46
- package/lib/types/nip28.test.d.ts +0 -1
- package/lib/types/nip29.d.ts +0 -265
- package/lib/types/nip30.d.ts +0 -22
- package/lib/types/nip30.test.d.ts +0 -1
- package/lib/types/nip39.d.ts +0 -2
- package/lib/types/nip39.test.d.ts +0 -1
- package/lib/types/nip40.d.ts +0 -10
- package/lib/types/nip40.test.d.ts +0 -1
- package/lib/types/nip42.d.ts +0 -5
- package/lib/types/nip42.test.d.ts +0 -1
- package/lib/types/nip44.d.ts +0 -13
- package/lib/types/nip44.test.d.ts +0 -1
- package/lib/types/nip46.d.ts +0 -117
- package/lib/types/nip47.d.ts +0 -9
- package/lib/types/nip47.test.d.ts +0 -1
- package/lib/types/nip49.d.ts +0 -3
- package/lib/types/nip49.test.d.ts +0 -1
- package/lib/types/nip54.d.ts +0 -1
- package/lib/types/nip54.test.d.ts +0 -1
- package/lib/types/nip55.d.ts +0 -30
- package/lib/types/nip55.test.d.ts +0 -1
- package/lib/types/nip57.d.ts +0 -25
- package/lib/types/nip57.test.d.ts +0 -1
- package/lib/types/nip58.d.ts +0 -134
- package/lib/types/nip58.test.d.ts +0 -1
- package/lib/types/nip59.d.ts +0 -12
- package/lib/types/nip59.test.d.ts +0 -1
- package/lib/types/nip75.d.ts +0 -61
- package/lib/types/nip75.test.d.ts +0 -1
- package/lib/types/nip77.d.ts +0 -102
- package/lib/types/nip77.test.d.ts +0 -1
- package/lib/types/nip94.d.ts +0 -87
- package/lib/types/nip94.test.d.ts +0 -1
- package/lib/types/nip98.d.ts +0 -74
- package/lib/types/nip98.test.d.ts +0 -1
- package/lib/types/nip99.d.ts +0 -92
- package/lib/types/nip99.test.d.ts +0 -1
- package/lib/types/nipb7.d.ts +0 -23
- package/lib/types/nipb7.test.d.ts +0 -1
- package/lib/types/pool.d.ts +0 -6
- package/lib/types/pool.test.d.ts +0 -1
- package/lib/types/pure.d.ts +0 -8
- package/lib/types/pure.test.d.ts +0 -1
- package/lib/types/references.d.ts +0 -10
- package/lib/types/references.test.d.ts +0 -1
- package/lib/types/relay.d.ts +0 -11
- package/lib/types/relay.test.d.ts +0 -1
- package/lib/types/signer.d.ts +0 -11
- package/lib/types/test-helpers.d.ts +0 -14
- package/lib/types/utils.d.ts +0 -9
- package/lib/types/utils.test.d.ts +0 -1
- package/lib/types/wasm.d.ts +0 -8
package/lib/types/nip29.d.ts
DELETED
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
import { AbstractSimplePool } from './abstract-pool.ts';
|
|
2
|
-
import type { Event, EventTemplate } from './core.ts';
|
|
3
|
-
import { RelayInformation } from './nip11.ts';
|
|
4
|
-
/**
|
|
5
|
-
* Represents a NIP29 group.
|
|
6
|
-
*/
|
|
7
|
-
export type Group = {
|
|
8
|
-
relay: string;
|
|
9
|
-
metadata: GroupMetadata;
|
|
10
|
-
admins?: GroupAdmin[];
|
|
11
|
-
members?: GroupMember[];
|
|
12
|
-
reference: GroupReference;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Represents the metadata for a NIP29 group.
|
|
16
|
-
*/
|
|
17
|
-
export type GroupMetadata = {
|
|
18
|
-
id: string;
|
|
19
|
-
pubkey: string;
|
|
20
|
-
name?: string;
|
|
21
|
-
picture?: string;
|
|
22
|
-
about?: string;
|
|
23
|
-
isPublic?: boolean;
|
|
24
|
-
isOpen?: boolean;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Represents a NIP29 group reference.
|
|
28
|
-
*/
|
|
29
|
-
export type GroupReference = {
|
|
30
|
-
id: string;
|
|
31
|
-
host: string;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Represents a NIP29 group member.
|
|
35
|
-
*/
|
|
36
|
-
export type GroupMember = {
|
|
37
|
-
pubkey: string;
|
|
38
|
-
label?: string;
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* Represents a NIP29 group admin.
|
|
42
|
-
*/
|
|
43
|
-
export type GroupAdmin = {
|
|
44
|
-
pubkey: string;
|
|
45
|
-
label?: string;
|
|
46
|
-
permissions: GroupAdminPermission[];
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Represents the permissions that a NIP29 group admin can have.
|
|
50
|
-
*/
|
|
51
|
-
export declare enum GroupAdminPermission {
|
|
52
|
-
/** @deprecated use PutUser instead */
|
|
53
|
-
AddUser = "add-user",
|
|
54
|
-
EditMetadata = "edit-metadata",
|
|
55
|
-
DeleteEvent = "delete-event",
|
|
56
|
-
RemoveUser = "remove-user",
|
|
57
|
-
/** @deprecated removed from NIP */
|
|
58
|
-
AddPermission = "add-permission",
|
|
59
|
-
/** @deprecated removed from NIP */
|
|
60
|
-
RemovePermission = "remove-permission",
|
|
61
|
-
/** @deprecated removed from NIP */
|
|
62
|
-
EditGroupStatus = "edit-group-status",
|
|
63
|
-
PutUser = "put-user",
|
|
64
|
-
CreateGroup = "create-group",
|
|
65
|
-
DeleteGroup = "delete-group",
|
|
66
|
-
CreateInvite = "create-invite"
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Generates a group metadata event template.
|
|
70
|
-
*
|
|
71
|
-
* @param group - The group object.
|
|
72
|
-
* @returns An event template with the generated group metadata that can be signed later.
|
|
73
|
-
*/
|
|
74
|
-
export declare function generateGroupMetadataEventTemplate(group: Group): EventTemplate;
|
|
75
|
-
/**
|
|
76
|
-
* Validates a group metadata event.
|
|
77
|
-
*
|
|
78
|
-
* @param event - The event to validate.
|
|
79
|
-
* @returns A boolean indicating whether the event is valid.
|
|
80
|
-
*/
|
|
81
|
-
export declare function validateGroupMetadataEvent(event: Event): boolean;
|
|
82
|
-
/**
|
|
83
|
-
* Generates an event template for group admins.
|
|
84
|
-
*
|
|
85
|
-
* @param group - The group object.
|
|
86
|
-
* @param admins - An array of group admins.
|
|
87
|
-
* @returns The generated event template with the group admins that can be signed later.
|
|
88
|
-
*/
|
|
89
|
-
export declare function generateGroupAdminsEventTemplate(group: Group, admins: GroupAdmin[]): EventTemplate;
|
|
90
|
-
/**
|
|
91
|
-
* Validates a group admins event.
|
|
92
|
-
*
|
|
93
|
-
* @param event - The event to validate.
|
|
94
|
-
* @returns True if the event is valid, false otherwise.
|
|
95
|
-
*/
|
|
96
|
-
export declare function validateGroupAdminsEvent(event: Event): boolean;
|
|
97
|
-
/**
|
|
98
|
-
* Generates an event template for a group with its members.
|
|
99
|
-
*
|
|
100
|
-
* @param group - The group object.
|
|
101
|
-
* @param members - An array of group members.
|
|
102
|
-
* @returns The generated event template with the group members that can be signed later.
|
|
103
|
-
*/
|
|
104
|
-
export declare function generateGroupMembersEventTemplate(group: Group, members: GroupMember[]): EventTemplate;
|
|
105
|
-
/**
|
|
106
|
-
* Validates a group members event.
|
|
107
|
-
*
|
|
108
|
-
* @param event - The event to validate.
|
|
109
|
-
* @returns Returns `true` if the event is a valid group members event, `false` otherwise.
|
|
110
|
-
*/
|
|
111
|
-
export declare function validateGroupMembersEvent(event: Event): boolean;
|
|
112
|
-
/**
|
|
113
|
-
* Returns the normalized relay URL based on the provided group reference.
|
|
114
|
-
*
|
|
115
|
-
* @param groupReference - The group reference object containing the host.
|
|
116
|
-
* @returns The normalized relay URL.
|
|
117
|
-
*/
|
|
118
|
-
export declare function getNormalizedRelayURLByGroupReference(groupReference: GroupReference): string;
|
|
119
|
-
/**
|
|
120
|
-
* Fetches relay information by group reference.
|
|
121
|
-
*
|
|
122
|
-
* @param groupReference The group reference.
|
|
123
|
-
* @returns A promise that resolves to the relay information.
|
|
124
|
-
*/
|
|
125
|
-
export declare function fetchRelayInformationByGroupReference(groupReference: GroupReference): Promise<RelayInformation>;
|
|
126
|
-
/**
|
|
127
|
-
* Fetches the group metadata event from the specified pool.
|
|
128
|
-
* If the normalizedRelayURL is not provided, it will be obtained using the groupReference.
|
|
129
|
-
* If the relayInformation is not provided, it will be fetched using the normalizedRelayURL.
|
|
130
|
-
*
|
|
131
|
-
* @param {Object} options - The options object.
|
|
132
|
-
* @param {AbstractSimplePool} options.pool - The pool to fetch the group metadata event from.
|
|
133
|
-
* @param {GroupReference} options.groupReference - The reference to the group.
|
|
134
|
-
* @param {string} [options.normalizedRelayURL] - The normalized URL of the relay.
|
|
135
|
-
* @param {RelayInformation} [options.relayInformation] - The relay information object.
|
|
136
|
-
* @returns {Promise<Event>} The group metadata event that can be parsed later to get the group metadata object.
|
|
137
|
-
* @throws {Error} If the group is not found on the specified relay.
|
|
138
|
-
*/
|
|
139
|
-
export declare function fetchGroupMetadataEvent({ pool, groupReference, relayInformation, normalizedRelayURL, }: {
|
|
140
|
-
pool: AbstractSimplePool;
|
|
141
|
-
groupReference: GroupReference;
|
|
142
|
-
normalizedRelayURL?: string;
|
|
143
|
-
relayInformation?: RelayInformation;
|
|
144
|
-
}): Promise<Event>;
|
|
145
|
-
/**
|
|
146
|
-
* Parses a group metadata event and returns the corresponding GroupMetadata object.
|
|
147
|
-
*
|
|
148
|
-
* @param event - The event to parse.
|
|
149
|
-
* @returns The parsed GroupMetadata object.
|
|
150
|
-
* @throws An error if the group metadata event is invalid.
|
|
151
|
-
*/
|
|
152
|
-
export declare function parseGroupMetadataEvent(event: Event): GroupMetadata;
|
|
153
|
-
/**
|
|
154
|
-
* Fetches the group admins event from the specified pool.
|
|
155
|
-
* If the normalizedRelayURL is not provided, it will be obtained from the groupReference.
|
|
156
|
-
* If the relayInformation is not provided, it will be fetched using the normalizedRelayURL.
|
|
157
|
-
*
|
|
158
|
-
* @param {Object} options - The options object.
|
|
159
|
-
* @param {AbstractSimplePool} options.pool - The pool to fetch the group admins event from.
|
|
160
|
-
* @param {GroupReference} options.groupReference - The reference to the group.
|
|
161
|
-
* @param {string} [options.normalizedRelayURL] - The normalized relay URL.
|
|
162
|
-
* @param {RelayInformation} [options.relayInformation] - The relay information.
|
|
163
|
-
* @returns {Promise<Event>} The group admins event that can be parsed later to get the group admins object.
|
|
164
|
-
* @throws {Error} If the group admins event is not found on the specified relay.
|
|
165
|
-
*/
|
|
166
|
-
export declare function fetchGroupAdminsEvent({ pool, groupReference, relayInformation, normalizedRelayURL, }: {
|
|
167
|
-
pool: AbstractSimplePool;
|
|
168
|
-
groupReference: GroupReference;
|
|
169
|
-
normalizedRelayURL?: string;
|
|
170
|
-
relayInformation?: RelayInformation;
|
|
171
|
-
}): Promise<Event>;
|
|
172
|
-
/**
|
|
173
|
-
* Parses a group admins event and returns an array of GroupAdmin objects.
|
|
174
|
-
*
|
|
175
|
-
* @param event - The event to parse.
|
|
176
|
-
* @returns An array of GroupAdmin objects.
|
|
177
|
-
* @throws Throws an error if the group admins event is invalid.
|
|
178
|
-
*/
|
|
179
|
-
export declare function parseGroupAdminsEvent(event: Event): GroupAdmin[];
|
|
180
|
-
/**
|
|
181
|
-
* Fetches the group members event from the specified relay.
|
|
182
|
-
* If the normalizedRelayURL is not provided, it will be obtained using the groupReference.
|
|
183
|
-
* If the relayInformation is not provided, it will be fetched using the normalizedRelayURL.
|
|
184
|
-
*
|
|
185
|
-
* @param {Object} options - The options object.
|
|
186
|
-
* @param {AbstractSimplePool} options.pool - The pool object.
|
|
187
|
-
* @param {GroupReference} options.groupReference - The group reference object.
|
|
188
|
-
* @param {string} [options.normalizedRelayURL] - The normalized relay URL.
|
|
189
|
-
* @param {RelayInformation} [options.relayInformation] - The relay information object.
|
|
190
|
-
* @returns {Promise<Event>} The group members event that can be parsed later to get the group members object.
|
|
191
|
-
* @throws {Error} If the group members event is not found.
|
|
192
|
-
*/
|
|
193
|
-
export declare function fetchGroupMembersEvent({ pool, groupReference, relayInformation, normalizedRelayURL, }: {
|
|
194
|
-
pool: AbstractSimplePool;
|
|
195
|
-
groupReference: GroupReference;
|
|
196
|
-
normalizedRelayURL?: string;
|
|
197
|
-
relayInformation?: RelayInformation;
|
|
198
|
-
}): Promise<Event>;
|
|
199
|
-
/**
|
|
200
|
-
* Parses a group members event and returns an array of GroupMember objects.
|
|
201
|
-
* @param event - The event to parse.
|
|
202
|
-
* @returns An array of GroupMember objects.
|
|
203
|
-
* @throws Throws an error if the group members event is invalid.
|
|
204
|
-
*/
|
|
205
|
-
export declare function parseGroupMembersEvent(event: Event): GroupMember[];
|
|
206
|
-
/**
|
|
207
|
-
* Fetches and parses the group metadata event, group admins event, and group members event from the specified pool.
|
|
208
|
-
* If the normalized relay URL is not provided, it will be obtained using the group reference.
|
|
209
|
-
* If the relay information is not provided, it will be fetched using the normalized relay URL.
|
|
210
|
-
*
|
|
211
|
-
* @param {Object} options - The options for loading the group.
|
|
212
|
-
* @param {AbstractSimplePool} options.pool - The pool to load the group from.
|
|
213
|
-
* @param {GroupReference} options.groupReference - The reference of the group to load.
|
|
214
|
-
* @param {string} [options.normalizedRelayURL] - The normalized URL of the relay to use.
|
|
215
|
-
* @param {RelayInformation} [options.relayInformation] - The relay information to use.
|
|
216
|
-
* @returns {Promise<Group>} A promise that resolves to the loaded group.
|
|
217
|
-
*/
|
|
218
|
-
export declare function loadGroup({ pool, groupReference, normalizedRelayURL, relayInformation, }: {
|
|
219
|
-
pool: AbstractSimplePool;
|
|
220
|
-
groupReference: GroupReference;
|
|
221
|
-
normalizedRelayURL?: string;
|
|
222
|
-
relayInformation?: RelayInformation;
|
|
223
|
-
}): Promise<Group>;
|
|
224
|
-
/**
|
|
225
|
-
* Loads a group from the specified pool using the provided group code.
|
|
226
|
-
*
|
|
227
|
-
* @param {AbstractSimplePool} pool - The pool to load the group from.
|
|
228
|
-
* @param {string} code - The code representing the group.
|
|
229
|
-
* @returns {Promise<Group>} - A promise that resolves to the loaded group.
|
|
230
|
-
* @throws {Error} - If the group code is invalid.
|
|
231
|
-
*/
|
|
232
|
-
export declare function loadGroupFromCode(pool: AbstractSimplePool, code: string): Promise<Group>;
|
|
233
|
-
/**
|
|
234
|
-
* Parses a group code and returns a GroupReference object.
|
|
235
|
-
*
|
|
236
|
-
* @param code The group code to parse.
|
|
237
|
-
* @returns A GroupReference object if the code is valid, otherwise null.
|
|
238
|
-
*/
|
|
239
|
-
export declare function parseGroupCode(code: string): null | GroupReference;
|
|
240
|
-
/**
|
|
241
|
-
* Encodes a group reference into a string.
|
|
242
|
-
*
|
|
243
|
-
* @param gr - The group reference to encode.
|
|
244
|
-
* @returns The encoded group reference as a string.
|
|
245
|
-
*/
|
|
246
|
-
export declare function encodeGroupReference(gr: GroupReference): string;
|
|
247
|
-
/**
|
|
248
|
-
* Subscribes to relay groups metadata events and calls the provided event handler function
|
|
249
|
-
* when an event is received.
|
|
250
|
-
*
|
|
251
|
-
* @param {Object} options - The options for subscribing to relay groups metadata events.
|
|
252
|
-
* @param {AbstractSimplePool} options.pool - The pool to subscribe to.
|
|
253
|
-
* @param {string} options.relayURL - The URL of the relay.
|
|
254
|
-
* @param {Function} options.onError - The error handler function.
|
|
255
|
-
* @param {Function} options.onEvent - The event handler function.
|
|
256
|
-
* @param {Function} [options.onConnect] - The connect handler function.
|
|
257
|
-
* @returns {Function} - A function to close the subscription
|
|
258
|
-
*/
|
|
259
|
-
export declare function subscribeRelayGroupsMetadataEvents({ pool, relayURL, onError, onEvent, onConnect, }: {
|
|
260
|
-
pool: AbstractSimplePool;
|
|
261
|
-
relayURL: string;
|
|
262
|
-
onError: (err: Error) => void;
|
|
263
|
-
onEvent: (event: Event) => void;
|
|
264
|
-
onConnect?: () => void;
|
|
265
|
-
}): () => void;
|
package/lib/types/nip30.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/** Regex for a single emoji shortcode. */
|
|
2
|
-
export declare const EMOJI_SHORTCODE_REGEX: RegExp;
|
|
3
|
-
/** Regex to find emoji shortcodes in content. */
|
|
4
|
-
export declare const regex: () => RegExp;
|
|
5
|
-
/** Represents a Nostr custom emoji. */
|
|
6
|
-
export interface CustomEmoji {
|
|
7
|
-
/** The matched emoji name with colons. */
|
|
8
|
-
shortcode: `:${string}:`;
|
|
9
|
-
/** The matched emoji name without colons. */
|
|
10
|
-
name: string;
|
|
11
|
-
}
|
|
12
|
-
/** Match result for a custom emoji in text content. */
|
|
13
|
-
export interface CustomEmojiMatch extends CustomEmoji {
|
|
14
|
-
/** Index where the emoji begins in the text content. */
|
|
15
|
-
start: number;
|
|
16
|
-
/** Index where the emoji ends in the text content. */
|
|
17
|
-
end: number;
|
|
18
|
-
}
|
|
19
|
-
/** Find all custom emoji shortcodes. */
|
|
20
|
-
export declare function matchAll(content: string): Iterable<CustomEmojiMatch>;
|
|
21
|
-
/** Replace all emoji shortcodes in the content. */
|
|
22
|
-
export declare function replaceAll(content: string, replacer: (match: CustomEmoji) => string): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/types/nip39.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/types/nip40.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Event } from './core.ts';
|
|
2
|
-
/** Get the expiration of the event as a `Date` object, if any. */
|
|
3
|
-
declare function getExpiration(event: Event): Date | undefined;
|
|
4
|
-
/** Check if the event has expired. */
|
|
5
|
-
declare function isEventExpired(event: Event): boolean;
|
|
6
|
-
/** Returns a promise that resolves when the event expires. */
|
|
7
|
-
declare function waitForExpire(event: Event): Promise<Event>;
|
|
8
|
-
/** Calls the callback when the event expires. */
|
|
9
|
-
declare function onExpire(event: Event, callback: (event: Event) => void): void;
|
|
10
|
-
export { getExpiration, isEventExpired, waitForExpire, onExpire };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/types/nip42.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/types/nip44.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare function getConversationKey(privkeyA: Uint8Array, pubkeyB: string): Uint8Array;
|
|
2
|
-
declare function calcPaddedLen(len: number): number;
|
|
3
|
-
export declare function encrypt(plaintext: string, conversationKey: Uint8Array, nonce?: Uint8Array): string;
|
|
4
|
-
export declare function decrypt(payload: string, conversationKey: Uint8Array): string;
|
|
5
|
-
export declare const v2: {
|
|
6
|
-
utils: {
|
|
7
|
-
getConversationKey: typeof getConversationKey;
|
|
8
|
-
calcPaddedLen: typeof calcPaddedLen;
|
|
9
|
-
};
|
|
10
|
-
encrypt: typeof encrypt;
|
|
11
|
-
decrypt: typeof decrypt;
|
|
12
|
-
};
|
|
13
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/types/nip46.d.ts
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { EventTemplate, VerifiedEvent } from './core.ts';
|
|
2
|
-
import { AbstractSimplePool } from './abstract-pool.ts';
|
|
3
|
-
import { Signer } from './signer.ts';
|
|
4
|
-
export declare function useFetchImplementation(fetchImplementation: any): void;
|
|
5
|
-
export declare const BUNKER_REGEX: RegExp;
|
|
6
|
-
export type BunkerPointer = {
|
|
7
|
-
relays: string[];
|
|
8
|
-
pubkey: string;
|
|
9
|
-
secret: null | string;
|
|
10
|
-
};
|
|
11
|
-
export declare function toBunkerURL(bunkerPointer: BunkerPointer): string;
|
|
12
|
-
/** This takes either a bunker:// URL or a name@domain.com NIP-05 identifier
|
|
13
|
-
and returns a BunkerPointer -- or null in case of error */
|
|
14
|
-
export declare function parseBunkerInput(input: string): Promise<BunkerPointer | null>;
|
|
15
|
-
export declare function queryBunkerProfile(nip05: string): Promise<BunkerPointer | null>;
|
|
16
|
-
export type NostrConnectParams = {
|
|
17
|
-
clientPubkey: string;
|
|
18
|
-
relays: string[];
|
|
19
|
-
secret: string;
|
|
20
|
-
perms?: string[];
|
|
21
|
-
name?: string;
|
|
22
|
-
url?: string;
|
|
23
|
-
image?: string;
|
|
24
|
-
};
|
|
25
|
-
export declare function createNostrConnectURI(params: NostrConnectParams): string;
|
|
26
|
-
export type BunkerSignerParams = {
|
|
27
|
-
pool?: AbstractSimplePool;
|
|
28
|
-
onauth?: (url: string) => void;
|
|
29
|
-
};
|
|
30
|
-
export declare class BunkerSigner implements Signer {
|
|
31
|
-
private params;
|
|
32
|
-
private pool;
|
|
33
|
-
private subCloser;
|
|
34
|
-
private isOpen;
|
|
35
|
-
private serial;
|
|
36
|
-
private idPrefix;
|
|
37
|
-
private listeners;
|
|
38
|
-
private waitingForAuth;
|
|
39
|
-
private secretKey;
|
|
40
|
-
private conversationKey;
|
|
41
|
-
bp: BunkerPointer;
|
|
42
|
-
private cachedPubKey;
|
|
43
|
-
/**
|
|
44
|
-
* Creates a new instance of the Nip46 class.
|
|
45
|
-
* @param relays - An array of relay addresses.
|
|
46
|
-
* @param remotePubkey - An optional remote public key. This is the key you want to sign as.
|
|
47
|
-
* @param secretKey - An optional key pair.
|
|
48
|
-
*/
|
|
49
|
-
private constructor();
|
|
50
|
-
/**
|
|
51
|
-
* [Factory Method 1] Creates a Signer using bunker information (bunker:// URL or NIP-05).
|
|
52
|
-
* This method is used when the public key of the bunker is known in advance.
|
|
53
|
-
*/
|
|
54
|
-
static fromBunker(clientSecretKey: Uint8Array, bp: BunkerPointer, params?: BunkerSignerParams): BunkerSigner;
|
|
55
|
-
/**
|
|
56
|
-
* [Factory Method 2] Creates a Signer using a nostrconnect:// URI generated by the client.
|
|
57
|
-
* In this method, the bunker initiates the connection by scanning the URI.
|
|
58
|
-
*/
|
|
59
|
-
static fromURI(clientSecretKey: Uint8Array, connectionURI: string, bunkerParams?: BunkerSignerParams, maxWaitOrAbort?: number | AbortSignal): Promise<BunkerSigner>;
|
|
60
|
-
private setupSubscription;
|
|
61
|
-
switchRelays(): Promise<boolean>;
|
|
62
|
-
close(): Promise<void>;
|
|
63
|
-
sendRequest(method: string, params: string[]): Promise<string>;
|
|
64
|
-
/**
|
|
65
|
-
* Calls the "connect" method on the bunker.
|
|
66
|
-
* The promise will be rejected if the response is not "pong".
|
|
67
|
-
*/
|
|
68
|
-
ping(): Promise<void>;
|
|
69
|
-
/**
|
|
70
|
-
* Calls the "connect" method on the bunker.
|
|
71
|
-
*/
|
|
72
|
-
connect(): Promise<void>;
|
|
73
|
-
/**
|
|
74
|
-
* Calls the "get_public_key" method on the bunker.
|
|
75
|
-
* (before we would return the public key hardcoded in the bunker parameters, but
|
|
76
|
-
* that is not correct as that may be the bunker pubkey and the actual signer
|
|
77
|
-
* pubkey may be different.)
|
|
78
|
-
*/
|
|
79
|
-
getPublicKey(): Promise<string>;
|
|
80
|
-
/**
|
|
81
|
-
* Signs an event using the remote private key.
|
|
82
|
-
* @param event - The event to sign.
|
|
83
|
-
* @returns A Promise that resolves to the signed event.
|
|
84
|
-
*/
|
|
85
|
-
signEvent(event: EventTemplate): Promise<VerifiedEvent>;
|
|
86
|
-
nip04Encrypt(thirdPartyPubkey: string, plaintext: string): Promise<string>;
|
|
87
|
-
nip04Decrypt(thirdPartyPubkey: string, ciphertext: string): Promise<string>;
|
|
88
|
-
nip44Encrypt(thirdPartyPubkey: string, plaintext: string): Promise<string>;
|
|
89
|
-
nip44Decrypt(thirdPartyPubkey: string, ciphertext: string): Promise<string>;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Creates an account with the specified username, domain, and optional email.
|
|
93
|
-
* @param bunkerPubkey - The public key of the bunker to use for the create_account call.
|
|
94
|
-
* @param username - The username for the account.
|
|
95
|
-
* @param domain - The domain for the account.
|
|
96
|
-
* @param email - The optional email for the account.
|
|
97
|
-
* @param localSecretKey - Optionally pass a local secret key that will be used to communicate with the bunker,
|
|
98
|
-
this will default to generating a random key.
|
|
99
|
-
* @throws Error if the email is present but invalid.
|
|
100
|
-
* @returns A Promise that resolves to the auth_url that the client should follow to create an account.
|
|
101
|
-
*/
|
|
102
|
-
export declare function createAccount(bunker: BunkerProfile, params: BunkerSignerParams, username: string, domain: string, email?: string, localSecretKey?: Uint8Array): Promise<BunkerSigner>;
|
|
103
|
-
/**
|
|
104
|
-
* Fetches info on available providers that announce themselves using NIP-89 events.
|
|
105
|
-
* @returns A promise that resolves to an array of available bunker objects.
|
|
106
|
-
*/
|
|
107
|
-
export declare function fetchBunkerProviders(pool: AbstractSimplePool, relays: string[]): Promise<BunkerProfile[]>;
|
|
108
|
-
export type BunkerProfile = {
|
|
109
|
-
bunkerPointer: BunkerPointer;
|
|
110
|
-
domain: string;
|
|
111
|
-
nip05: string;
|
|
112
|
-
name: string;
|
|
113
|
-
picture: string;
|
|
114
|
-
about: string;
|
|
115
|
-
website: string;
|
|
116
|
-
local: boolean;
|
|
117
|
-
};
|
package/lib/types/nip47.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type VerifiedEvent } from './pure.ts';
|
|
2
|
-
interface NWCConnection {
|
|
3
|
-
pubkey: string;
|
|
4
|
-
relay: string;
|
|
5
|
-
secret: string;
|
|
6
|
-
}
|
|
7
|
-
export declare function parseConnectionString(connectionString: string): NWCConnection;
|
|
8
|
-
export declare function makeNwcRequestEvent(pubkey: string, secretKey: Uint8Array, invoice: string): Promise<VerifiedEvent>;
|
|
9
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/types/nip49.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/types/nip54.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function normalizeIdentifier(name: string): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/types/nip55.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
type BaseParams = {
|
|
2
|
-
callbackUrl?: string;
|
|
3
|
-
returnType?: 'signature' | 'event';
|
|
4
|
-
compressionType?: 'none' | 'gzip';
|
|
5
|
-
};
|
|
6
|
-
type PermissionsParams = BaseParams & {
|
|
7
|
-
permissions?: {
|
|
8
|
-
type: string;
|
|
9
|
-
kind?: number;
|
|
10
|
-
}[];
|
|
11
|
-
};
|
|
12
|
-
type EventUriParams = BaseParams & {
|
|
13
|
-
eventJson: Record<string, unknown>;
|
|
14
|
-
id?: string;
|
|
15
|
-
currentUser?: string;
|
|
16
|
-
};
|
|
17
|
-
type EncryptDecryptParams = BaseParams & {
|
|
18
|
-
pubKey: string;
|
|
19
|
-
content: string;
|
|
20
|
-
id?: string;
|
|
21
|
-
currentUser?: string;
|
|
22
|
-
};
|
|
23
|
-
export declare function getPublicKeyUri({ permissions, ...params }: PermissionsParams): string;
|
|
24
|
-
export declare function signEventUri({ eventJson, ...params }: EventUriParams): string;
|
|
25
|
-
export declare function encryptNip04Uri(params: EncryptDecryptParams): string;
|
|
26
|
-
export declare function decryptNip04Uri(params: EncryptDecryptParams): string;
|
|
27
|
-
export declare function encryptNip44Uri(params: EncryptDecryptParams): string;
|
|
28
|
-
export declare function decryptNip44Uri(params: EncryptDecryptParams): string;
|
|
29
|
-
export declare function decryptZapEventUri({ eventJson, ...params }: EventUriParams): string;
|
|
30
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/types/nip57.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { NostrEvent, type Event, type EventTemplate } from './pure.ts';
|
|
2
|
-
export declare function useFetchImplementation(fetchImplementation: any): void;
|
|
3
|
-
export declare function getZapEndpoint(metadata: Event): Promise<null | string>;
|
|
4
|
-
type ProfileZap = {
|
|
5
|
-
pubkey: string;
|
|
6
|
-
amount: number;
|
|
7
|
-
comment?: string;
|
|
8
|
-
relays: string[];
|
|
9
|
-
};
|
|
10
|
-
type EventZap = {
|
|
11
|
-
event: NostrEvent;
|
|
12
|
-
amount: number;
|
|
13
|
-
comment?: string;
|
|
14
|
-
relays: string[];
|
|
15
|
-
};
|
|
16
|
-
export declare function makeZapRequest(params: ProfileZap | EventZap): EventTemplate;
|
|
17
|
-
export declare function validateZapRequest(zapRequestString: string): string | null;
|
|
18
|
-
export declare function makeZapReceipt({ zapRequest, preimage, bolt11, paidAt, }: {
|
|
19
|
-
zapRequest: string;
|
|
20
|
-
preimage?: string;
|
|
21
|
-
bolt11: string;
|
|
22
|
-
paidAt: Date;
|
|
23
|
-
}): EventTemplate;
|
|
24
|
-
export declare function getSatoshisAmountFromBolt11(bolt11: string): number;
|
|
25
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|