signal-sdk 0.0.9 → 0.1.1

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 (44) hide show
  1. package/README.md +184 -61
  2. package/dist/MultiAccountManager.d.ts +149 -0
  3. package/dist/MultiAccountManager.js +320 -0
  4. package/dist/SignalBot.d.ts +1 -0
  5. package/dist/SignalBot.js +20 -2
  6. package/dist/SignalCli.d.ts +315 -16
  7. package/dist/SignalCli.js +880 -26
  8. package/dist/__tests__/MultiAccountManager.test.d.ts +4 -0
  9. package/dist/__tests__/MultiAccountManager.test.js +209 -0
  10. package/dist/__tests__/SignalBot.additional.test.d.ts +5 -0
  11. package/dist/__tests__/SignalBot.additional.test.js +353 -0
  12. package/dist/__tests__/SignalBot.test.js +5 -0
  13. package/dist/__tests__/SignalCli.advanced.test.d.ts +5 -0
  14. package/dist/__tests__/SignalCli.advanced.test.js +295 -0
  15. package/dist/__tests__/SignalCli.e2e.test.d.ts +5 -0
  16. package/dist/__tests__/SignalCli.e2e.test.js +240 -0
  17. package/dist/__tests__/SignalCli.integration.test.d.ts +5 -0
  18. package/dist/__tests__/SignalCli.integration.test.js +225 -0
  19. package/dist/__tests__/SignalCli.methods.test.d.ts +5 -0
  20. package/dist/__tests__/SignalCli.methods.test.js +556 -0
  21. package/dist/__tests__/SignalCli.parsing.test.d.ts +5 -0
  22. package/dist/__tests__/SignalCli.parsing.test.js +258 -0
  23. package/dist/__tests__/SignalCli.test.js +249 -13
  24. package/dist/__tests__/config.test.d.ts +5 -0
  25. package/dist/__tests__/config.test.js +252 -0
  26. package/dist/__tests__/errors.test.d.ts +5 -0
  27. package/dist/__tests__/errors.test.js +276 -0
  28. package/dist/__tests__/retry.test.d.ts +4 -0
  29. package/dist/__tests__/retry.test.js +123 -0
  30. package/dist/__tests__/validators.test.d.ts +4 -0
  31. package/dist/__tests__/validators.test.js +147 -0
  32. package/dist/config.d.ts +82 -0
  33. package/dist/config.js +116 -0
  34. package/dist/errors.d.ts +32 -0
  35. package/dist/errors.js +75 -0
  36. package/dist/index.d.ts +5 -0
  37. package/dist/index.js +7 -1
  38. package/dist/interfaces.d.ts +200 -10
  39. package/dist/interfaces.js +1 -1
  40. package/dist/retry.d.ts +56 -0
  41. package/dist/retry.js +152 -0
  42. package/dist/validators.d.ts +59 -0
  43. package/dist/validators.js +170 -0
  44. package/package.json +1 -1
