@signalapp/libsignal-client 0.81.0 → 0.82.0

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 (166) hide show
  1. package/Native.d.ts +34 -31
  2. package/Native.js +4 -1
  3. package/dist/AccountKeys.d.ts +3 -3
  4. package/dist/AccountKeys.js +8 -14
  5. package/dist/Address.d.ts +1 -1
  6. package/dist/Address.js +8 -15
  7. package/dist/EcKeys.d.ts +1 -1
  8. package/dist/EcKeys.js +4 -10
  9. package/dist/Errors.d.ts +2 -2
  10. package/dist/Errors.js +5 -9
  11. package/dist/MessageBackup.d.ts +4 -4
  12. package/dist/MessageBackup.js +10 -18
  13. package/dist/Minidump.js +2 -6
  14. package/dist/Mp4Sanitizer.d.ts +2 -2
  15. package/dist/Mp4Sanitizer.js +3 -8
  16. package/dist/SealedSenderMultiRecipientMessage.d.ts +1 -1
  17. package/dist/SealedSenderMultiRecipientMessage.js +2 -5
  18. package/dist/WebpSanitizer.js +2 -6
  19. package/dist/acknowledgments.md +254 -89
  20. package/dist/incremental_mac.d.ts +1 -1
  21. package/dist/incremental_mac.js +11 -19
  22. package/dist/index.d.ts +18 -18
  23. package/dist/index.js +93 -158
  24. package/dist/internal.d.ts +2 -2
  25. package/dist/internal.js +3 -8
  26. package/dist/io.d.ts +1 -1
  27. package/dist/io.js +1 -5
  28. package/dist/net/CDSI.d.ts +2 -2
  29. package/dist/net/CDSI.js +8 -12
  30. package/dist/net/Chat.d.ts +11 -12
  31. package/dist/net/Chat.js +15 -22
  32. package/dist/net/KeyTransparency.d.ts +10 -10
  33. package/dist/net/KeyTransparency.js +4 -8
  34. package/dist/net/Registration.d.ts +5 -5
  35. package/dist/net/Registration.js +16 -22
  36. package/dist/net/SvrB.d.ts +3 -3
  37. package/dist/net/SvrB.js +5 -9
  38. package/dist/net/chat/UnauthUsernamesService.d.ts +4 -4
  39. package/dist/net/chat/UnauthUsernamesService.js +5 -7
  40. package/dist/net.d.ts +11 -11
  41. package/dist/net.js +27 -46
  42. package/dist/usernames.js +12 -23
  43. package/dist/zkgroup/GenericServerPublicParams.d.ts +1 -1
  44. package/dist/zkgroup/GenericServerPublicParams.js +3 -6
  45. package/dist/zkgroup/GenericServerSecretParams.d.ts +2 -2
  46. package/dist/zkgroup/GenericServerSecretParams.js +8 -11
  47. package/dist/zkgroup/NotarySignature.d.ts +1 -1
  48. package/dist/zkgroup/NotarySignature.js +3 -5
  49. package/dist/zkgroup/ServerPublicParams.d.ts +2 -2
  50. package/dist/zkgroup/ServerPublicParams.js +2 -5
  51. package/dist/zkgroup/ServerSecretParams.d.ts +3 -3
  52. package/dist/zkgroup/ServerSecretParams.js +10 -13
  53. package/dist/zkgroup/auth/AuthCredentialPresentation.d.ts +2 -2
  54. package/dist/zkgroup/auth/AuthCredentialPresentation.js +6 -9
  55. package/dist/zkgroup/auth/AuthCredentialWithPni.d.ts +1 -1
  56. package/dist/zkgroup/auth/AuthCredentialWithPni.js +3 -6
  57. package/dist/zkgroup/auth/AuthCredentialWithPniResponse.d.ts +1 -1
  58. package/dist/zkgroup/auth/AuthCredentialWithPniResponse.js +3 -6
  59. package/dist/zkgroup/auth/ClientZkAuthOperations.d.ts +6 -6
  60. package/dist/zkgroup/auth/ClientZkAuthOperations.js +9 -12
  61. package/dist/zkgroup/auth/ServerZkAuthOperations.d.ts +5 -5
  62. package/dist/zkgroup/auth/ServerZkAuthOperations.js +7 -10
  63. package/dist/zkgroup/backups/BackupAuthCredential.d.ts +5 -5
  64. package/dist/zkgroup/backups/BackupAuthCredential.js +12 -15
  65. package/dist/zkgroup/backups/BackupAuthCredentialPresentation.d.ts +4 -4
  66. package/dist/zkgroup/backups/BackupAuthCredentialPresentation.js +7 -10
  67. package/dist/zkgroup/backups/BackupAuthCredentialRequest.d.ts +5 -5
  68. package/dist/zkgroup/backups/BackupAuthCredentialRequest.js +8 -11
  69. package/dist/zkgroup/backups/BackupAuthCredentialRequestContext.d.ts +6 -6
  70. package/dist/zkgroup/backups/BackupAuthCredentialRequestContext.js +8 -11
  71. package/dist/zkgroup/backups/BackupAuthCredentialResponse.d.ts +1 -1
  72. package/dist/zkgroup/backups/BackupAuthCredentialResponse.js +3 -6
  73. package/dist/zkgroup/backups/BackupCredentialType.js +1 -3
  74. package/dist/zkgroup/backups/BackupLevel.js +1 -3
  75. package/dist/zkgroup/calllinks/CallLinkAuthCredential.d.ts +5 -5
  76. package/dist/zkgroup/calllinks/CallLinkAuthCredential.js +8 -11
  77. package/dist/zkgroup/calllinks/CallLinkAuthCredentialPresentation.d.ts +4 -4
  78. package/dist/zkgroup/calllinks/CallLinkAuthCredentialPresentation.js +5 -8
  79. package/dist/zkgroup/calllinks/CallLinkAuthCredentialResponse.d.ts +5 -5
  80. package/dist/zkgroup/calllinks/CallLinkAuthCredentialResponse.js +8 -11
  81. package/dist/zkgroup/calllinks/CallLinkPublicParams.d.ts +1 -1
  82. package/dist/zkgroup/calllinks/CallLinkPublicParams.js +3 -6
  83. package/dist/zkgroup/calllinks/CallLinkSecretParams.d.ts +4 -4
  84. package/dist/zkgroup/calllinks/CallLinkSecretParams.js +9 -12
  85. package/dist/zkgroup/calllinks/CreateCallLinkCredential.d.ts +5 -5
  86. package/dist/zkgroup/calllinks/CreateCallLinkCredential.js +8 -11
  87. package/dist/zkgroup/calllinks/CreateCallLinkCredentialPresentation.d.ts +3 -3
  88. package/dist/zkgroup/calllinks/CreateCallLinkCredentialPresentation.js +3 -6
  89. package/dist/zkgroup/calllinks/CreateCallLinkCredentialRequest.d.ts +4 -4
  90. package/dist/zkgroup/calllinks/CreateCallLinkCredentialRequest.js +8 -11
  91. package/dist/zkgroup/calllinks/CreateCallLinkCredentialRequestContext.d.ts +6 -6
  92. package/dist/zkgroup/calllinks/CreateCallLinkCredentialRequestContext.js +10 -13
  93. package/dist/zkgroup/calllinks/CreateCallLinkCredentialResponse.d.ts +1 -1
  94. package/dist/zkgroup/calllinks/CreateCallLinkCredentialResponse.js +3 -6
  95. package/dist/zkgroup/groups/ClientZkGroupCipher.d.ts +5 -5
  96. package/dist/zkgroup/groups/ClientZkGroupCipher.js +13 -16
  97. package/dist/zkgroup/groups/GroupIdentifier.d.ts +1 -1
  98. package/dist/zkgroup/groups/GroupIdentifier.js +3 -5
  99. package/dist/zkgroup/groups/GroupMasterKey.d.ts +1 -1
  100. package/dist/zkgroup/groups/GroupMasterKey.js +3 -5
  101. package/dist/zkgroup/groups/GroupPublicParams.d.ts +2 -2
  102. package/dist/zkgroup/groups/GroupPublicParams.js +5 -8
  103. package/dist/zkgroup/groups/GroupSecretParams.d.ts +3 -3
  104. package/dist/zkgroup/groups/GroupSecretParams.js +10 -13
  105. package/dist/zkgroup/groups/ProfileKeyCiphertext.d.ts +1 -1
  106. package/dist/zkgroup/groups/ProfileKeyCiphertext.js +3 -6
  107. package/dist/zkgroup/groups/UuidCiphertext.d.ts +1 -1
  108. package/dist/zkgroup/groups/UuidCiphertext.js +3 -6
  109. package/dist/zkgroup/groupsend/GroupSendDerivedKeyPair.d.ts +2 -2
  110. package/dist/zkgroup/groupsend/GroupSendDerivedKeyPair.js +3 -6
  111. package/dist/zkgroup/groupsend/GroupSendEndorsement.d.ts +5 -5
  112. package/dist/zkgroup/groupsend/GroupSendEndorsement.js +10 -13
  113. package/dist/zkgroup/groupsend/GroupSendEndorsementsResponse.d.ts +7 -7
  114. package/dist/zkgroup/groupsend/GroupSendEndorsementsResponse.js +14 -17
  115. package/dist/zkgroup/groupsend/GroupSendFullToken.d.ts +3 -3
  116. package/dist/zkgroup/groupsend/GroupSendFullToken.js +5 -8
  117. package/dist/zkgroup/groupsend/GroupSendToken.d.ts +2 -2
  118. package/dist/zkgroup/groupsend/GroupSendToken.js +5 -8
  119. package/dist/zkgroup/index.d.ts +57 -57
  120. package/dist/zkgroup/index.js +57 -118
  121. package/dist/zkgroup/internal/ByteArray.js +6 -10
  122. package/dist/zkgroup/internal/Constants.js +4 -7
  123. package/dist/zkgroup/profiles/ClientZkProfileOperations.d.ts +8 -8
  124. package/dist/zkgroup/profiles/ClientZkProfileOperations.js +12 -15
  125. package/dist/zkgroup/profiles/ExpiringProfileKeyCredential.d.ts +1 -1
  126. package/dist/zkgroup/profiles/ExpiringProfileKeyCredential.js +3 -6
  127. package/dist/zkgroup/profiles/ExpiringProfileKeyCredentialResponse.d.ts +1 -1
  128. package/dist/zkgroup/profiles/ExpiringProfileKeyCredentialResponse.js +3 -6
  129. package/dist/zkgroup/profiles/ProfileKey.d.ts +4 -4
  130. package/dist/zkgroup/profiles/ProfileKey.js +8 -10
  131. package/dist/zkgroup/profiles/ProfileKeyCommitment.d.ts +1 -1
  132. package/dist/zkgroup/profiles/ProfileKeyCommitment.js +3 -6
  133. package/dist/zkgroup/profiles/ProfileKeyCredentialPresentation.d.ts +3 -3
  134. package/dist/zkgroup/profiles/ProfileKeyCredentialPresentation.js +7 -10
  135. package/dist/zkgroup/profiles/ProfileKeyCredentialRequest.d.ts +1 -1
  136. package/dist/zkgroup/profiles/ProfileKeyCredentialRequest.js +3 -6
  137. package/dist/zkgroup/profiles/ProfileKeyCredentialRequestContext.d.ts +2 -2
  138. package/dist/zkgroup/profiles/ProfileKeyCredentialRequestContext.js +5 -8
  139. package/dist/zkgroup/profiles/ProfileKeyVersion.d.ts +1 -1
  140. package/dist/zkgroup/profiles/ProfileKeyVersion.js +3 -5
  141. package/dist/zkgroup/profiles/ServerZkProfileOperations.d.ts +7 -7
  142. package/dist/zkgroup/profiles/ServerZkProfileOperations.js +7 -10
  143. package/dist/zkgroup/receipts/ClientZkReceiptOperations.d.ts +6 -6
  144. package/dist/zkgroup/receipts/ClientZkReceiptOperations.js +12 -15
  145. package/dist/zkgroup/receipts/ReceiptCredential.d.ts +1 -1
  146. package/dist/zkgroup/receipts/ReceiptCredential.js +3 -6
  147. package/dist/zkgroup/receipts/ReceiptCredentialPresentation.d.ts +2 -2
  148. package/dist/zkgroup/receipts/ReceiptCredentialPresentation.js +6 -8
  149. package/dist/zkgroup/receipts/ReceiptCredentialRequest.d.ts +1 -1
  150. package/dist/zkgroup/receipts/ReceiptCredentialRequest.js +3 -6
  151. package/dist/zkgroup/receipts/ReceiptCredentialRequestContext.d.ts +2 -2
  152. package/dist/zkgroup/receipts/ReceiptCredentialRequestContext.js +6 -8
  153. package/dist/zkgroup/receipts/ReceiptCredentialResponse.d.ts +1 -1
  154. package/dist/zkgroup/receipts/ReceiptCredentialResponse.js +3 -6
  155. package/dist/zkgroup/receipts/ReceiptSerial.d.ts +1 -1
  156. package/dist/zkgroup/receipts/ReceiptSerial.js +3 -5
  157. package/dist/zkgroup/receipts/ServerZkReceiptOperations.d.ts +4 -4
  158. package/dist/zkgroup/receipts/ServerZkReceiptOperations.js +7 -10
  159. package/package.json +24 -20
  160. package/prebuilds/darwin-arm64/@signalapp+libsignal-client.node +0 -0
  161. package/prebuilds/darwin-x64/@signalapp+libsignal-client.node +0 -0
  162. package/prebuilds/linux-arm64/@signalapp+libsignal-client.node +0 -0
  163. package/prebuilds/linux-x64/@signalapp+libsignal-client.node +0 -0
  164. package/prebuilds/win32-arm64/@signalapp+libsignal-client.node +0 -0
  165. package/prebuilds/win32-x64/@signalapp+libsignal-client.node +0 -0
  166. package/zkgroup.js +1 -1
