signal-sdk 0.1.0 → 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.
package/dist/config.d.ts CHANGED
@@ -31,8 +31,23 @@ export interface SignalCliConfig {
31
31
  trustNewIdentities?: 'on-first-use' | 'always' | 'never';
32
32
  /** Disable send log (for message resending) */
33
33
  disableSendLog?: boolean;
34
+ /** Daemon connection mode: json-rpc (default), unix-socket, tcp, http */
35
+ daemonMode?: 'json-rpc' | 'unix-socket' | 'tcp' | 'http';
36
+ /** Unix socket path (for unix-socket mode) */
37
+ socketPath?: string;
38
+ /** TCP host (for tcp mode) */
39
+ tcpHost?: string;
40
+ /** TCP port (for tcp or http mode) */
41
+ tcpPort?: number;
42
+ /** HTTP base URL (for http mode) */
43
+ httpBaseUrl?: string;
34
44
  }
35
- export declare const DEFAULT_CONFIG: Required<SignalCliConfig>;
45
+ export declare const DEFAULT_CONFIG: Required<Omit<SignalCliConfig, 'socketPath' | 'tcpHost' | 'tcpPort' | 'httpBaseUrl'> & {
46
+ socketPath: string;
47
+ tcpHost: string;
48
+ tcpPort: number;
49
+ httpBaseUrl: string;
50
+ }>;
36
51
  /**
37
52
  * Validates and merges configuration with defaults
38
53
  * @param userConfig User-provided configuration
package/dist/config.js CHANGED
@@ -20,7 +20,12 @@ exports.DEFAULT_CONFIG = {
20
20
  minRequestInterval: 100,
21
21
  autoReconnect: true,
22
22
  trustNewIdentities: 'on-first-use',
23
- disableSendLog: false
23
+ disableSendLog: false,
24
+ daemonMode: 'json-rpc',
25
+ socketPath: '/tmp/signal-cli.sock',
26
+ tcpHost: 'localhost',
27
+ tcpPort: 7583,
28
+ httpBaseUrl: 'http://localhost:8080'
24
29
  };
25
30
  /**
26
31
  * Validates and merges configuration with defaults
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { SignalCli } from './SignalCli';
2
2
  export { SignalBot } from './SignalBot';
3
+ export { MultiAccountManager } from './MultiAccountManager';
3
4
  export * from './interfaces';
4
5
  export * from './errors';
5
6
  export * from './validators';
package/dist/index.js CHANGED
@@ -14,11 +14,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.SignalBot = exports.SignalCli = void 0;
17
+ exports.MultiAccountManager = exports.SignalBot = exports.SignalCli = void 0;
18
18
  var SignalCli_1 = require("./SignalCli");
19
19
  Object.defineProperty(exports, "SignalCli", { enumerable: true, get: function () { return SignalCli_1.SignalCli; } });
20
20
  var SignalBot_1 = require("./SignalBot");
21
21
  Object.defineProperty(exports, "SignalBot", { enumerable: true, get: function () { return SignalBot_1.SignalBot; } });
22
+ var MultiAccountManager_1 = require("./MultiAccountManager");
23
+ Object.defineProperty(exports, "MultiAccountManager", { enumerable: true, get: function () { return MultiAccountManager_1.MultiAccountManager; } });
22
24
  __exportStar(require("./interfaces"), exports);
23
25
  __exportStar(require("./errors"), exports);
24
26
  __exportStar(require("./validators"), exports);
@@ -278,6 +278,8 @@ export interface SendResponse {
278
278
  export interface GroupInfo {
279
279
  /** Base64 encoded group ID */
280
280
  groupId: string;
281
+ /** Alias for groupId */
282
+ id?: string;
281
283
  /** Group display name */
282
284
  name: string;
283
285
  /** Group description */
@@ -306,17 +308,23 @@ export interface GroupInfo {
306
308
  permissionSendMessage: string;
307
309
  /** Group invite link */
308
310
  groupInviteLink?: string;
311
+ /** Alias for groupInviteLink */
312
+ inviteLink?: string;
309
313
  }