package/README.md CHANGED
@@ -16,7 +16,8 @@
16
16
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
17
17
  [![signal-cli](https://img.shields.io/badge/signal--cli-v0.13.22-blue.svg)](https://github.com/AsamK/signal-cli)
18
18
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.8+-blue.svg)](https://www.typescriptlang.org/)
19
- [![Node.js](https://img.shields.io/badge/Node.js-16+-green.svg)](https://nodejs.org/)
19
+ [![Node.js](https://img.shields.io/badge/Node.js-18+-green.svg)](https://nodejs.org/)
20
+ [![Tests](https://img.shields.io/badge/tests-310%20passing-brightgreen.svg)](./src/__tests__)
20
21
  [![Donate on Liberapay](https://img.shields.io/badge/Liberapay-Donate-yellow.svg)](https://liberapay.com/devbyben/donate)
21
22
 
22
23
  </div>
@@ -25,11 +26,15 @@
25
26
 
26
27
  ### Core Capabilities
27
28
 
28
- - **JSON-RPC Communication** - Direct communication with signal-cli daemon via JSON-RPC
29
- - **TypeScript Support** - Complete type definitions with full IntelliSense support
29
+ - **JSON-RPC Communication** - Direct communication with signal-cli daemon
30
+ - **TypeScript Support** - Complete type definitions with IntelliSense
30
31
  - **Message Management** - Send, receive, and manage Signal messages
31
- - **Real-time Events** - Listen to incoming messages and notifications
32
- - **Production Ready** - Robust error handling and connection management
32
+ - **Real-time Events** - Event-driven architecture for incoming messages
33
+ - **Enterprise-Grade** - Robust error handling and retry logic
34
+ - **Type-Safe Validation** - Comprehensive input validation
35
+ - **Retry Mechanism** - Exponential backoff with configurable policies
36
+ - **Structured Logging** - Multi-level logging system
37
+ - **Configuration Management** - Centralized configuration with validation
33
38
 
34
39
  ### SignalBot Framework
35
40
 
@@ -42,19 +47,32 @@
42
47
 
43
48
  ### Advanced Features
44
49
 
50
+ - **Multi-Account Support** - Manage multiple Signal accounts simultaneously with `MultiAccountManager`
51
+ - **Advanced Messaging** - Text styles (bold, italic), mentions, quotes, URL previews, message editing
52
+ - **Enhanced Receive** - Modern `receive()` method with options (timeout, ignore filters)
53
+ - **Username Management** - Set and delete Signal usernames
54
+ - **Identity Verification** - Get and verify safety numbers, manage untrusted identities
55
+ - **Advanced Groups** - Send invite links, manage banned members, reset group links
56
+ - **Enhanced Parsing** - Extract givenName, familyName, mobileCoinAddress from profiles and contacts
57
+ - **Daemon Modes** - Support for Unix socket, TCP, and HTTP daemon connections
45
58
  - **File Attachments** - Send and receive files, images, and media
46
- - **Group Operations** - Create, manage, and configure groups
47
- - **Contact Management** - Add, update, remove, and manage contacts
48
- - **Message Reactions** - React to messages with emoji reactions
59
+ - **Group Operations** - Create and manage groups with detailed information
60
+ - **Contact Management** - Manage contacts with export/import capabilities
61
+ - **Message Reactions** - React to messages with emoji
49
62
  - **Typing Indicators** - Send and receive typing notifications
50
63
  - **Read Receipts** - Track message delivery and read status
51
64
  - **Profile Management** - Update profile information and avatars
52
- - **Payment Notifications** - Send payment receipts and notifications
53
- - **Custom Sticker Packs** - Upload and manage custom sticker packs
54
- - **User Status Checking** - Verify Signal registration status
55
- - **Rate Limit Recovery** - Handle and recover from rate limiting
56
- - **Phone Number Changes** - Change registered phone numbers
57
- - **Progress Tracking** - Monitor upload progress for large files
65
+ - **Payment Notifications** - Send MobileCoin payment notifications with receipts
66
+ - **Sticker Packs** - Upload and manage custom sticker packs
67
+ - **User Status** - Verify Signal registration status
68
+ - **Rate Limiting** - Handle and recover from rate limits
69
+ - **Phone Number Changes** - Change registered phone numbers with verification
70
+ - **Progress Tracking** - Monitor upload progress
71
+ - **Polls** - Create, vote, and terminate polls
72
+ - **Attachment Retrieval** - Retrieve attachments, avatars, and stickers
73
+ - **Account Management** - Update account settings
74
+ - **Stories** - View and interact with Signal stories
75
+ - **Group Information** - Retrieve detailed group permissions
58
76
 
59
77
  ## Quick Start
60
78
 
@@ -66,7 +84,7 @@ npm install signal-sdk
66
84
 
67
85
  ### Prerequisites
68
86
 
69
- 1. **Node.js** (version 16 or later)
87
+ 1. **Node.js** (version 18 or later)
70
88
  2. **Java Runtime Environment** (required by signal-cli)
71
89
 
72
90
  **Note:** signal-cli binaries are included with the SDK - no separate installation required.
@@ -117,13 +135,13 @@ This command will:
117
135
  const { SignalCli } = require("signal-sdk");
118
136
 
119
137
  // Initialize SignalCli with phone number
120
- const signal = new SignalCli("+1234567890");
138
+ const signal = new SignalCli("+33111111111");
121
139
 
122
140
  // Connect to signal-cli daemon
123
141
  await signal.connect();
124
142
 
125
143
  // Send a message
126
- await signal.sendMessage("+0987654321", "Hello from Signal CLI SDK!");
144
+ await signal.sendMessage("+33222222222", "Hello from Signal SDK!");
127
145
 
128
146
  // Listen for incoming messages
129
147
  signal.on("message", (message) => {
@@ -134,6 +152,35 @@ signal.on("message", (message) => {
134
152
  await signal.gracefulShutdown();
135
153
  ```
136
154
 
155
+ ### Advanced Configuration
156
+
157
+ ```javascript
158
+ const { SignalCli, Logger } = require("signal-sdk");
159
+
160
+ // Configure with advanced settings
161
+ const config = {
162
+ retryConfig: {
163
+ maxAttempts: 3,
164
+ initialDelay: 1000,
165
+ maxDelay: 10000,
166
+ backoffMultiplier: 2,
167
+ },
168
+ rateLimiter: {
169
+ maxConcurrent: 5,
170
+ minInterval: 200,
171
+ },
172
+ logger: new Logger("info"),
173
+ };
174
+
175
+ const signal = new SignalCli("+33111111111", undefined, config);
176
+
177
+ await signal.connect();
178
+
179
+ // SDK automatically retries on failures, respects rate limits,
180
+ // validates inputs, and logs operations
181
+ await signal.sendMessage("+33222222222", "Reliable messaging!");
182
+ ```
183
+
137
184
  ### Create a Bot
138
185
 
139
186
  ```javascript
@@ -141,8 +188,8 @@ const { SignalBot } = require("signal-sdk");
141
188
 
142
189
  // Initialize bot with configuration
143
190
  const bot = new SignalBot({
144
- phoneNumber: "+1234567890",
145
- admins: ["+0987654321"],
191
+ phoneNumber: "+33111111111",
192
+ admins: ["+33222222222"],
146
193
  group: {
147
194
  name: "My Bot Group",
148
195
  description: "A group managed by my bot",
@@ -221,10 +268,10 @@ Your bot will automatically:
221
268
 
222
269
  ```javascript
223
270
  const { SignalCli } = require("signal-sdk");
224
- const signal = new SignalCli("+1234567890");
271
+ const signal = new SignalCli("+33111111111");
225
272
 
226
273
  await signal.connect();
227
- await signal.sendMessage("+0987654321", "Hello World!");
274
+ await signal.sendMessage("+33222222222", "Hello World!");
228
275
  await signal.gracefulShutdown();
229
276
  ```
230
277
 
@@ -232,12 +279,12 @@ await signal.gracefulShutdown();
232
279
 
233
280
  ```javascript
234
281
  // Send file with message
235
- await signal.sendMessage("+0987654321", "Here's the document:", {
282
+ await signal.sendMessage("+33222222222", "Here's the document:", {
236
283
  attachments: ["./path/to/document.pdf"],
237
284
  });
238
285
 
239
286
  // Send multiple files
240
- await signal.sendMessage("+0987654321", "Photos from today:", {
287
+ await signal.sendMessage("+33222222222", "Photos from today:", {
241
288
  attachments: ["./photo1.jpg", "./photo2.jpg"],
242
289
  });
243
290
  ```
@@ -247,8 +294,8 @@ await signal.sendMessage("+0987654321", "Photos from today:", {
247
294
  ```javascript
248
295
  // Create a new group
249
296
  const group = await signal.createGroup("My Group", [
250
- "+0987654321",
251
- "+1122334455",
297
+ "+33222222222",
298
+ "+33333333333",
252
299
  ]);
253
300
  console.log("Group ID:", group.groupId);
254
301
 
@@ -268,8 +315,8 @@ await signal.updateGroup(group.groupId, {
268
315
  const { SignalBot } = require("signal-sdk");
269
316
 
270
317
  const bot = new SignalBot({
271
- phoneNumber: "+1234567890",
272
- admins: ["+0987654321"],
318
+ phoneNumber: "+33111111111",
319
+ admins: ["+33222222222"],
273
320
  });
274
321
 
275
322
  // Add weather command
@@ -291,8 +338,57 @@ bot.on("groupMemberJoined", async (event) => {
291
338
  await bot.start();
292
339
  ```
293
340
 
341
+ ## Quality & Reliability
342
+
343
+ ### Code Quality
344
+
345
+ - **TypeScript Strict Mode** - Full type safety with strict compilation
346
+ - **Complete Type Coverage** - Type definitions for all APIs
347
+ - **Input Validation** - Comprehensive validation throughout
348
+ - **Error Handling** - Robust error classes and management
349
+ - **Retry Logic** - Exponential backoff with configurable policies
350
+ - **Configuration Management** - Validated configuration system
351
+
352
+ ### Enterprise Features
353
+
354
+ - **Automatic Retries** - Configurable retry policies with exponential backoff
355
+ - **Rate Limiting** - Built-in rate limiter to prevent throttling
356
+ - **Structured Logging** - Multi-level logging system
357
+ - **Input Sanitization** - Automatic sanitization of inputs
358
+ - **E.164 Validation** - Strict international phone number validation
359
+ - **Connection Management** - Graceful connection handling
360
+
361
+ ### Technical Specifications
362
+
363
+ - **Node.js**: >=18.0.0
364
+ - **TypeScript**: 5.8+ with strict mode
365
+ - **Test Coverage**: 225 passing tests across 9 suites
366
+ - **Code Coverage**: 57.52% overall, critical modules at 96-100%
367
+ - **signal-cli**: Compatible with v0.13.22
368
+
294
369
  ## Testing
295
370
 
371
+ The SDK has comprehensive test coverage to ensure reliability and quality.
372
+
373
+ ### Test Statistics
374
+
375
+ - **Total Tests**: 225 passing
376
+ - **Test Suites**: 9 suites
377
+ - **Overall Coverage**: 57.52%
378
+
379
+ ### Coverage by Module
380
+
381
+ | Module | Statements | Branches | Functions | Lines | Status |
382
+ | ----------------- | ---------- | -------- | --------- | ------ | -------------- |
383
+ | **validators.ts** | 100% | 100% | 100% | 100% | ✅ Perfect |
384
+ | **config.ts** | 100% | 97.22% | 100% | 100% | ✅ Excellent |
385
+ | **errors.ts** | 100% | 100% | 100% | 100% | ✅ Perfect |
386
+ | **retry.ts** | 96.15% | 85.71% | 100% | 97.95% | ✅ Excellent |
387
+ | **SignalCli.ts** | 68.68% | 55.46% | 65.9% | 72.7% | ✅ Good |
388
+ | **SignalBot.ts** | 24.33% | 16.94% | 29.68% | 24.59% | ⚠️ In Progress |
389
+
390
+ ### Running Tests
391
+
296
392
  ```bash
297
393
  # Run all tests
298
394
  npm test
@@ -300,10 +396,27 @@ npm test
300
396
  # Run specific test suite
301
397
  npm test -- --testNamePattern="SignalCli"
302
398
 
303
- # Run with coverage
399
+ # Run with coverage report
304
400
  npm run test:coverage
401
+
402
+ # Run tests in watch mode
403
+ npm test -- --watch
305
404
  ```
306
405
 
406
+ ### Test Suites
407
+
408
+ 1. **validators.test.ts** - Input validation (100% coverage)
409
+ 2. **config.test.ts** - Configuration management (100% coverage)
410
+ 3. **errors.test.ts** - Error handling (100% coverage)
411
+ 4. **retry.test.ts** - Retry logic (96% coverage)
412
+ 5. **SignalCli.test.ts** - Core CLI functionality
413
+ 6. **SignalCli.integration.test.ts** - Integration scenarios
414
+ 7. **SignalCli.methods.test.ts** - API methods (31 tests)
415
+ 8. **SignalBot.test.ts** - Bot framework
416
+ 9. **SignalBot.additional.test.ts** - Extended bot features
417
+
418
+ ````
419
+
307
420
  ## Development
308
421
 
309
422
  ```bash
@@ -322,7 +435,7 @@ npm run build && node examples/sdk/01-basic-usage.js
322
435
 
323
436
  # Run tests
324
437
  npm test
325
- ```
438
+ ````
326
439
 
327
440
  ## Configuration
328
441
 
@@ -331,9 +444,9 @@ npm test
331
444
  Create a `.env` file in your project root:
332
445
 
333
446
  ```env
334
- SIGNAL_PHONE_NUMBER="+1234567890"
335
- SIGNAL_ADMIN_NUMBER="+0987654321"
336
- SIGNAL_RECIPIENT_NUMBER="+1122334455"
447
+ SIGNAL_PHONE_NUMBER="+33111111111"
448
+ SIGNAL_ADMIN_NUMBER="+33222222222"
449
+ SIGNAL_RECIPIENT_NUMBER="+33333333333"
337
450
  SIGNAL_GROUP_NAME="My Bot Group"
338
451
  ```
339
452
 
@@ -348,7 +461,7 @@ const signal = new SignalCli(configPath, phoneNumber);
348
461
  // phoneNumber: Your registered Signal phone number (required)
349
462
 
350
463
  // Example with custom config path
351
- const signal = new SignalCli("/custom/signal-cli/config", "+1234567890");
464
+ const signal = new SignalCli("/custom/signal-cli/config", "+33111111111");
352
465
  ```
353
466
 
354
467
  ### SignalBot Configuration
@@ -357,8 +470,8 @@ const signal = new SignalCli("/custom/signal-cli/config", "+1234567890");
357
470
  const { SignalBot } = require("signal-sdk");
358
471
 
359
472
  const bot = new SignalBot({
360
- phoneNumber: "+1234567890", // Required: Your Signal phone number
361
- admins: ["+0987654321"], // Required: Admin phone numbers
473
+ phoneNumber: "+33111111111", // Required: Your Signal phone number
474
+ admins: ["+33222222222"], // Required: Admin phone numbers
362
475
  group: {
363
476
  name: "My Bot Group", // Group name
364
477
  description: "Managed by my bot", // Group description
@@ -403,15 +516,15 @@ const bot = new SignalBot({
403
516
 
404
517
  ```bash
405
518
  # Register your phone number with Signal first
406
- signal-cli -a +1234567890 register
407
- signal-cli -a +1234567890 verify CODE_FROM_SMS
519
+ signal-cli -a +33111111111 register
520
+ signal-cli -a +33111111111 verify CODE_FROM_SMS
408
521
  ```
409
522
 
410
523
  4. **Connection timeout**
411
524
 
412
525
  ```bash
413
526
  # Test signal-cli directly
414
- signal-cli -a +1234567890 send +0987654321 "Test message"
527
+ signal-cli -a +33111111111 send +33222222222 "Test message"
415
528
  ```
416
529
 
417
530
  5. **Permission denied on config directory**
@@ -459,29 +572,39 @@ This project is licensed under the MIT License - see the [LICENSE](./LICENSE) fi
459
572
 
460
573
  Compatible with signal-cli v0.13.22 - **100% Feature Coverage**
461
574
 
462
- | Category | Method | Description | Status |
463
- | ------------- | -------------------------- | ---------------------------------- | ------ |
464
- | **Messaging** | `send` | Send text messages and attachments | ✅ |
465
- | | `sendReaction` | React to messages with emoji | ✅ |
466
- | | `sendTyping` | Send typing indicators | ✅ |
467
- | | `sendReceipt` | Send read receipts | ✅ |
468
- | | `sendPaymentNotification` | Send payment notifications | ✅ |
469
- | **Groups** | `createGroup` | Create new groups | ✅ |
470
- | | `updateGroup` | Update group settings | ✅ |
471
- | | `listGroups` | List all groups | ✅ |
472
- | | `quitGroup` | Leave a group | ✅ |
473
- | **Contacts** | `listContacts` | List all contacts | ✅ |
474
- | | `updateContact` | Update contact information | ✅ |
475
- | | `removeContact` | Remove contacts with options | ✅ |
476
- | | `block` / `unblock` | Block/unblock contacts | ✅ |
477
- | | `getUserStatus` | Check registration status | ✅ |
478
- | **Stickers** | `listStickerPacks` | List sticker packs | ✅ |
479
- | | `addStickerPack` | Install sticker packs | ✅ |
480
- | | `uploadStickerPack` | Upload custom sticker packs | ✅ |
481
- | **Advanced** | `submitRateLimitChallenge` | Handle rate limiting | ✅ |
482
- | | `startChangeNumber` | Start phone number change | ✅ |
483
- | | `finishChangeNumber` | Complete phone number change | ✅ |
484
- | | `sendMessageWithProgress` | Enhanced messaging with progress | ✅ |
575
+ | Category | Method | Description | Status |
576
+ | --------------- | -------------------------- | ---------------------------------- | ------ |
577
+ | **Messaging** | `send` | Send text messages and attachments | ✅ |
578
+ | | `sendReaction` | React to messages with emoji | ✅ |
579
+ | | `sendTyping` | Send typing indicators | ✅ |
580
+ | | `sendReceipt` | Send read receipts | ✅ |
581
+ | | `sendPaymentNotification` | Send payment notifications | ✅ |
582
+ | | `sendPollCreate` | Create polls in conversations | ✅ |
583
+ | | `sendPollVote` | Vote on existing polls | ✅ |
584
+ | | `sendPollTerminate` | Terminate a poll | ✅ |
585
+ | **Groups** | `createGroup` | Create new groups | ✅ |
586
+ | | `updateGroup` | Update group settings | ✅ |
587
+ | | `listGroups` | List all groups | ✅ |
588
+ | | `listGroupsDetailed` | List groups with detailed info | ✅ |
589
+ | | `quitGroup` | Leave a group | ✅ |
590
+ | **Contacts** | `listContacts` | List all contacts | ✅ |
591
+ | | `updateContact` | Update contact information | ✅ |
592
+ | | `removeContact` | Remove contacts with options | ✅ |
593
+ | | `sendContacts` | Export/send contact data | ✅ |
594
+ | | `block` / `unblock` | Block/unblock contacts | ✅ |
595
+ | | `getUserStatus` | Check registration status | ✅ |
596
+ | **Account** | `updateAccount` | Update account settings | ✅ |
597
+ | | `listAccountsDetailed` | List accounts with detailed info | ✅ |
598
+ | **Attachments** | `getAttachment` | Retrieve attachment by ID | ✅ |
599
+ | | `getAvatar` | Retrieve avatar by ID | ✅ |
600
+ | | `getSticker` | Retrieve sticker by ID | ✅ |
601
+ | **Stickers** | `listStickerPacks` | List sticker packs | ✅ |
602
+ | | `addStickerPack` | Install sticker packs | ✅ |
603
+ | | `uploadStickerPack` | Upload custom sticker packs | ✅ |
604
+ | **Advanced** | `submitRateLimitChallenge` | Handle rate limiting | ✅ |
605
+ | | `startChangeNumber` | Start phone number change | ✅ |
606
+ | | `finishChangeNumber` | Complete phone number change | ✅ |
607
+ | | `sendMessageWithProgress` | Enhanced messaging with progress | ✅ |
485
608
 
486
609
  [Complete API documentation](./docs/api-reference.md)
487
610
 
@@ -0,0 +1,149 @@
1
+ /**
2
+ * Multi-Account Manager for Signal SDK
3
+ *
4
+ * Manages multiple Signal accounts simultaneously with event routing
5
+ * and isolated process management.
6
+ */
7
+ import { SignalCli } from './SignalCli';
8
+ import { EventEmitter } from 'events';
9
+ import { SignalCliConfig } from './config';
10
+ /**
11
+ * Configuration for a managed account
12
+ */
13
+ export interface ManagedAccount {
14
+ /** Account phone number */
15
+ account: string;
16
+ /** SignalCli instance */
17
+ instance: SignalCli;
18
+ /** Whether the account is connected */
19
+ connected: boolean;
20
+ /** Last activity timestamp */
21
+ lastActivity: number;
22
+ }
23
+ /**
24
+ * Options for MultiAccountManager
25
+ */
26
+ export interface MultiAccountOptions {
27
+ /** Path to signal-cli executable */
28
+ signalCliPath?: string;
29
+ /** Data directory for all accounts */
30
+ dataPath?: string;
31
+ /** Enable verbose logging */
32
+ verbose?: boolean;
33
+ /** Auto-reconnect on failure */
34
+ autoReconnect?: boolean;
35
+ }
36
+ /**
37
+ * Multi-Account Manager
38
+ *
39
+ * Manages multiple Signal accounts with event routing and lifecycle management.
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * const manager = new MultiAccountManager({
44
+ * dataPath: '/path/to/data',
45
+ * autoReconnect: true
46
+ * });
47
+ *
48
+ * // Add accounts
49
+ * await manager.addAccount('+33123456789');
50
+ * await manager.addAccount('+33987654321');
51
+ *
52
+ * // Listen to events from all accounts
53
+ * manager.on('message', (account, message) => {
54
+ * console.log(`Message from ${account}: ${message.text}`);
55
+ * });
56
+ *
57
+ * // Connect all accounts
58
+ * await manager.connectAll();
59
+ *
60
+ * // Send from specific account
61
+ * await manager.sendMessage('+33123456789', '+33111111111', 'Hello!');
62
+ * ```
63
+ */
64
+ export declare class MultiAccountManager extends EventEmitter {
65
+ private accounts;
66
+ private options;
67
+ private logger;
68
+ constructor(options?: MultiAccountOptions);
69
+ /**
70
+ * Add an account to the manager
71
+ *
72
+ * @param account - Phone number of the account
73
+ * @param config - Optional SignalCli configuration
74
+ * @returns The SignalCli instance
75
+ */
76
+ addAccount(account: string, config?: Partial<SignalCliConfig>): Promise<SignalCli>;
77
+ /**
78
+ * Remove an account from the manager
79
+ *
80
+ * @param account - Phone number of the account
81
+ */
82
+ removeAccount(account: string): Promise<void>;
83
+ /**
84
+ * Get a specific account instance
85
+ *
86
+ * @param account - Phone number of the account
87
+ * @returns The SignalCli instance
88
+ */
89
+ getAccount(account: string): SignalCli | undefined;
90
+ /**
91
+ * Get all managed accounts
92
+ *
93
+ * @returns Array of account phone numbers
94
+ */
95
+ getAccounts(): string[];
96
+ /**
97
+ * Check if an account exists
98
+ *
99
+ * @param account - Phone number of the account
100
+ * @returns True if the account exists
101
+ */
102
+ hasAccount(account: string): boolean;
103
+ /**
104
+ * Connect a specific account
105
+ *
106
+ * @param account - Phone number of the account
107
+ */
108
+ connect(account: string): Promise<void>;
109
+ /**
110
+ * Disconnect a specific account
111
+ *
112
+ * @param account - Phone number of the account
113
+ */
114
+ disconnect(account: string): Promise<void>;
115
+ /**
116
+ * Connect all accounts
117
+ */
118
+ connectAll(): Promise<void>;
119
+ /**
120
+ * Disconnect all accounts
121
+ */
122
+ disconnectAll(): Promise<void>;
123
+ /**
124
+ * Send a message from a specific account
125
+ *
126
+ * @param fromAccount - Account to send from
127
+ * @param recipient - Recipient phone number or group ID
128
+ * @param message - Message text
129
+ * @param options - Send options
130
+ */
131
+ sendMessage(fromAccount: string, recipient: string, message: string, options?: any): Promise<any>;
132
+ /**
133
+ * Get account status information
134
+ *
135
+ * @param account - Phone number of the account (optional)
136
+ * @returns Status information for all or specific account
137
+ */
138
+ getStatus(account?: string): any;
139
+ /**
140
+ * Setup event forwarding from an account instance
141
+ *
142
+ * @private
143
+ */
144
+ private setupEventForwarding;
145
+ /**
146
+ * Shutdown the manager and cleanup all accounts
147
+ */
148
+ shutdown(): Promise<void>;
149
+ }