package/dist/io.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as Native from '../Native';
1
+ import Native from '../Native.js';
2
2
  /**
3
3
  * An abstract class representing an input stream of bytes.
4
4
  */
package/dist/io.js CHANGED
@@ -1,14 +1,11 @@
1
- "use strict";
2
1
  //
3
2
  // Copyright 2023 Signal Messenger, LLC.
4
3
  // SPDX-License-Identifier: AGPL-3.0-only
5
4
  //
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.InputStream = void 0;
8
5
  /**
9
6
  * An abstract class representing an input stream of bytes.
10
7
  */
11
- class InputStream {
8
+ export class InputStream {
12
9
  _read(amount) {
13
10
  return this.read(amount);
14
11
  }
@@ -24,5 +21,4 @@ class InputStream {
24
21
  return Promise.resolve();
25
22
  }
26
23
  }
27
- exports.InputStream = InputStream;
28
24
  //# sourceMappingURL=io.js.map
@@ -1,6 +1,6 @@
1
1
  import type { ReadonlyDeep } from 'type-fest';
2
- import * as Native from '../../Native';
3
- import { TokioAsyncContext, ServiceAuth } from '../net';
2
+ import Native from '../../Native.js';
3
+ import { TokioAsyncContext, ServiceAuth } from '../net.js';
4
4
  export type CDSRequestOptionsType = {
5
5
  e164s: Array<string>;
6
6
  acisAndAccessKeys: Array<{
package/dist/net/CDSI.js CHANGED
@@ -1,24 +1,20 @@
1
- "use strict";
2
1
  //
3
2
  // Copyright 2025 Signal Messenger, LLC.
4
3
  // SPDX-License-Identifier: AGPL-3.0-only
5
4
  //
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.cdsiLookup = void 0;
8
- const Native = require("../../Native");
9
- const Address_1 = require("../Address");
10
- const node_buffer_1 = require("node:buffer");
11
- const internal_1 = require("../internal");
12
- async function cdsiLookup({ asyncContext, connectionManager, }, { username, password }, { e164s, acisAndAccessKeys, abortSignal }) {
13
- const request = (0, internal_1.newNativeHandle)(Native.LookupRequest_new());
5
+ import Native from '../../Native.js';
6
+ import { Aci } from '../Address.js';
7
+ import { Buffer } from 'node:buffer';
8
+ import { newNativeHandle } from '../internal.js';
9
+ export async function cdsiLookup({ asyncContext, connectionManager, }, { username, password }, { e164s, acisAndAccessKeys, abortSignal }) {
10
+ const request = newNativeHandle(Native.LookupRequest_new());
14
11
  e164s.forEach((e164) => {
15
12
  Native.LookupRequest_addE164(request, e164);
16
13
  });
17
14
  acisAndAccessKeys.forEach(({ aci: aciStr, accessKey: accessKeyStr }) => {
18
- Native.LookupRequest_addAciAndAccessKey(request, Address_1.Aci.parseFromServiceIdString(aciStr).getServiceIdFixedWidthBinary(), node_buffer_1.Buffer.from(accessKeyStr, 'base64'));
15
+ Native.LookupRequest_addAciAndAccessKey(request, Aci.parseFromServiceIdString(aciStr).getServiceIdFixedWidthBinary(), Buffer.from(accessKeyStr, 'base64'));
19
16
  });
20
17
  const lookup = await asyncContext.makeCancellable(abortSignal, Native.CdsiLookup_new(asyncContext, connectionManager, username, password, request));
21
- return await asyncContext.makeCancellable(abortSignal, Native.CdsiLookup_complete(asyncContext, (0, internal_1.newNativeHandle)(lookup)));
18
+ return await asyncContext.makeCancellable(abortSignal, Native.CdsiLookup_complete(asyncContext, newNativeHandle(lookup)));
22
19
  }
23
- exports.cdsiLookup = cdsiLookup;
24
20
  //# sourceMappingURL=CDSI.js.map
@@ -1,8 +1,7 @@
1
- import * as Native from '../../Native';
2
- import { LibSignalError } from '../Errors';
3
- import { Wrapper } from '../../Native';
4
- import { TokioAsyncContext, Environment } from '../net';
5
- import * as KT from './KeyTransparency';
1
+ import Native, { Wrapper } from '../../Native.js';
2
+ import { LibSignalError } from '../Errors.js';
3
+ import { TokioAsyncContext, Environment } from '../net.js';
4
+ import * as KT from './KeyTransparency.js';
6
5
  export type ChatRequest = Readonly<{
7
6
  verb: string;
8
7
  path: string;
@@ -27,7 +26,7 @@ export interface ConnectionEventsListener {
27
26
  * closures. If the closure was not due to a deliberate disconnect, the error
28
27
  * will be provided.
29
28
  */
30
- onConnectionInterrupted(cause: LibSignalError | null): void;
29
+ onConnectionInterrupted: (cause: LibSignalError | null) => void;
31
30
  }
32
31
  export interface ChatServiceListener extends ConnectionEventsListener {
33
32
  /**
@@ -38,20 +37,20 @@ export interface ChatServiceListener extends ConnectionEventsListener {
38
37
  * If `ack`'s `send` method is not called, the server will leave this message in the message
39
38
  * queue and attempt to deliver it again in the future.
40
39
  */
41
- onIncomingMessage(envelope: Uint8Array, timestamp: number, ack: ChatServerMessageAck): void;
40
+ onIncomingMessage: (envelope: Uint8Array, timestamp: number, ack: ChatServerMessageAck) => void;
42
41
  /**
43
42
  * Called when the server indicates that there are no further messages in the message queue.
44
43
  *
45
44
  * Note that further messages may still be delivered; this merely indicates that all messages that
46
45
  * were in the queue *when the connection was established* have been delivered.
47
46
  */
48
- onQueueEmpty(): void;
47
+ onQueueEmpty: () => void;
49
48
  /**
50
49
  * Called when the server has alerts for the current device.
51
50
  *
52
51
  * In practice this happens as part of the connecting process.
53
52
  */
54
- onReceivedAlerts?(alerts: string[]): void;
53
+ onReceivedAlerts?: (alerts: string[]) => void;
55
54
  }
56
55
  /**
57
56
  * A connection to the Chat Service.
@@ -64,15 +63,15 @@ export type ChatConnection = {
64
63
  * Initiates termination of the underlying connection to the Chat Service. After the service is
65
64
  * disconnected, it cannot be used again.
66
65
  */
67
- disconnect(): Promise<void>;
66
+ disconnect: () => Promise<void>;
68
67
  /**
69
68
  * Sends request to the Chat service.
70
69
  */
71
- fetch(chatRequest: ChatRequest, options?: RequestOptions): Promise<Native.ChatResponse>;
70
+ fetch: (chatRequest: ChatRequest, options?: RequestOptions) => Promise<Native.ChatResponse>;
72
71
  /**
73
72
  * Information about the connection to the Chat service.
74
73
  */
75
- connectionInfo(): ConnectionInfo;
74
+ connectionInfo: () => ConnectionInfo;
76
75
  };
77
76
  export interface ConnectionInfo {
78
77
  localPort: number;
package/dist/net/Chat.js CHANGED
@@ -1,15 +1,12 @@
1
- "use strict";
2
1
  //
3
2
  // Copyright 2025 Signal Messenger, LLC.
4
3
  // SPDX-License-Identifier: AGPL-3.0-only
5
4
  //
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.buildHttpRequest = exports.AuthenticatedChatConnection = exports.UnauthenticatedChatConnection = exports.ChatServerMessageAck = void 0;
8
- const Native = require("../../Native");
9
- const KT = require("./KeyTransparency");
10
- const internal_1 = require("../internal");
5
+ import Native from '../../Native.js';
6
+ import * as KT from './KeyTransparency.js';
7
+ import { newNativeHandle } from '../internal.js';
11
8
  const DEFAULT_CHAT_REQUEST_TIMEOUT_MILLIS = 5000;
12
- class ChatServerMessageAck {
9
+ export class ChatServerMessageAck {
13
10
  constructor(_nativeHandle) {
14
11
  this._nativeHandle = _nativeHandle;
15
12
  }
@@ -17,7 +14,6 @@ class ChatServerMessageAck {
17
14
  Native.ServerMessageAck_SendStatus(this, statusCode);
18
15
  }
19
16
  }
20
- exports.ChatServerMessageAck = ChatServerMessageAck;
21
17
  class ConnectionInfoImpl {
22
18
  constructor(_nativeHandle) {
23
19
  this._nativeHandle = _nativeHandle;
@@ -40,12 +36,12 @@ class ConnectionInfoImpl {
40
36
  return Native.ChatConnectionInfo_description(this);
41
37
  }
42
38
  }
43
- class UnauthenticatedChatConnection {
39
+ export class UnauthenticatedChatConnection {
44
40
  static async connect(asyncContext, connectionManager, listener, env, options) {
45
41
  const nativeChatListener = makeNativeChatListener(asyncContext, listener);
46
42
  const connect = Native.UnauthenticatedChatConnection_connect(asyncContext, connectionManager, options?.languages ?? []);
47
43
  const chat = await asyncContext.makeCancellable(options?.abortSignal, connect);
48
- const connection = (0, internal_1.newNativeHandle)(chat);
44
+ const connection = newNativeHandle(chat);
49
45
  Native.UnauthenticatedChatConnection_init_listener(connection, new WeakListenerWrapper(nativeChatListener));
50
46
  return new UnauthenticatedChatConnection(asyncContext, connection, nativeChatListener, env);
51
47
  }
@@ -59,11 +55,11 @@ class UnauthenticatedChatConnection {
59
55
  */
60
56
  static fakeConnect(asyncContext, listener) {
61
57
  const nativeChatListener = makeNativeChatListener(asyncContext, listener);
62
- const fakeChat = (0, internal_1.newNativeHandle)(Native.TESTING_FakeChatConnection_Create(asyncContext, new WeakListenerWrapper(nativeChatListener), ''));
63
- const chat = (0, internal_1.newNativeHandle)(Native.TESTING_FakeChatConnection_TakeUnauthenticatedChat(fakeChat));
58
+ const fakeChat = newNativeHandle(Native.TESTING_FakeChatConnection_Create(asyncContext, new WeakListenerWrapper(nativeChatListener), ''));
59
+ const chat = newNativeHandle(Native.TESTING_FakeChatConnection_TakeUnauthenticatedChat(fakeChat));
64
60
  return [
65
61
  new UnauthenticatedChatConnection(asyncContext, chat, nativeChatListener),
66
- (0, internal_1.newNativeHandle)(Native.TESTING_FakeChatConnection_TakeRemote(fakeChat)),
62
+ newNativeHandle(Native.TESTING_FakeChatConnection_TakeRemote(fakeChat)),
67
63
  ];
68
64
  }
69
65
  constructor(
@@ -93,13 +89,12 @@ class UnauthenticatedChatConnection {
93
89
  return new KT.ClientImpl(this._asyncContext, this._chatService, this.env);
94
90
  }
95
91
  }
96
- exports.UnauthenticatedChatConnection = UnauthenticatedChatConnection;
97
- class AuthenticatedChatConnection {
92
+ export class AuthenticatedChatConnection {
98
93
  static async connect(asyncContext, connectionManager, username, password, receiveStories, listener, options) {
99
94
  const nativeChatListener = makeNativeChatListener(asyncContext, listener);
100
95
  const connect = Native.AuthenticatedChatConnection_connect(asyncContext, connectionManager, username, password, receiveStories, options?.languages ?? []);
101
96
  const chat = await asyncContext.makeCancellable(options?.abortSignal, connect);
102
- const connection = (0, internal_1.newNativeHandle)(chat);
97
+ const connection = newNativeHandle(chat);
103
98
  Native.AuthenticatedChatConnection_init_listener(connection, new WeakListenerWrapper(nativeChatListener));
104
99
  return new AuthenticatedChatConnection(asyncContext, connection, nativeChatListener);
105
100
  }
@@ -114,11 +109,11 @@ class AuthenticatedChatConnection {
114
109
  */
115
110
  static fakeConnect(asyncContext, listener, alerts) {
116
111
  const nativeChatListener = makeNativeChatListener(asyncContext, listener);
117
- const fakeChat = (0, internal_1.newNativeHandle)(Native.TESTING_FakeChatConnection_Create(asyncContext, new WeakListenerWrapper(nativeChatListener), alerts?.join('\n') ?? ''));
118
- const chat = (0, internal_1.newNativeHandle)(Native.TESTING_FakeChatConnection_TakeAuthenticatedChat(fakeChat));
112
+ const fakeChat = newNativeHandle(Native.TESTING_FakeChatConnection_Create(asyncContext, new WeakListenerWrapper(nativeChatListener), alerts?.join('\n') ?? ''));
113
+ const chat = newNativeHandle(Native.TESTING_FakeChatConnection_TakeAuthenticatedChat(fakeChat));
119
114
  return [
120
115
  new AuthenticatedChatConnection(asyncContext, chat, nativeChatListener),
121
- (0, internal_1.newNativeHandle)(Native.TESTING_FakeChatConnection_TakeRemote(fakeChat)),
116
+ newNativeHandle(Native.TESTING_FakeChatConnection_TakeRemote(fakeChat)),
122
117
  ];
123
118
  }
124
119
  constructor(asyncContext, chatService,
@@ -139,7 +134,6 @@ class AuthenticatedChatConnection {
139
134
  return new ConnectionInfoImpl(Native.AuthenticatedChatConnection_info(this.chatService));
140
135
  }
141
136
  }
142
- exports.AuthenticatedChatConnection = AuthenticatedChatConnection;
143
137
  /**
144
138
  * Holds a {@link Native.ChatListener} by {@link WeakRef} and delegates
145
139
  * `ChatListener` calls to it.
@@ -208,7 +202,7 @@ function makeNativeChatListener(asyncContext, listener) {
208
202
  },
209
203
  };
210
204
  }
211
- function buildHttpRequest(chatRequest) {
205
+ export function buildHttpRequest(chatRequest) {
212
206
  const { verb, path, body, headers } = chatRequest;
213
207
  const httpRequest = {
214
208
  _nativeHandle: Native.HttpRequest_new(verb, path, body ?? null),
@@ -219,5 +213,4 @@ function buildHttpRequest(chatRequest) {
219
213
  });
220
214
  return httpRequest;
221
215
  }
222
- exports.buildHttpRequest = buildHttpRequest;
223
216
  //# sourceMappingURL=Chat.js.map
@@ -1,7 +1,7 @@
1
- import * as Native from '../../Native';
2
- import { Aci } from '../Address';
3
- import { PublicKey } from '../EcKeys';
4
- import { Environment, type TokioAsyncContext } from '../net';
1
+ import Native from '../../Native.js';
2
+ import { Aci } from '../Address.js';
3
+ import { PublicKey } from '../EcKeys.js';
4
+ import { Environment, type TokioAsyncContext } from '../net.js';
5
5
  /**
6
6
  * Interface of a local persistent key transparency data store.
7
7
  *
@@ -9,10 +9,10 @@ import { Environment, type TokioAsyncContext } from '../net';
9
9
  * used by the {@link Client}.
10
10
  */
11
11
  export interface Store {
12
- getLastDistinguishedTreeHead(): Promise<Uint8Array | null>;
13
- setLastDistinguishedTreeHead(bytes: Readonly<Uint8Array> | null): Promise<void>;
14
- getAccountData(aci: Aci): Promise<Uint8Array | null>;
15
- setAccountData(aci: Aci, bytes: Readonly<Uint8Array>): Promise<void>;
12
+ getLastDistinguishedTreeHead: () => Promise<Uint8Array | null>;
13
+ setLastDistinguishedTreeHead: (bytes: Readonly<Uint8Array> | null) => Promise<void>;
14
+ getAccountData: (aci: Aci) => Promise<Uint8Array | null>;
15
+ setAccountData: (aci: Aci, bytes: Readonly<Uint8Array>) => Promise<void>;
16
16
  }
17
17
  /**
18
18
  * Options that are accepted by all {@link Client} APIs.
@@ -125,7 +125,7 @@ export interface Client {
125
125
  * @throws {IoError} if an error occurred while communicating with the
126
126
  * server.
127
127
  * */
128
- search(request: Request, store: Store, options?: Readonly<Options>): Promise<void>;
128
+ search: (request: Request, store: Store, options?: Readonly<Options>) => Promise<void>;
129
129
  /**
130
130
  * Perform a monitor operation for an account previously searched for.
131
131
  *
@@ -156,7 +156,7 @@ export interface Client {
156
156
  * @throws {IoError} if an error occurred while communicating with the
157
157
  * server.
158
158
  */
159
- monitor(request: MonitorRequest, store: Store, options?: Readonly<Options>): Promise<void>;
159
+ monitor: (request: MonitorRequest, store: Store, options?: Readonly<Options>) => Promise<void>;
160
160
  }
161
161
  export declare class ClientImpl implements Client {
162
162
  private readonly asyncContext;
@@ -1,11 +1,8 @@
1
- "use strict";
2
1
  //
3
2
  // Copyright 2025 Signal Messenger, LLC.
4
3
  // SPDX-License-Identifier: AGPL-3.0-only
5
4
  //
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.ClientImpl = exports.MonitorMode = void 0;
8
- const Native = require("../../Native");
5
+ import Native from '../../Native.js';
9
6
  /**
10
7
  * Mode of the monitor operation.
11
8
  *
@@ -14,12 +11,12 @@ const Native = require("../../Native");
14
11
  * account will fall back to a full search and update the locally stored
15
12
  * data.
16
13
  */
17
- var MonitorMode;
14
+ export var MonitorMode;
18
15
  (function (MonitorMode) {
19
16
  MonitorMode[MonitorMode["Self"] = 0] = "Self";
20
17
  MonitorMode[MonitorMode["Other"] = 1] = "Other";
21
- })(MonitorMode || (exports.MonitorMode = MonitorMode = {}));
22
- class ClientImpl {
18
+ })(MonitorMode || (MonitorMode = {}));
19
+ export class ClientImpl {
23
20
  constructor(asyncContext, chatService, env) {
24
21
  this.asyncContext = asyncContext;
25
22
  this.chatService = chatService;
@@ -57,5 +54,4 @@ class ClientImpl {
57
54
  (await this.updateDistinguished(store, options)));
58
55
  }
59
56
  }
60
- exports.ClientImpl = ClientImpl;
61
57
  //# sourceMappingURL=KeyTransparency.js.map
@@ -1,9 +1,9 @@
1
1
  import type { ReadonlyDeep } from 'type-fest';
2
- import * as Native from '../../Native';
3
- import { type TokioAsyncContext } from '../net';
4
- import { PublicKey } from '../EcKeys';
5
- import { Aci, Pni } from '../Address';
6
- import { SignedKyberPublicPreKey, SignedPublicPreKey } from '..';
2
+ import Native from '../../Native.js';
3
+ import { type TokioAsyncContext } from '../net.js';
4
+ import { PublicKey } from '../EcKeys.js';
5
+ import { Aci, Pni } from '../Address.js';
6
+ import { SignedKyberPublicPreKey, SignedPublicPreKey } from '../index.js';
7
7
  type ConnectionManager = Native.Wrapper<Native.ConnectionManager>;
8
8
  type RegistrationOptions = {
9
9
  tokioAsyncContext: TokioAsyncContext;
@@ -1,19 +1,16 @@
1
- "use strict";
2
1
  //
3
2
  // Copyright 2025 Signal Messenger, LLC.
4
3
  // SPDX-License-Identifier: AGPL-3.0-only
5
4
  //
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.RegisterAccountResponse = exports.AccountAttributes = exports.RegistrationService = void 0;
8
- const Native = require("../../Native");
9
- const Address_1 = require("../Address");
10
- const internal_1 = require("../internal");
5
+ import Native from '../../Native.js';
6
+ import { Aci, Pni, ServiceIdKind } from '../Address.js';
7
+ import { newNativeHandle } from '../internal.js';
11
8
  /**
12
9
  * A client for the Signal registration service.
13
10
  *
14
11
  * This wraps a {@link Net} to provide a reliable registration service client.
15
12
  */
16
- class RegistrationService {
13
+ export class RegistrationService {
17
14
  constructor(_nativeHandle, tokioAsyncContext) {
18
15
  this._nativeHandle = _nativeHandle;
19
16
  this.tokioAsyncContext = tokioAsyncContext;
@@ -34,7 +31,7 @@ class RegistrationService {
34
31
  * this property.
35
32
  */
36
33
  get sessionState() {
37
- return RegistrationService._convertNativeSessionState((0, internal_1.newNativeHandle)(Native.RegistrationService_RegistrationSession(this)));
34
+ return RegistrationService._convertNativeSessionState(newNativeHandle(Native.RegistrationService_RegistrationSession(this)));
38
35
  }
39
36
  /**
40
37
  * Resumes a previously created registration session.
@@ -132,7 +129,7 @@ class RegistrationService {
132
129
  * Internal, only public for testing
133
130
  */
134
131
  static fakeCreateSession(tokio, { e164 }) {
135
- const server = (0, internal_1.newNativeHandle)(Native.TESTING_FakeChatServer_Create());
132
+ const server = newNativeHandle(Native.TESTING_FakeChatServer_Create());
136
133
  const registration = async () => {
137
134
  const handle = await Native.TESTING_FakeRegistrationSession_CreateSession(tokio, { number: e164 }, server);
138
135
  return new RegistrationService(handle, tokio);
@@ -140,7 +137,6 @@ class RegistrationService {
140
137
  return [registration(), server];
141
138
  }
142
139
  }
143
- exports.RegistrationService = RegistrationService;
144
140
  function toBridgedPublicPreKey(key) {
145
141
  return {
146
142
  keyId: key.id(),
@@ -148,22 +144,21 @@ function toBridgedPublicPreKey(key) {
148
144
  publicKey: key.publicKey().serialize(),
149
145
  };
150
146
  }
151
- class AccountAttributes {
147
+ export class AccountAttributes {
152
148
  constructor({ recoveryPassword, aciRegistrationId, pniRegistrationId, registrationLock, unidentifiedAccessKey, unrestrictedUnidentifiedAccess, capabilities, discoverableByPhoneNumber, }) {
153
149
  const capabilitiesArray = Array.from(capabilities);
154
150
  this._nativeHandle = Native.RegistrationAccountAttributes_Create(recoveryPassword, aciRegistrationId, pniRegistrationId, registrationLock, unidentifiedAccessKey, unrestrictedUnidentifiedAccess, capabilitiesArray, discoverableByPhoneNumber);
155
151
  }
156
152
  }
157
- exports.AccountAttributes = AccountAttributes;
158
- class RegisterAccountResponse {
153
+ export class RegisterAccountResponse {
159
154
  constructor(_nativeHandle) {
160
155
  this._nativeHandle = _nativeHandle;
161
156
  }
162
157
  get aci() {
163
- return new Address_1.Aci(Native.RegisterAccountResponse_GetIdentity(this, Address_1.ServiceIdKind.Aci));
158
+ return new Aci(Native.RegisterAccountResponse_GetIdentity(this, ServiceIdKind.Aci));
164
159
  }
165
160
  get pni() {
166
- return new Address_1.Pni(Native.RegisterAccountResponse_GetIdentity(this, Address_1.ServiceIdKind.Pni));
161
+ return new Pni(Native.RegisterAccountResponse_GetIdentity(this, ServiceIdKind.Pni));
167
162
  }
168
163
  get number() {
169
164
  return Native.RegisterAccountResponse_GetNumber(this);
@@ -194,7 +189,6 @@ class RegisterAccountResponse {
194
189
  return Native.RegisterAccountResponse_GetStorageCapable(this);
195
190
  }
196
191
  }
197
- exports.RegisterAccountResponse = RegisterAccountResponse;
198
192
  class RegisterAccountRequest {
199
193
  constructor(inputs) {
200
194
  const { accountPassword, skipDeviceTransfer, aciPublicKey, pniPublicKey, aciSignedPreKey, pniSignedPreKey, aciPqLastResortPreKey, pniPqLastResortPreKey, } = inputs;
@@ -203,12 +197,12 @@ class RegisterAccountRequest {
203
197
  if (skipDeviceTransfer) {
204
198
  Native.RegisterAccountRequest_SetSkipDeviceTransfer(this);
205
199
  }
206
- Native.RegisterAccountRequest_SetIdentityPublicKey(this, Address_1.ServiceIdKind.Aci, aciPublicKey);
207
- Native.RegisterAccountRequest_SetIdentityPublicKey(this, Address_1.ServiceIdKind.Pni, pniPublicKey);
208
- Native.RegisterAccountRequest_SetIdentitySignedPreKey(this, Address_1.ServiceIdKind.Aci, toBridgedPublicPreKey(aciSignedPreKey));
209
- Native.RegisterAccountRequest_SetIdentitySignedPreKey(this, Address_1.ServiceIdKind.Pni, toBridgedPublicPreKey(pniSignedPreKey));
210
- Native.RegisterAccountRequest_SetIdentityPqLastResortPreKey(this, Address_1.ServiceIdKind.Aci, toBridgedPublicPreKey(aciPqLastResortPreKey));
211
- Native.RegisterAccountRequest_SetIdentityPqLastResortPreKey(this, Address_1.ServiceIdKind.Pni, toBridgedPublicPreKey(pniPqLastResortPreKey));
200
+ Native.RegisterAccountRequest_SetIdentityPublicKey(this, ServiceIdKind.Aci, aciPublicKey);
201
+ Native.RegisterAccountRequest_SetIdentityPublicKey(this, ServiceIdKind.Pni, pniPublicKey);
202
+ Native.RegisterAccountRequest_SetIdentitySignedPreKey(this, ServiceIdKind.Aci, toBridgedPublicPreKey(aciSignedPreKey));
203
+ Native.RegisterAccountRequest_SetIdentitySignedPreKey(this, ServiceIdKind.Pni, toBridgedPublicPreKey(pniSignedPreKey));
204
+ Native.RegisterAccountRequest_SetIdentityPqLastResortPreKey(this, ServiceIdKind.Aci, toBridgedPublicPreKey(aciPqLastResortPreKey));
205
+ Native.RegisterAccountRequest_SetIdentityPqLastResortPreKey(this, ServiceIdKind.Pni, toBridgedPublicPreKey(pniPqLastResortPreKey));
212
206
  }
213
207
  }
214
208
  //# sourceMappingURL=Registration.js.map
@@ -1,6 +1,6 @@
1
- import * as Native from '../../Native';
2
- import { TokioAsyncContext, Environment } from '../net';
3
- import { BackupKey, BackupForwardSecrecyToken } from '../AccountKeys';
1
+ import Native from '../../Native.js';
2
+ import { TokioAsyncContext, Environment } from '../net.js';
3
+ import { BackupKey, BackupForwardSecrecyToken } from '../AccountKeys.js';
4
4
  type ConnectionManager = Native.Wrapper<Native.ConnectionManager>;
5
5
  /**
6
6
  * The result of preparing a backup to be stored with forward secrecy guarantees.
package/dist/net/SvrB.js CHANGED
@@ -1,19 +1,16 @@
1
- "use strict";
2
1
  //
3
2
  // Copyright 2025 Signal Messenger, LLC.
4
3
  // SPDX-License-Identifier: AGPL-3.0-only
5
4
  //
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.SvrB = void 0;
8
- const Native = require("../../Native");
9
- const AccountKeys_1 = require("../AccountKeys");
5
+ import Native from '../../Native.js';
6
+ import { BackupForwardSecrecyToken } from '../AccountKeys.js';
10
7
  class StoreBackupResponseImpl {
11
8
  constructor(handle) {
12
9
  this._nativeHandle = handle;
13
10
  }
14
11
  get forwardSecrecyToken() {
15
12
  const tokenBytes = Native.BackupStoreResponse_GetForwardSecrecyToken(this);
16
- return new AccountKeys_1.BackupForwardSecrecyToken(tokenBytes);
13
+ return new BackupForwardSecrecyToken(tokenBytes);
17
14
  }
18
15
  get metadata() {
19
16
  return Native.BackupStoreResponse_GetOpaqueMetadata(this);
@@ -28,7 +25,7 @@ class RestoreBackupResponseImpl {
28
25
  }
29
26
  get forwardSecrecyToken() {
30
27
  const tokenBytes = Native.BackupRestoreResponse_GetForwardSecrecyToken(this);
31
- return new AccountKeys_1.BackupForwardSecrecyToken(tokenBytes);
28
+ return new BackupForwardSecrecyToken(tokenBytes);
32
29
  }
33
30
  get nextBackupSecretData() {
34
31
  return Native.BackupRestoreResponse_GetNextBackupSecretData(this);
@@ -98,7 +95,7 @@ class RestoreBackupResponseImpl {
98
95
  *
99
96
  * @see {@link BackupKey}, {@link MessageBackupKey}, {@link BackupForwardSecrecyToken}
100
97
  */
101
- class SvrB {
98
+ export class SvrB {
102
99
  constructor(asyncContext, connectionManager, auth, environment) {
103
100
  this.asyncContext = asyncContext;
104
101
  this.connectionManager = connectionManager;
@@ -213,5 +210,4 @@ class SvrB {
213
210
  await this.asyncContext.makeCancellable(options?.abortSignal, promise);
214
211
  }
215
212
  }
216
- exports.SvrB = SvrB;
217
213
  //# sourceMappingURL=SvrB.js.map
@@ -1,5 +1,5 @@
1
- import { Aci } from '../../Address';
2
- import { RequestOptions } from '../Chat';
1
+ import { Aci } from '../../Address.js';
2
+ import { RequestOptions } from '../Chat.js';
3
3
  declare module '../Chat' {
4
4
  interface UnauthenticatedChatConnection extends UnauthUsernamesService {
5
5
  }
@@ -14,7 +14,7 @@ export interface UnauthUsernamesService {
14
14
  * Throws / completes with failure only if the request can't be completed, potentially including
15
15
  * if the hash is structurally invalid.
16
16
  */
17
- lookUpUsernameHash(request: {
17
+ lookUpUsernameHash: (request: {
18
18
  hash: Uint8Array;
19
- }, options?: RequestOptions): Promise<Aci | null>;
19
+ }, options?: RequestOptions) => Promise<Aci | null>;
20
20
  }
@@ -1,14 +1,12 @@
1
- "use strict";
2
1
  //
3
2
  // Copyright 2025 Signal Messenger, LLC.
4
3
  // SPDX-License-Identifier: AGPL-3.0-only
5
4
  //
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const Native = require("../../../Native");
8
- const Address_1 = require("../../Address");
9
- const Chat_1 = require("../Chat");
10
- Chat_1.UnauthenticatedChatConnection.prototype.lookUpUsernameHash = async function ({ hash, }, options) {
5
+ import Native from '../../../Native.js';
6
+ import { Aci } from '../../Address.js';
7
+ import { UnauthenticatedChatConnection } from '../Chat.js';
8
+ UnauthenticatedChatConnection.prototype.lookUpUsernameHash = async function ({ hash, }, options) {
11
9
  const response = await this._asyncContext.makeCancellable(options?.abortSignal, Native.UnauthenticatedChatConnection_look_up_username_hash(this._asyncContext, this._chatService, Buffer.from(hash)));
12
- return response ? Address_1.Aci.fromUuidBytes(response) : null;
10
+ return response ? Aci.fromUuidBytes(response) : null;
13
11
  };
14
12
  //# sourceMappingURL=UnauthUsernamesService.js.map
package/dist/net.d.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  import type { ReadonlyDeep } from 'type-fest';
2
- import * as Native from '../Native';
3
- import { CDSRequestOptionsType, CDSResponseType } from './net/CDSI';
4
- import { ConnectionEventsListener, UnauthenticatedChatConnection, AuthenticatedChatConnection, ChatServiceListener } from './net/Chat';
5
- import { RegistrationService } from './net/Registration';
6
- import { SvrB } from './net/SvrB';
7
- export * from './net/CDSI';
8
- export * from './net/Chat';
9
- export * from './net/chat/UnauthUsernamesService';
10
- export * from './net/Registration';
11
- export * from './net/SvrB';
2
+ import Native from '../Native.js';
3
+ import { CDSRequestOptionsType, CDSResponseType } from './net/CDSI.js';
4
+ import { ConnectionEventsListener, UnauthenticatedChatConnection, AuthenticatedChatConnection, ChatServiceListener } from './net/Chat.js';
5
+ import { RegistrationService } from './net/Registration.js';
6
+ import { SvrB } from './net/SvrB.js';
7
+ export * from './net/CDSI.js';
8
+ export * from './net/Chat.js';
9
+ export * from './net/chat/UnauthUsernamesService.js';
10
+ export * from './net/Registration.js';
11
+ export * from './net/SvrB.js';
12
12
  export declare enum Environment {
13
13
  Staging = 0,
14
14
  Production = 1
@@ -210,7 +210,7 @@ export declare class Net {
210
210
  *
211
211
  * @param remoteConfig A map containing preprocessed libsignal configuration keys and their associated values.
212
212
  */
213
- setRemoteConfig(remoteConfig: Map<string, string>): void;
213
+ setRemoteConfig(remoteConfig: ReadonlyMap<string, string>): void;
214
214
  /**
215
215
  * Notifies libsignal that the network has changed.
216
216
  *