310
314
  /**
311
315
  * Represents a received message.
312
316
  */
313
317
  export interface Message {
314
- id: string;
318
+ id?: string;
315
319
  source: string;
320
+ sourceUuid?: string;
321
+ sourceDevice?: number;
316
322
  text?: string;
317
323
  timestamp: number;
318
324
  attachments?: Attachment[];
319
325
  reactions?: Reaction[];
326
+ reaction?: any;
327
+ groupId?: string;
320
328
  groupInfo?: {
321
329
  id: string;
322
330
  name?: string;
@@ -333,8 +341,12 @@ export interface Message {
333
341
  textStyles?: TextStyle[];
334
342
  expiresInSeconds?: number;
335
343
  isViewOnce?: boolean;
344
+ viewOnce?: boolean;
336
345
  remoteDelete?: boolean;
337
346
  isExpirationUpdate?: boolean;
347
+ syncMessage?: any;
348
+ receipt?: any;
349
+ typing?: any;
338
350
  }
339
351
  /**
340
352
  * Represents a mention in a message.
@@ -343,6 +355,7 @@ export interface Mention {
343
355
  start: number;
344
356
  length: number;
345
357
  number: string;
358
+ recipient?: string;
346
359
  name?: string;
347
360
  }
348
361
  /**
@@ -379,11 +392,23 @@ export interface Contact {
379
392
  uuid?: string;
380
393
  blocked: boolean;
381
394
  profileName?: string;
395
+ /** Given name (first name) from profile */
396
+ givenName?: string;
397
+ /** Family name (last name) from profile */
398
+ familyName?: string;
399
+ /** MobileCoin address for payments */
400
+ mobileCoinAddress?: string;
382
401
  profileAvatar?: string;
383
402
  color?: string;
384
403
  archived?: boolean;
385
404
  mutedUntil?: number;
386
405
  hideStory?: boolean;
406
+ /** Profile key for encrypted profile access */
407
+ profileKey?: string;
408
+ /** Contact's username */
409
+ username?: string;
410
+ /** Whether this contact is a registered Signal user */
411
+ registered?: boolean;
387
412
  }
388
413
  /**
389
414
  * Represents a Signal group.
@@ -393,6 +418,14 @@ export interface Group {
393
418
  name: string;
394
419
  members: string[];
395
420
  admins?: string[];
421
+ /** Pending members awaiting invite acceptance */
422
+ pendingMembers?: string[];
423
+ /** Banned members who cannot rejoin */
424
+ bannedMembers?: string[];
425
+ /** Group invite link for joining */
426
+ inviteLink?: string;
427
+ /** Whether invite link approval is required */
428
+ inviteLinkRequiresApproval?: boolean;
396
429
  isBlocked: boolean;
397
430
  isMember: boolean;
398
431
  isAdmin?: boolean;
@@ -401,12 +434,15 @@ export interface Group {
401
434
  color?: string;
402
435
  archived?: boolean;
403
436
  mutedUntil?: number;
404
- inviteLink?: string;
405
437
  permissionAddMember?: 'EVERY_MEMBER' | 'ONLY_ADMINS';
406
438
  permissionEditDetails?: 'EVERY_MEMBER' | 'ONLY_ADMINS';
407
439
  permissionSendMessage?: 'EVERY_MEMBER' | 'ONLY_ADMINS';
408
440
  announcementsOnly?: boolean;
409
441
  expirationTimer?: number;
442
+ /** Group version (v1 or v2) */
443
+ version?: number;
444
+ /** Group master key for v2 groups */
445
+ masterKey?: string;
410
446
  }
411
447
  /**
412
448
  * Options for updating a Signal group.
@@ -469,15 +505,18 @@ export interface SendMessageOptions {
469
505
  text?: string;
470
506
  attachments?: Attachment[];
471
507
  mentions?: Mention[];
508
+ textStyles?: TextStyle[];
472
509
  };
473
510
  sticker?: Sticker;
474
511
  expiresInSeconds?: number;
475
512
  isViewOnce?: boolean;
476
513
  linkPreview?: boolean;
477
- editMessage?: {
478
- timestamp: number;
479
- dataMessage: any;
480
- };
514
+ previewUrl?: string;
515
+ editTimestamp?: number;
516
+ storyTimestamp?: number;
517
+ storyAuthor?: string;
518
+ noteToSelf?: boolean;
519
+ endSession?: boolean;
481
520
  }
482
521
  /**
483
522
  * Represents a user profile.
@@ -583,9 +622,10 @@ export interface PinConfiguration {
583
622
  export interface IdentityKey {
584
623
  number: string;
585
624
  identityKey: string;
586
- trustLevel: 'TRUSTED_UNVERIFIED' | 'TRUSTED_VERIFIED' | 'UNTRUSTED';
587
- addedDate: number;
588
- firstUse: boolean;
625
+ safetyNumber?: string;
626
+ trustLevel?: 'TRUSTED_UNVERIFIED' | 'TRUSTED_VERIFIED' | 'UNTRUSTED' | 'TRUST_ON_FIRST_USE';
627
+ addedDate?: number;
628
+ firstUse?: boolean;
589
629
  }
590
630
  /**
591
631
  * Represents a user status (registered/unregistered).
@@ -1055,6 +1095,21 @@ export interface AccountUpdateResult {
1055
1095
  /** Error message if failed */
1056
1096
  error?: string;
1057
1097
  }
