signal-sdk 0.0.5 → 0.0.7
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/README.md +501 -501
- package/package.json +71 -71
- package/scripts/cli.js +68 -68
- package/scripts/connect.js +119 -119
- package/scripts/install.js +26 -8
- package/dist/SignalBot.d.ts +0 -108
- package/dist/SignalBot.js +0 -811
- package/dist/SignalCli.d.ts +0 -135
- package/dist/SignalCli.js +0 -711
- package/dist/__tests__/SignalBot.test.d.ts +0 -1
- package/dist/__tests__/SignalBot.test.js +0 -102
- package/dist/__tests__/SignalCli.test.d.ts +0 -1
- package/dist/__tests__/SignalCli.test.js +0 -235
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -22
- package/dist/interfaces.d.ts +0 -937
- package/dist/interfaces.js +0 -11
package/dist/interfaces.d.ts
DELETED
|
@@ -1,937 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Signal CLI SDK TypeScript Interfaces
|
|
3
|
-
*
|
|
4
|
-
* This file contains comprehensive type definitions for the Signal CLI SDK,
|
|
5
|
-
* which uses JSON-RPC communication with signal-cli for optimal performance.
|
|
6
|
-
*
|
|
7
|
-
* @author Signal SDK Team
|
|
8
|
-
* @version 2.0.0
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* @deprecated This interface is no longer used since switching to JSON-RPC format.
|
|
12
|
-
* Recipients are now passed as simple string arrays instead of Address objects.
|
|
13
|
-
* Keep for backward compatibility but avoid using in new code.
|
|
14
|
-
*/
|
|
15
|
-
export interface Address {
|
|
16
|
-
number?: string;
|
|
17
|
-
uuid?: string;
|
|
18
|
-
name?: string;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Standard JSON-RPC 2.0 request structure used for all signal-cli communication.
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```typescript
|
|
25
|
-
* const request: JsonRpcRequest = {
|
|
26
|
-
* jsonrpc: '2.0',
|
|
27
|
-
* method: 'send',
|
|
28
|
-
* params: { recipients: ['+33123456789'], message: 'Hello!' },
|
|
29
|
-
* id: 'msg_001'
|
|
30
|
-
* };
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
export interface JsonRpcRequest {
|
|
34
|
-
/** Always '2.0' for JSON-RPC 2.0 compliance */
|
|
35
|
-
jsonrpc: '2.0';
|
|
36
|
-
/** The method name to call on signal-cli */
|
|
37
|
-
method: string;
|
|
38
|
-
/** Parameters to pass to the method (method-specific) */
|
|
39
|
-
params?: any;
|
|
40
|
-
/** Unique identifier for this request */
|
|
41
|
-
id: string;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Standard JSON-RPC 2.0 response structure received from signal-cli.
|
|
45
|
-
* Contains either a result or an error, never both.
|
|
46
|
-
*/
|
|
47
|
-
export interface JsonRpcResponse {
|
|
48
|
-
/** Always '2.0' for JSON-RPC 2.0 compliance */
|
|
49
|
-
jsonrpc: '2.0';
|
|
50
|
-
/** The same ID as the request that generated this response */
|
|
51
|
-
id: string;
|
|
52
|
-
/** The result data (present only on success) */
|
|
53
|
-
result?: any;
|
|
54
|
-
/** Error information (present only on failure) */
|
|
55
|
-
error?: {
|
|
56
|
-
/** Error code (negative for implementation-defined errors) */
|
|
57
|
-
code: number;
|
|
58
|
-
/** Human-readable error message */
|
|
59
|
-
message: string;
|
|
60
|
-
/** Additional error data (optional) */
|
|
61
|
-
data?: any;
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* JSON-RPC 2.0 notification structure for asynchronous events from signal-cli.
|
|
66
|
-
* Notifications don't have an ID and don't expect a response.
|
|
67
|
-
*
|
|
68
|
-
* @example
|
|
69
|
-
* ```typescript
|
|
70
|
-
* // Incoming message notification
|
|
71
|
-
* {
|
|
72
|
-
* jsonrpc: '2.0',
|
|
73
|
-
* method: 'receive',
|
|
74
|
-
* params: { envelope: { source: '+33123456789', dataMessage: { ... } } }
|
|
75
|
-
* }
|
|
76
|
-
* ```
|
|
77
|
-
*/
|
|
78
|
-
export interface JsonRpcNotification {
|
|
79
|
-
/** Always '2.0' for JSON-RPC 2.0 compliance */
|
|
80
|
-
jsonrpc: '2.0';
|
|
81
|
-
/** The notification method name */
|
|
82
|
-
method: string;
|
|
83
|
-
/** Parameters for the notification */
|
|
84
|
-
params?: any;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Parameters for the 'send' JSON-RPC method.
|
|
88
|
-
* Used for sending messages to individual recipients or groups.
|
|
89
|
-
*/
|
|
90
|
-
export interface JsonRpcSendParams {
|
|
91
|
-
/** Array of recipient phone numbers (for direct messages) */
|
|
92
|
-
recipients?: string[];
|
|
93
|
-
/** Group ID (for group messages) - mutually exclusive with recipients */
|
|
94
|
-
groupId?: string;
|
|
95
|
-
/** The message text to send */
|
|
96
|
-
message?: string;
|
|
97
|
-
/** Array of attachment file paths */
|
|
98
|
-
attachments?: string[];
|
|
99
|
-
/** Array of mentions in the message */
|
|
100
|
-
mentions?: JsonRpcMention[];
|
|
101
|
-
/** Array of text styles (bold, italic, etc.) */
|
|
102
|
-
textStyles?: JsonRpcTextStyle[];
|
|
103
|
-
/** Quote/reply information */
|
|
104
|
-
quote?: JsonRpcQuote;
|
|
105
|
-
/** Sticker information */
|
|
106
|
-
sticker?: JsonRpcSticker;
|
|
107
|
-
/** Message expiration time in seconds */
|
|
108
|
-
expiresInSeconds?: number;
|
|
109
|
-
/** Whether this is a view-once message */
|
|
110
|
-
isViewOnce?: boolean;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Parameters for the 'send_reaction' JSON-RPC method.
|
|
114
|
-
*/
|
|
115
|
-
export interface JsonRpcReactionParams {
|
|
116
|
-
/** Recipient phone number */
|
|
117
|
-
recipient?: string;
|
|
118
|
-
/** Group ID (for group reactions) */
|
|
119
|
-
groupId?: string;
|
|
120
|
-
/** Author of the message being reacted to */
|
|
121
|
-
targetAuthor: string;
|
|
122
|
-
/** Timestamp of the message being reacted to */
|
|
123
|
-
targetTimestamp: number;
|
|
124
|
-
/** Emoji to react with */
|
|
125
|
-
emoji: string;
|
|
126
|
-
/** Whether to remove the reaction */
|
|
127
|
-
remove?: boolean;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Parameters for the 'send_typing' JSON-RPC method.
|
|
131
|
-
*/
|
|
132
|
-
export interface JsonRpcTypingParams {
|
|
133
|
-
/** Array of recipient phone numbers */
|
|
134
|
-
recipients?: string[];
|
|
135
|
-
/** Group ID (for group typing indicators) */
|
|
136
|
-
groupId?: string;
|
|
137
|
-
/** Typing action: 'start' or 'stop' */
|
|
138
|
-
action: 'start' | 'stop';
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Parameters for blocking/unblocking users.
|
|
142
|
-
*/
|
|
143
|
-
export interface JsonRpcBlockParams {
|
|
144
|
-
/** Array of phone numbers to block/unblock */
|
|
145
|
-
recipient: string[];
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Parameters for updating group information.
|
|
149
|
-
*/
|
|
150
|
-
export interface JsonRpcUpdateGroupParams {
|
|
151
|
-
/** Group ID to update */
|
|
152
|
-
groupId: string;
|
|
153
|
-
/** New group name */
|
|
154
|
-
name?: string;
|
|
155
|
-
/** New group description */
|
|
156
|
-
description?: string;
|
|
157
|
-
/** Path to new group avatar image */
|
|
158
|
-
avatar?: string;
|
|
159
|
-
/** Members to add to the group */
|
|
160
|
-
addMembers?: string[];
|
|
161
|
-
/** Members to remove from the group */
|
|
162
|
-
removeMembers?: string[];
|
|
163
|
-
/** Members to promote to admin */
|
|
164
|
-
promoteAdmins?: string[];
|
|
165
|
-
/** Members to demote from admin */
|
|
166
|
-
demoteAdmins?: string[];
|
|
167
|
-
/** Members to ban from the group */
|
|
168
|
-
banMembers?: string[];
|
|
169
|
-
/** Members to unban from the group */
|
|
170
|
-
unbanMembers?: string[];
|
|
171
|
-
/** Who can add members: 'EVERY_MEMBER' or 'ONLY_ADMINS' */
|
|
172
|
-
permissionAddMember?: 'EVERY_MEMBER' | 'ONLY_ADMINS';
|
|
173
|
-
/** Who can edit group details: 'EVERY_MEMBER' or 'ONLY_ADMINS' */
|
|
174
|
-
permissionEditDetails?: 'EVERY_MEMBER' | 'ONLY_ADMINS';
|
|
175
|
-
/** Who can send messages: 'EVERY_MEMBER' or 'ONLY_ADMINS' */
|
|
176
|
-
permissionSendMessage?: 'EVERY_MEMBER' | 'ONLY_ADMINS';
|
|
177
|
-
/** Whether only admins can send messages */
|
|
178
|
-
announcementsOnly?: boolean;
|
|
179
|
-
/** Message expiration timer in seconds */
|
|
180
|
-
expirationTimer?: number;
|
|
181
|
-
/** Whether to reset the group invite link */
|
|
182
|
-
resetInviteLink?: boolean;
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Mention information for JSON-RPC messages.
|
|
186
|
-
*/
|
|
187
|
-
export interface JsonRpcMention {
|
|
188
|
-
/** Start position in the message text */
|
|
189
|
-
start: number;
|
|
190
|
-
/** Length of the mention */
|
|
191
|
-
length: number;
|
|
192
|
-
/** Phone number of the mentioned user */
|
|
193
|
-
number: string;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Text style information for JSON-RPC messages.
|
|
197
|
-
*/
|
|
198
|
-
export interface JsonRpcTextStyle {
|
|
199
|
-
/** Start position in the message text */
|
|
200
|
-
start: number;
|
|
201
|
-
/** Length of the styled text */
|
|
202
|
-
length: number;
|
|
203
|
-
/** Style type */
|
|
204
|
-
style: 'BOLD' | 'ITALIC' | 'STRIKETHROUGH' | 'MONOSPACE' | 'SPOILER';
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Quote/reply information for JSON-RPC messages.
|
|
208
|
-
*/
|
|
209
|
-
export interface JsonRpcQuote {
|
|
210
|
-
/** Timestamp of the quoted message */
|
|
211
|
-
timestamp: number;
|
|
212
|
-
/** Author of the quoted message */
|
|
213
|
-
author: string;
|
|
214
|
-
/** Text of the quoted message */
|
|
215
|
-
text?: string;
|
|
216
|
-
/** Attachments in the quoted message */
|
|
217
|
-
attachments?: JsonAttachment[];
|
|
218
|
-
/** Mentions in the quoted message */
|
|
219
|
-
mentions?: JsonRpcMention[];
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* Sticker information for JSON-RPC messages.
|
|
223
|
-
*/
|
|
224
|
-
export interface JsonRpcSticker {
|
|
225
|
-
/** Sticker pack ID */
|
|
226
|
-
packId: string;
|
|
227
|
-
/** Sticker ID within the pack */
|
|
228
|
-
stickerId: number;
|
|
229
|
-
/** Pack key for encrypted sticker packs */
|
|
230
|
-
packKey?: string;
|
|
231
|
-
/** Associated emoji */
|
|
232
|
-
emoji?: string;
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* Attachment information for JSON-RPC communication.
|
|
236
|
-
* This is the format expected by signal-cli for attachments.
|
|
237
|
-
*/
|
|
238
|
-
export interface JsonAttachment {
|
|
239
|
-
/** Attachment ID (for existing attachments) */
|
|
240
|
-
id?: string;
|
|
241
|
-
/** MIME content type */
|
|
242
|
-
contentType: string;
|
|
243
|
-
/** Original filename */
|
|
244
|
-
filename?: string;
|
|
245
|
-
/** File size in bytes */
|
|
246
|
-
size?: number;
|
|
247
|
-
/** Base64 encoded thumbnail */
|
|
248
|
-
thumbnail?: string;
|
|
249
|
-
/** Whether this is a voice note */
|
|
250
|
-
voiceNote?: boolean;
|
|
251
|
-
/** Image width in pixels */
|
|
252
|
-
width?: number;
|
|
253
|
-
/** Image height in pixels */
|
|
254
|
-
height?: number;
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* @deprecated Use JsonRpcSendParams instead.
|
|
258
|
-
* Legacy interface for send request parameters.
|
|
259
|
-
*/
|
|
260
|
-
export interface SendRequestParams {
|
|
261
|
-
recipient?: Address;
|
|
262
|
-
recipientGroupId?: string;
|
|
263
|
-
message: string;
|
|
264
|
-
attachments?: JsonAttachment[];
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* Response from send operations.
|
|
268
|
-
*/
|
|
269
|
-
export interface SendResponse {
|
|
270
|
-
/** Timestamp when the message was sent */
|
|
271
|
-
timestamp: number;
|
|
272
|
-
/** Array of delivery results */
|
|
273
|
-
results: any[];
|
|
274
|
-
}
|
|
275
|
-
/**
|
|
276
|
-
* Group information as returned by signal-cli.
|
|
277
|
-
*/
|
|
278
|
-
export interface GroupInfo {
|
|
279
|
-
/** Base64 encoded group ID */
|
|
280
|
-
groupId: string;
|
|
281
|
-
/** Group display name */
|
|
282
|
-
name: string;
|
|
283
|
-
/** Group description */
|
|
284
|
-
description?: string;
|
|
285
|
-
/** Whether the current user is a member */
|
|
286
|
-
isMember: boolean;
|
|
287
|
-
/** Whether the group is blocked */
|
|
288
|
-
isBlocked: boolean;
|
|
289
|
-
/** Message expiration time in seconds */
|
|
290
|
-
messageExpirationTime: number;
|
|
291
|
-
/** Current group members */
|
|
292
|
-
members: Address[];
|
|
293
|
-
/** Members with pending invitations */
|
|
294
|
-
pendingMembers: Address[];
|
|
295
|
-
/** Members requesting to join */
|
|
296
|
-
requestingMembers: Address[];
|
|
297
|
-
/** Group administrators */
|
|
298
|
-
admins: Address[];
|
|
299
|
-
/** Banned members */
|
|
300
|
-
banned: Address[];
|
|
301
|
-
/** Permission setting for adding members */
|
|
302
|
-
permissionAddMember: string;
|
|
303
|
-
/** Permission setting for editing group details */
|
|
304
|
-
permissionEditDetails: string;
|
|
305
|
-
/** Permission setting for sending messages */
|
|
306
|
-
permissionSendMessage: string;
|
|
307
|
-
/** Group invite link */
|
|
308
|
-
groupInviteLink?: string;
|
|
309
|
-
}
|
|
310
|
-
/**
|
|
311
|
-
* Represents a received message.
|
|
312
|
-
*/
|
|
313
|
-
export interface Message {
|
|
314
|
-
id: string;
|
|
315
|
-
source: string;
|
|
316
|
-
text?: string;
|
|
317
|
-
timestamp: number;
|
|
318
|
-
attachments?: Attachment[];
|
|
319
|
-
reactions?: Reaction[];
|
|
320
|
-
groupInfo?: {
|
|
321
|
-
id: string;
|
|
322
|
-
name?: string;
|
|
323
|
-
};
|
|
324
|
-
quote?: {
|
|
325
|
-
id: number;
|
|
326
|
-
author: string;
|
|
327
|
-
text?: string;
|
|
328
|
-
attachments?: Attachment[];
|
|
329
|
-
mentions?: Mention[];
|
|
330
|
-
};
|
|
331
|
-
mentions?: Mention[];
|
|
332
|
-
sticker?: Sticker;
|
|
333
|
-
textStyles?: TextStyle[];
|
|
334
|
-
expiresInSeconds?: number;
|
|
335
|
-
isViewOnce?: boolean;
|
|
336
|
-
remoteDelete?: boolean;
|
|
337
|
-
}
|
|
338
|
-
/**
|
|
339
|
-
* Represents a mention in a message.
|
|
340
|
-
*/
|
|
341
|
-
export interface Mention {
|
|
342
|
-
start: number;
|
|
343
|
-
length: number;
|
|
344
|
-
number: string;
|
|
345
|
-
name?: string;
|
|
346
|
-
}
|
|
347
|
-
/**
|
|
348
|
-
* Represents text styling in a message.
|
|
349
|
-
*/
|
|
350
|
-
export interface TextStyle {
|
|
351
|
-
start: number;
|
|
352
|
-
length: number;
|
|
353
|
-
style: 'BOLD' | 'ITALIC' | 'STRIKETHROUGH' | 'MONOSPACE' | 'SPOILER';
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* Represents a sticker in a message.
|
|
357
|
-
*/
|
|
358
|
-
export interface Sticker {
|
|
359
|
-
packId: string;
|
|
360
|
-
stickerId: number;
|
|
361
|
-
packKey?: string;
|
|
362
|
-
emoji?: string;
|
|
363
|
-
}
|
|
364
|
-
/**
|
|
365
|
-
* Represents a reaction to a message.
|
|
366
|
-
*/
|
|
367
|
-
export interface Reaction {
|
|
368
|
-
emoji: string;
|
|
369
|
-
sender: string;
|
|
370
|
-
timestamp: number;
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* Represents a contact in Signal.
|
|
374
|
-
*/
|
|
375
|
-
export interface Contact {
|
|
376
|
-
number: string;
|
|
377
|
-
name: string;
|
|
378
|
-
uuid?: string;
|
|
379
|
-
blocked: boolean;
|
|
380
|
-
profileName?: string;
|
|
381
|
-
profileAvatar?: string;
|
|
382
|
-
color?: string;
|
|
383
|
-
archived?: boolean;
|
|
384
|
-
mutedUntil?: number;
|
|
385
|
-
hideStory?: boolean;
|
|
386
|
-
}
|
|
387
|
-
/**
|
|
388
|
-
* Represents a Signal group.
|
|
389
|
-
*/
|
|
390
|
-
export interface Group {
|
|
391
|
-
id: string;
|
|
392
|
-
name: string;
|
|
393
|
-
members: string[];
|
|
394
|
-
admins?: string[];
|
|
395
|
-
isBlocked: boolean;
|
|
396
|
-
isMember: boolean;
|
|
397
|
-
isAdmin?: boolean;
|
|
398
|
-
description?: string;
|
|
399
|
-
avatar?: string;
|
|
400
|
-
color?: string;
|
|
401
|
-
archived?: boolean;
|
|
402
|
-
mutedUntil?: number;
|
|
403
|
-
inviteLink?: string;
|
|
404
|
-
permissionAddMember?: 'EVERY_MEMBER' | 'ONLY_ADMINS';
|
|
405
|
-
permissionEditDetails?: 'EVERY_MEMBER' | 'ONLY_ADMINS';
|
|
406
|
-
permissionSendMessage?: 'EVERY_MEMBER' | 'ONLY_ADMINS';
|
|
407
|
-
announcementsOnly?: boolean;
|
|
408
|
-
expirationTimer?: number;
|
|
409
|
-
}
|
|
410
|
-
/**
|
|
411
|
-
* Options for updating a Signal group.
|
|
412
|
-
*/
|
|
413
|
-
export interface GroupUpdateOptions {
|
|
414
|
-
name?: string;
|
|
415
|
-
description?: string;
|
|
416
|
-
avatar?: string;
|
|
417
|
-
addMembers?: string[];
|
|
418
|
-
removeMembers?: string[];
|
|
419
|
-
promoteAdmins?: string[];
|
|
420
|
-
demoteAdmins?: string[];
|
|
421
|
-
banMembers?: string[];
|
|
422
|
-
unbanMembers?: string[];
|
|
423
|
-
permissionAddMember?: 'EVERY_MEMBER' | 'ONLY_ADMINS';
|
|
424
|
-
permissionEditDetails?: 'EVERY_MEMBER' | 'ONLY_ADMINS';
|
|
425
|
-
permissionSendMessage?: 'EVERY_MEMBER' | 'ONLY_ADMINS';
|
|
426
|
-
announcementsOnly?: boolean;
|
|
427
|
-
expirationTimer?: number;
|
|
428
|
-
resetInviteLink?: boolean;
|
|
429
|
-
}
|
|
430
|
-
/**
|
|
431
|
-
* Represents an attachment in a message.
|
|
432
|
-
*/
|
|
433
|
-
export interface Attachment {
|
|
434
|
-
id: string;
|
|
435
|
-
filename: string;
|
|
436
|
-
contentType: string;
|
|
437
|
-
size?: number;
|
|
438
|
-
localPath?: string;
|
|
439
|
-
width?: number;
|
|
440
|
-
height?: number;
|
|
441
|
-
caption?: string;
|
|
442
|
-
voiceNote?: boolean;
|
|
443
|
-
borderless?: boolean;
|
|
444
|
-
gif?: boolean;
|
|
445
|
-
preview?: AttachmentPreview;
|
|
446
|
-
}
|
|
447
|
-
/**
|
|
448
|
-
* Represents a preview for an attachment.
|
|
449
|
-
*/
|
|
450
|
-
export interface AttachmentPreview {
|
|
451
|
-
url?: string;
|
|
452
|
-
title?: string;
|
|
453
|
-
description?: string;
|
|
454
|
-
image?: string;
|
|
455
|
-
date?: number;
|
|
456
|
-
}
|
|
457
|
-
/**
|
|
458
|
-
* Options for sending a message.
|
|
459
|
-
*/
|
|
460
|
-
export interface SendMessageOptions {
|
|
461
|
-
message?: string;
|
|
462
|
-
attachments?: string[];
|
|
463
|
-
mentions?: Mention[];
|
|
464
|
-
textStyles?: TextStyle[];
|
|
465
|
-
quote?: {
|
|
466
|
-
timestamp: number;
|
|
467
|
-
author: string;
|
|
468
|
-
text?: string;
|
|
469
|
-
attachments?: Attachment[];
|
|
470
|
-
mentions?: Mention[];
|
|
471
|
-
};
|
|
472
|
-
sticker?: Sticker;
|
|
473
|
-
expiresInSeconds?: number;
|
|
474
|
-
isViewOnce?: boolean;
|
|
475
|
-
linkPreview?: boolean;
|
|
476
|
-
editMessage?: {
|
|
477
|
-
timestamp: number;
|
|
478
|
-
dataMessage: any;
|
|
479
|
-
};
|
|
480
|
-
}
|
|
481
|
-
/**
|
|
482
|
-
* Represents a user profile.
|
|
483
|
-
*/
|
|
484
|
-
export interface Profile {
|
|
485
|
-
name?: string;
|
|
486
|
-
about?: string;
|
|
487
|
-
aboutEmoji?: string;
|
|
488
|
-
avatar?: string;
|
|
489
|
-
mobileCoinAddress?: string;
|
|
490
|
-
visibleBadgeIds?: string[];
|
|
491
|
-
color?: string;
|
|
492
|
-
}
|
|
493
|
-
/**
|
|
494
|
-
* Options for updating a contact.
|
|
495
|
-
*/
|
|
496
|
-
export interface ContactUpdateOptions {
|
|
497
|
-
name?: string;
|
|
498
|
-
color?: string;
|
|
499
|
-
block?: boolean;
|
|
500
|
-
unblock?: boolean;
|
|
501
|
-
archived?: boolean;
|
|
502
|
-
muted?: boolean;
|
|
503
|
-
mutedUntil?: number;
|
|
504
|
-
hideStory?: boolean;
|
|
505
|
-
}
|
|
506
|
-
/**
|
|
507
|
-
* Represents account configuration.
|
|
508
|
-
*/
|
|
509
|
-
export interface AccountConfiguration {
|
|
510
|
-
readReceipts?: boolean;
|
|
511
|
-
unidentifiedDeliveryIndicators?: boolean;
|
|
512
|
-
typingIndicators?: boolean;
|
|
513
|
-
linkPreviews?: boolean;
|
|
514
|
-
keepMutedChatsArchived?: boolean;
|
|
515
|
-
universalExpireTimer?: number;
|
|
516
|
-
phoneNumberSharingMode?: 'EVERYBODY' | 'CONTACTS_ONLY' | 'NOBODY';
|
|
517
|
-
phoneNumberDiscoverability?: boolean;
|
|
518
|
-
}
|
|
519
|
-
/**
|
|
520
|
-
* Options for updating account settings.
|
|
521
|
-
*/
|
|
522
|
-
export interface AccountUpdateOptions {
|
|
523
|
-
/** Whether the account can be discovered by phone number */
|
|
524
|
-
discoverableByNumber?: boolean;
|
|
525
|
-
/** Who can see the phone number */
|
|
526
|
-
numberSharingMode?: 'EVERYBODY' | 'CONTACTS_ONLY' | 'NOBODY';
|
|
527
|
-
}
|
|
528
|
-
/**
|
|
529
|
-
* Represents a device linked to the account.
|
|
530
|
-
*/
|
|
531
|
-
export interface Device {
|
|
532
|
-
id: number;
|
|
533
|
-
name: string;
|
|
534
|
-
created: number;
|
|
535
|
-
lastSeen: number;
|
|
536
|
-
}
|
|
537
|
-
/**
|
|
538
|
-
* Represents receipt type for sendReceipt method.
|
|
539
|
-
*/
|
|
540
|
-
export type ReceiptType = 'read' | 'viewed' | 'delivered';
|
|
541
|
-
/**
|
|
542
|
-
* Represents a sticker pack.
|
|
543
|
-
*/
|
|
544
|
-
export interface StickerPack {
|
|
545
|
-
id: string;
|
|
546
|
-
key: string;
|
|
547
|
-
title: string;
|
|
548
|
-
author: string;
|
|
549
|
-
cover?: Sticker;
|
|
550
|
-
stickers: Sticker[];
|
|
551
|
-
installed: boolean;
|
|
552
|
-
}
|
|
553
|
-
/**
|
|
554
|
-
* Represents typing indicator actions.
|
|
555
|
-
*/
|
|
556
|
-
export type TypingAction = 'start' | 'stop';
|
|
557
|
-
/**
|
|
558
|
-
* Represents different message types for receive operations.
|
|
559
|
-
*/
|
|
560
|
-
export type MessageType = 'data' | 'typing' | 'receipt' | 'call' | 'sync' | 'story';
|
|
561
|
-
/**
|
|
562
|
-
* Options for receiving messages.
|
|
563
|
-
*/
|
|
564
|
-
export interface ReceiveOptions {
|
|
565
|
-
timeout?: number;
|
|
566
|
-
ignoreAttachments?: boolean;
|
|
567
|
-
ignoreStories?: boolean;
|
|
568
|
-
maxMessages?: number;
|
|
569
|
-
sendReadReceipts?: boolean;
|
|
570
|
-
since?: number;
|
|
571
|
-
}
|
|
572
|
-
/**
|
|
573
|
-
* Represents a PIN configuration.
|
|
574
|
-
*/
|
|
575
|
-
export interface PinConfiguration {
|
|
576
|
-
pin?: string;
|
|
577
|
-
registrationLock?: boolean;
|
|
578
|
-
}
|
|
579
|
-
/**
|
|
580
|
-
* Represents identity key information.
|
|
581
|
-
*/
|
|
582
|
-
export interface IdentityKey {
|
|
583
|
-
number: string;
|
|
584
|
-
identityKey: string;
|
|
585
|
-
trustLevel: 'TRUSTED_UNVERIFIED' | 'TRUSTED_VERIFIED' | 'UNTRUSTED';
|
|
586
|
-
addedDate: number;
|
|
587
|
-
firstUse: boolean;
|
|
588
|
-
}
|
|
589
|
-
/**
|
|
590
|
-
* Represents a user status (registered/unregistered).
|
|
591
|
-
*/
|
|
592
|
-
export interface UserStatus {
|
|
593
|
-
number: string;
|
|
594
|
-
registered: boolean;
|
|
595
|
-
uuid?: string;
|
|
596
|
-
}
|
|
597
|
-
/**
|
|
598
|
-
* Represents a CAPTCHA challenge.
|
|
599
|
-
*/
|
|
600
|
-
export interface CaptchaChallenge {
|
|
601
|
-
type: 'CAPTCHA' | 'RATE_LIMIT';
|
|
602
|
-
challenge?: string;
|
|
603
|
-
token?: string;
|
|
604
|
-
url?: string;
|
|
605
|
-
}
|
|
606
|
-
/**
|
|
607
|
-
* Represents rate limit challenge information.
|
|
608
|
-
*/
|
|
609
|
-
export interface RateLimitChallenge {
|
|
610
|
-
type: 'RATE_LIMIT';
|
|
611
|
-
retryAfter?: number;
|
|
612
|
-
captchaUrl?: string;
|
|
613
|
-
captchaToken?: string;
|
|
614
|
-
}
|
|
615
|
-
/**
|
|
616
|
-
* Options for device linking.
|
|
617
|
-
*/
|
|
618
|
-
export interface LinkingOptions {
|
|
619
|
-
name?: string;
|
|
620
|
-
qrCodeOutput?: 'console' | 'file' | 'base64';
|
|
621
|
-
qrCodePath?: string;
|
|
622
|
-
}
|
|
623
|
-
/**
|
|
624
|
-
* Represents QR code data for device linking.
|
|
625
|
-
*/
|
|
626
|
-
export interface QRCodeData {
|
|
627
|
-
uri: string;
|
|
628
|
-
qrCode?: string;
|
|
629
|
-
qrCodePath?: string;
|
|
630
|
-
qrCodeBase64?: string;
|
|
631
|
-
}
|
|
632
|
-
/**
|
|
633
|
-
* Represents the result of device linking.
|
|
634
|
-
*/
|
|
635
|
-
export interface LinkingResult {
|
|
636
|
-
success: boolean;
|
|
637
|
-
deviceId?: number;
|
|
638
|
-
deviceName?: string;
|
|
639
|
-
qrCode?: QRCodeData;
|
|
640
|
-
isLinked?: boolean;
|
|
641
|
-
error?: string;
|
|
642
|
-
}
|
|
643
|
-
/**
|
|
644
|
-
* Options for contact synchronization.
|
|
645
|
-
*/
|
|
646
|
-
export interface SyncOptions {
|
|
647
|
-
contacts?: boolean;
|
|
648
|
-
groups?: boolean;
|
|
649
|
-
blockedContacts?: boolean;
|
|
650
|
-
configuration?: boolean;
|
|
651
|
-
keys?: boolean;
|
|
652
|
-
}
|
|
653
|
-
/**
|
|
654
|
-
* Represents the result of contact synchronization.
|
|
655
|
-
*/
|
|
656
|
-
export interface ContactsSyncResult {
|
|
657
|
-
success: boolean;
|
|
658
|
-
contactsSync?: boolean;
|
|
659
|
-
groupsSync?: boolean;
|
|
660
|
-
configurationSync?: boolean;
|
|
661
|
-
error?: string;
|
|
662
|
-
}
|
|
663
|
-
/**
|
|
664
|
-
* Represents message request response types.
|
|
665
|
-
*/
|
|
666
|
-
export type MessageRequestResponseType = 'ACCEPT' | 'DELETE' | 'BLOCK' | 'BLOCK_AND_DELETE';
|
|
667
|
-
/**
|
|
668
|
-
* Options for responding to message requests.
|
|
669
|
-
*/
|
|
670
|
-
export interface MessageRequestResponseOptions {
|
|
671
|
-
sender: string;
|
|
672
|
-
responseType: MessageRequestResponseType;
|
|
673
|
-
}
|
|
674
|
-
/**
|
|
675
|
-
* Represents a payment notification for MobileCoin.
|
|
676
|
-
*/
|
|
677
|
-
export interface PaymentNotification {
|
|
678
|
-
recipient: string;
|
|
679
|
-
amount?: string;
|
|
680
|
-
currency?: 'MOB' | 'USD';
|
|
681
|
-
note?: string;
|
|
682
|
-
receiptId?: string;
|
|
683
|
-
}
|
|
684
|
-
/**
|
|
685
|
-
* Enhanced registration options with CAPTCHA support.
|
|
686
|
-
*/
|
|
687
|
-
export interface RegistrationOptions {
|
|
688
|
-
voice?: boolean;
|
|
689
|
-
captchaToken?: string;
|
|
690
|
-
captchaUrl?: string;
|
|
691
|
-
}
|
|
692
|
-
/**
|
|
693
|
-
* Enhanced verification options with PIN support.
|
|
694
|
-
*/
|
|
695
|
-
export interface VerificationOptions {
|
|
696
|
-
pin?: string;
|
|
697
|
-
storagePassword?: string;
|
|
698
|
-
}
|
|
699
|
-
/**
|
|
700
|
-
* Options for listing contacts.
|
|
701
|
-
*/
|
|
702
|
-
export interface ListContactsOptions {
|
|
703
|
-
/** Include all known recipients, not only contacts */
|
|
704
|
-
allRecipients?: boolean;
|
|
705
|
-
/** Specify if only blocked or unblocked contacts should be shown */
|
|
706
|
-
blocked?: boolean;
|
|
707
|
-
/** Find contacts with the given contact or profile name */
|
|
708
|
-
name?: string;
|
|
709
|
-
/** List the contacts with more details */
|
|
710
|
-
detailed?: boolean;
|
|
711
|
-
/** Include internal information that's normally not user visible */
|
|
712
|
-
internal?: boolean;
|
|
713
|
-
/** Specify one or more phone numbers to show */
|
|
714
|
-
recipients?: string[];
|
|
715
|
-
}
|
|
716
|
-
/**
|
|
717
|
-
* Configuration for SignalBot
|
|
718
|
-
*/
|
|
719
|
-
export interface BotConfig {
|
|
720
|
-
phoneNumber: string;
|
|
721
|
-
admins?: string[];
|
|
722
|
-
group?: {
|
|
723
|
-
name: string;
|
|
724
|
-
description?: string;
|
|
725
|
-
createIfNotExists?: boolean;
|
|
726
|
-
initialMembers?: string[];
|
|
727
|
-
avatar?: string;
|
|
728
|
-
};
|
|
729
|
-
settings?: {
|
|
730
|
-
commandPrefix?: string;
|
|
731
|
-
autoReact?: boolean;
|
|
732
|
-
logMessages?: boolean;
|
|
733
|
-
welcomeNewMembers?: boolean;
|
|
734
|
-
cooldownSeconds?: number;
|
|
735
|
-
maxMessageLength?: number;
|
|
736
|
-
};
|
|
737
|
-
}
|
|
738
|
-
/**
|
|
739
|
-
* Bot command definition
|
|
740
|
-
*/
|
|
741
|
-
export interface BotCommand {
|
|
742
|
-
name: string;
|
|
743
|
-
description: string;
|
|
744
|
-
adminOnly?: boolean;
|
|
745
|
-
handler: (message: ParsedMessage, args: string[], bot: any) => Promise<string | null | void>;
|
|
746
|
-
}
|
|
747
|
-
/**
|
|
748
|
-
* Parsed message for bot handling
|
|
749
|
-
*/
|
|
750
|
-
export interface ParsedMessage {
|
|
751
|
-
id: string;
|
|
752
|
-
source: string;
|
|
753
|
-
text: string;
|
|
754
|
-
timestamp: number;
|
|
755
|
-
groupInfo?: {
|
|
756
|
-
id: string;
|
|
757
|
-
name?: string;
|
|
758
|
-
groupId?: string;
|
|
759
|
-
};
|
|
760
|
-
isFromAdmin: boolean;
|
|
761
|
-
}
|
|
762
|
-
/**
|
|
763
|
-
* Bot statistics
|
|
764
|
-
*/
|
|
765
|
-
export interface BotStats {
|
|
766
|
-
messagesReceived: number;
|
|
767
|
-
commandsExecuted: number;
|
|
768
|
-
startTime: number;
|
|
769
|
-
lastActivity: number;
|
|
770
|
-
activeUsers: number;
|
|
771
|
-
}
|
|
772
|
-
/**
|
|
773
|
-
* Parameters for removing contacts
|
|
774
|
-
*/
|
|
775
|
-
export interface RemoveContactOptions {
|
|
776
|
-
/** Hide the contact in the contact list, but keep the data */
|
|
777
|
-
hide?: boolean;
|
|
778
|
-
/** Delete all data associated with this contact, including identity keys and sessions */
|
|
779
|
-
forget?: boolean;
|
|
780
|
-
}
|
|
781
|
-
/**
|
|
782
|
-
* Parameters for the 'removeContact' JSON-RPC method
|
|
783
|
-
*/
|
|
784
|
-
export interface JsonRpcRemoveContactParams {
|
|
785
|
-
recipient: string;
|
|
786
|
-
hide?: boolean;
|
|
787
|
-
forget?: boolean;
|
|
788
|
-
}
|
|
789
|
-
/**
|
|
790
|
-
* User registration status result
|
|
791
|
-
*/
|
|
792
|
-
export interface UserStatusResult {
|
|
793
|
-
/** Phone number that was checked */
|
|
794
|
-
number: string;
|
|
795
|
-
/** Whether the user is registered on Signal */
|
|
796
|
-
isRegistered: boolean;
|
|
797
|
-
/** User's Signal UUID if registered */
|
|
798
|
-
uuid?: string;
|
|
799
|
-
/** Username if available */
|
|
800
|
-
username?: string;
|
|
801
|
-
}
|
|
802
|
-
/**
|
|
803
|
-
* Parameters for the 'getUserStatus' JSON-RPC method
|
|
804
|
-
*/
|
|
805
|
-
export interface JsonRpcGetUserStatusParams {
|
|
806
|
-
/** Phone numbers to check */
|
|
807
|
-
recipients?: string[];
|
|
808
|
-
/** Usernames to check */
|
|
809
|
-
usernames?: string[];
|
|
810
|
-
}
|
|
811
|
-
/**
|
|
812
|
-
* Payment notification data
|
|
813
|
-
*/
|
|
814
|
-
export interface PaymentNotificationData {
|
|
815
|
-
/** Base64 encoded receipt blob */
|
|
816
|
-
receipt: string;
|
|
817
|
-
/** Optional note for the payment notification */
|
|
818
|
-
note?: string;
|
|
819
|
-
}
|
|
820
|
-
/**
|
|
821
|
-
* Parameters for the 'sendPaymentNotification' JSON-RPC method
|
|
822
|
-
*/
|
|
823
|
-
export interface JsonRpcSendPaymentNotificationParams {
|
|
824
|
-
/** Recipient phone number */
|
|
825
|
-
recipient?: string;
|
|
826
|
-
/** Group ID for group payments */
|
|
827
|
-
groupId?: string;
|
|
828
|
-
/** Base64 encoded receipt blob */
|
|
829
|
-
receipt: string;
|
|
830
|
-
/** Optional note for the payment notification */
|
|
831
|
-
note?: string;
|
|
832
|
-
}
|
|
833
|
-
/**
|
|
834
|
-
* Sticker pack manifest information
|
|
835
|
-
*/
|
|
836
|
-
export interface StickerPackManifest {
|
|
837
|
-
/** Path to the manifest.json file or zip file */
|
|
838
|
-
path: string;
|
|
839
|
-
/** Sticker pack title */
|
|
840
|
-
title?: string;
|
|
841
|
-
/** Sticker pack author */
|
|
842
|
-
author?: string;
|
|
843
|
-
/** Cover sticker information */
|
|
844
|
-
cover?: {
|
|
845
|
-
id: number;
|
|
846
|
-
emoji: string;
|
|
847
|
-
};
|
|
848
|
-
/** List of stickers in the pack */
|
|
849
|
-
stickers?: Array<{
|
|
850
|
-
id: number;
|
|
851
|
-
emoji: string;
|
|
852
|
-
}>;
|
|
853
|
-
}
|
|
854
|
-
/**
|
|
855
|
-
* Result of sticker pack upload
|
|
856
|
-
*/
|
|
857
|
-
export interface StickerPackUploadResult {
|
|
858
|
-
/** Unique pack ID */
|
|
859
|
-
packId: string;
|
|
860
|
-
/** Pack encryption key */
|
|
861
|
-
packKey: string;
|
|
862
|
-
/** Installation URL for the sticker pack */
|
|
863
|
-
installUrl?: string;
|
|
864
|
-
}
|
|
865
|
-
/**
|
|
866
|
-
* Parameters for the 'uploadStickerPack' JSON-RPC method
|
|
867
|
-
*/
|
|
868
|
-
export interface JsonRpcUploadStickerPackParams {
|
|
869
|
-
/** Path to manifest.json or zip file */
|
|
870
|
-
path: string;
|
|
871
|
-
}
|
|
872
|
-
/**
|
|
873
|
-
* Rate limit challenge result
|
|
874
|
-
*/
|
|
875
|
-
export interface RateLimitChallengeResult {
|
|
876
|
-
/** Whether the challenge was successful */
|
|
877
|
-
success: boolean;
|
|
878
|
-
/** Time to wait before retry (in seconds) */
|
|
879
|
-
retryAfter?: number;
|
|
880
|
-
/** Additional message from the server */
|
|
881
|
-
message?: string;
|
|
882
|
-
}
|
|
883
|
-
/**
|
|
884
|
-
* Parameters for the 'submitRateLimitChallenge' JSON-RPC method
|
|
885
|
-
*/
|
|
886
|
-
export interface JsonRpcSubmitRateLimitChallengeParams {
|
|
887
|
-
/** Challenge token from the proof required error */
|
|
888
|
-
challenge: string;
|
|
889
|
-
/** Captcha token from solved captcha */
|
|
890
|
-
captcha: string;
|
|
891
|
-
}
|
|
892
|
-
/**
|
|
893
|
-
* Phone number change session information
|
|
894
|
-
*/
|
|
895
|
-
export interface ChangeNumberSession {
|
|
896
|
-
/** Session identifier */
|
|
897
|
-
session: string;
|
|
898
|
-
/** New phone number */
|
|
899
|
-
newNumber: string;
|
|
900
|
-
/** Challenge token if required */
|
|
901
|
-
challenge?: string;
|
|
902
|
-
}
|
|
903
|
-
/**
|
|
904
|
-
* Parameters for starting phone number change
|
|
905
|
-
*/
|
|
906
|
-
export interface JsonRpcStartChangeNumberParams {
|
|
907
|
-
/** New phone number */
|
|
908
|
-
number: string;
|
|
909
|
-
/** Whether to use voice verification */
|
|
910
|
-
voice?: boolean;
|
|
911
|
-
/** Captcha token if required */
|
|
912
|
-
captcha?: string;
|
|
913
|
-
}
|
|
914
|
-
/**
|
|
915
|
-
* Parameters for finishing phone number change
|
|
916
|
-
*/
|
|
917
|
-
export interface JsonRpcFinishChangeNumberParams {
|
|
918
|
-
/** Verification code from SMS/voice */
|
|
919
|
-
code: string;
|
|
920
|
-
/** PIN if registration lock is enabled */
|
|
921
|
-
pin?: string;
|
|
922
|
-
}
|
|
923
|
-
/**
|
|
924
|
-
* Upload progress information
|
|
925
|
-
*/
|
|
926
|
-
export interface UploadProgress {
|
|
927
|
-
/** Total bytes to upload */
|
|
928
|
-
total: number;
|
|
929
|
-
/** Bytes uploaded so far */
|
|
930
|
-
uploaded: number;
|
|
931
|
-
/** Upload percentage (0-100) */
|
|
932
|
-
percentage: number;
|
|
933
|
-
/** Upload speed in bytes per second */
|
|
934
|
-
speed?: number;
|
|
935
|
-
/** Estimated time remaining in seconds */
|
|
936
|
-
timeRemaining?: number;
|
|
937
|
-
}
|