1098
+ /**
1099
+ * Options for receiving messages
1100
+ */
1101
+ export interface ReceiveOptions {
1102
+ /** Timeout in seconds (default: 5) */
1103
+ timeout?: number;
1104
+ /** Maximum number of messages to receive (default: unlimited) */
1105
+ maxMessages?: number;
1106
+ /** Skip downloading attachments */
1107
+ ignoreAttachments?: boolean;
1108
+ /** Skip receiving stories */
1109
+ ignoreStories?: boolean;
1110
+ /** Send read receipts automatically */
1111
+ sendReadReceipts?: boolean;
1112
+ }
1058
1113
  /**
1059
1114
  * Options for sending contacts sync
1060
1115
  */
package/dist/retry.js CHANGED
@@ -70,14 +70,31 @@ async function withRetry(operation, options = {}) {
70
70
  * @returns Result of the promise
71
71
  */
72
72
  async function withTimeout(promise, timeoutMs) {
73
- return Promise.race([
74
- promise,
75
- new Promise((_, reject) => {
76
- setTimeout(() => {
77
- reject(new errors_1.TimeoutError(`Operation timed out after ${timeoutMs}ms`));
78
- }, timeoutMs);
79
- })
80
- ]);
73
+ let timeoutHandle = null;
74
+ const timeoutPromise = new Promise((_, reject) => {
75
+ timeoutHandle = setTimeout(() => {
76
+ reject(new errors_1.TimeoutError(`Operation timed out after ${timeoutMs}ms`));
77
+ }, timeoutMs);
78
+ // Use unref() to prevent this timer from keeping the process alive
79
+ if (timeoutHandle.unref) {
80
+ timeoutHandle.unref();
81
+ }
82
+ });
83
+ try {
84
+ const result = await Promise.race([promise, timeoutPromise]);
85
+ // Clear the timeout if the promise resolves first
86
+ if (timeoutHandle) {
87
+ clearTimeout(timeoutHandle);
88
+ }
89
+ return result;
90
+ }
91
+ catch (error) {
92
+ // Clear the timeout if the promise rejects
93
+ if (timeoutHandle) {
94
+ clearTimeout(timeoutHandle);
95
+ }
96
+ throw error;
97
+ }
81
98
  }
82
99
  /**
83
100
  * Sleep for a specified duration
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "signal-sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "A comprehensive TypeScript SDK for Signal Messenger with native JSON-RPC support, providing high-performance messaging, bot framework, and full signal-cli integration.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",