@signalapp/libsignal-client 0.71.1 → 0.72.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.
@@ -7119,7 +7119,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
7119
7119
 
7120
7120
  ```
7121
7121
 
7122
- ## tokio-stream 0.1.17, tokio-util 0.7.14, tokio 1.44.2
7122
+ ## tokio-stream 0.1.17, tokio-util 0.7.14, tokio 1.45.0
7123
7123
 
7124
7124
  ```
7125
7125
  MIT License
@@ -4,3 +4,4 @@ export declare class BridgedStringMap {
4
4
  constructor(input: Map<string, string>);
5
5
  dump(): string;
6
6
  }
7
+ export declare function newNativeHandle<T>(handle: T): Native.Wrapper<T>;
package/dist/internal.js CHANGED
@@ -4,7 +4,7 @@
4
4
  // SPDX-License-Identifier: AGPL-3.0-only
5
5
  //
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.BridgedStringMap = void 0;
7
+ exports.newNativeHandle = exports.BridgedStringMap = void 0;
8
8
  const Native = require("../Native");
9
9
  class BridgedStringMap {
10
10
  constructor(input) {
@@ -18,4 +18,10 @@ class BridgedStringMap {
18
18
  }
19
19
  }
20
20
  exports.BridgedStringMap = BridgedStringMap;
21
+ function newNativeHandle(handle) {
22
+ return {
23
+ _nativeHandle: handle,
24
+ };
25
+ }
26
+ exports.newNativeHandle = newNativeHandle;
21
27
  //# sourceMappingURL=internal.js.map
package/dist/net/CDSI.js CHANGED
@@ -8,9 +8,9 @@ exports.cdsiLookup = void 0;
8
8
  const Native = require("../../Native");
9
9
  const Address_1 = require("../Address");
10
10
  const node_buffer_1 = require("node:buffer");
11
- const net_1 = require("../net");
11
+ const internal_1 = require("../internal");
12
12
  async function cdsiLookup({ asyncContext, connectionManager, }, { username, password }, { e164s, acisAndAccessKeys, abortSignal }) {
13
- const request = (0, net_1.newNativeHandle)(Native.LookupRequest_new());
13
+ const request = (0, internal_1.newNativeHandle)(Native.LookupRequest_new());
14
14
  e164s.forEach((e164) => {
15
15
  Native.LookupRequest_addE164(request, e164);
16
16
  });
@@ -18,7 +18,7 @@ async function cdsiLookup({ asyncContext, connectionManager, }, { username, pass
18
18
  Native.LookupRequest_addAciAndAccessKey(request, Address_1.Aci.parseFromServiceIdString(aciStr).getServiceIdFixedWidthBinary(), node_buffer_1.Buffer.from(accessKeyStr, 'base64'));
19
19
  });
20
20
  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, net_1.newNativeHandle)(lookup)));
21
+ return await asyncContext.makeCancellable(abortSignal, Native.CdsiLookup_complete(asyncContext, (0, internal_1.newNativeHandle)(lookup)));
22
22
  }
23
23
  exports.cdsiLookup = cdsiLookup;
24
24
  //# sourceMappingURL=CDSI.js.map
package/dist/net/Chat.js CHANGED
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.buildHttpRequest = exports.AuthenticatedChatConnection = exports.UnauthenticatedChatConnection = exports.ChatServerMessageAck = void 0;
8
8
  const Native = require("../../Native");
9
9
  const node_buffer_1 = require("node:buffer");
10
- const net_1 = require("../net");
11
10
  const KT = require("./KeyTransparency");
11
+ const internal_1 = require("../internal");
12
12
  const DEFAULT_CHAT_REQUEST_TIMEOUT_MILLIS = 5000;
13
13
  class ChatServerMessageAck {
14
14
  constructor(_nativeHandle) {
@@ -46,7 +46,7 @@ class UnauthenticatedChatConnection {
46
46
  const nativeChatListener = makeNativeChatListener(asyncContext, listener);
47
47
  const connect = Native.UnauthenticatedChatConnection_connect(asyncContext, connectionManager);
48
48
  const chat = await asyncContext.makeCancellable(options?.abortSignal, connect);
49
- const connection = (0, net_1.newNativeHandle)(chat);
49
+ const connection = (0, internal_1.newNativeHandle)(chat);
50
50
  Native.UnauthenticatedChatConnection_init_listener(connection, new WeakListenerWrapper(nativeChatListener));
51
51
  return new UnauthenticatedChatConnection(asyncContext, connection, nativeChatListener, env);
52
52
  }
@@ -60,11 +60,11 @@ class UnauthenticatedChatConnection {
60
60
  */
61
61
  static fakeConnect(asyncContext, listener) {
62
62
  const nativeChatListener = makeNativeChatListener(asyncContext, listener);
63
- const fakeChat = (0, net_1.newNativeHandle)(Native.TESTING_FakeChatConnection_Create(asyncContext, new WeakListenerWrapper(nativeChatListener), ''));
64
- const chat = (0, net_1.newNativeHandle)(Native.TESTING_FakeChatConnection_TakeUnauthenticatedChat(fakeChat));
63
+ const fakeChat = (0, internal_1.newNativeHandle)(Native.TESTING_FakeChatConnection_Create(asyncContext, new WeakListenerWrapper(nativeChatListener), ''));
64
+ const chat = (0, internal_1.newNativeHandle)(Native.TESTING_FakeChatConnection_TakeUnauthenticatedChat(fakeChat));
65
65
  return [
66
66
  new UnauthenticatedChatConnection(asyncContext, chat, nativeChatListener),
67
- (0, net_1.newNativeHandle)(Native.TESTING_FakeChatConnection_TakeRemote(fakeChat)),
67
+ (0, internal_1.newNativeHandle)(Native.TESTING_FakeChatConnection_TakeRemote(fakeChat)),
68
68
  ];
69
69
  }
70
70
  constructor(asyncContext, chatService,
@@ -98,7 +98,7 @@ class AuthenticatedChatConnection {
98
98
  const nativeChatListener = makeNativeChatListener(asyncContext, listener);
99
99
  const connect = Native.AuthenticatedChatConnection_connect(asyncContext, connectionManager, username, password, receiveStories);
100
100
  const chat = await asyncContext.makeCancellable(options?.abortSignal, connect);
101
- const connection = (0, net_1.newNativeHandle)(chat);
101
+ const connection = (0, internal_1.newNativeHandle)(chat);
102
102
  Native.AuthenticatedChatConnection_init_listener(connection, new WeakListenerWrapper(nativeChatListener));
103
103
  return new AuthenticatedChatConnection(asyncContext, connection, nativeChatListener);
104
104
  }
@@ -113,11 +113,11 @@ class AuthenticatedChatConnection {
113
113
  */
114
114
  static fakeConnect(asyncContext, listener, alerts) {
115
115
  const nativeChatListener = makeNativeChatListener(asyncContext, listener);
116
- const fakeChat = (0, net_1.newNativeHandle)(Native.TESTING_FakeChatConnection_Create(asyncContext, new WeakListenerWrapper(nativeChatListener), alerts?.join('\n') ?? ''));
117
- const chat = (0, net_1.newNativeHandle)(Native.TESTING_FakeChatConnection_TakeAuthenticatedChat(fakeChat));
116
+ const fakeChat = (0, internal_1.newNativeHandle)(Native.TESTING_FakeChatConnection_Create(asyncContext, new WeakListenerWrapper(nativeChatListener), alerts?.join('\n') ?? ''));
117
+ const chat = (0, internal_1.newNativeHandle)(Native.TESTING_FakeChatConnection_TakeAuthenticatedChat(fakeChat));
118
118
  return [
119
119
  new AuthenticatedChatConnection(asyncContext, chat, nativeChatListener),
120
- (0, net_1.newNativeHandle)(Native.TESTING_FakeChatConnection_TakeRemote(fakeChat)),
120
+ (0, internal_1.newNativeHandle)(Native.TESTING_FakeChatConnection_TakeRemote(fakeChat)),
121
121
  ];
122
122
  }
123
123
  constructor(asyncContext, chatService,
@@ -6,7 +6,7 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.ClientImpl = void 0;
8
8
  const Native = require("../../Native");
9
- const net_1 = require("../net");
9
+ const internal_1 = require("../internal");
10
10
  class ClientImpl {
11
11
  constructor(asyncContext, chatService, env) {
12
12
  this.asyncContext = asyncContext;
@@ -22,7 +22,7 @@ class ClientImpl {
22
22
  unidentifiedAccessKey: null,
23
23
  };
24
24
  const searchResultHandle = await this.asyncContext.makeCancellable(abortSignal, Native.KeyTransparency_Search(this.asyncContext, this.env, this.chatService, aci.getServiceIdFixedWidthBinary(), aciIdentityKey, e164, unidentifiedAccessKey, usernameHash ?? null, await store.getAccountData(aci), distinguished));
25
- const accountData = Native.SearchResult_GetAccountData((0, net_1.newNativeHandle)(searchResultHandle));
25
+ const accountData = Native.SearchResult_GetAccountData((0, internal_1.newNativeHandle)(searchResultHandle));
26
26
  await store.setAccountData(aci, accountData);
27
27
  }
28
28
  async monitor(request, store, options) {
@@ -6,8 +6,8 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.RegisterAccountResponse = exports.AccountAttributes = exports.RegistrationService = void 0;
8
8
  const Native = require("../../Native");
9
- const net_1 = require("../net");
10
9
  const Address_1 = require("../Address");
10
+ const internal_1 = require("../internal");
11
11
  /**
12
12
  * A client for the Signal registration service.
13
13
  *
@@ -34,7 +34,7 @@ class RegistrationService {
34
34
  * this property.
35
35
  */
36
36
  get sessionState() {
37
- return RegistrationService._convertNativeSessionState((0, net_1.newNativeHandle)(Native.RegistrationService_RegistrationSession(this)));
37
+ return RegistrationService._convertNativeSessionState((0, internal_1.newNativeHandle)(Native.RegistrationService_RegistrationSession(this)));
38
38
  }
39
39
  /**
40
40
  * Resumes a previously created registration session.
@@ -88,7 +88,7 @@ class RegistrationService {
88
88
  }
89
89
  async registerAccount(inputs) {
90
90
  const { accountPassword, skipDeviceTransfer = false, accountAttributes, aciPublicKey, pniPublicKey, aciSignedPreKey, pniSignedPreKey, aciPqLastResortPreKey, pniPqLastResortPreKey, } = inputs;
91
- const args = (0, net_1.newNativeHandle)(Native.RegisterAccountRequest_Create());
91
+ const args = (0, internal_1.newNativeHandle)(Native.RegisterAccountRequest_Create());
92
92
  Native.RegisterAccountRequest_SetAccountPassword(args, accountPassword);
93
93
  if (skipDeviceTransfer) {
94
94
  Native.RegisterAccountRequest_SetSkipDeviceTransfer(args);
@@ -128,7 +128,7 @@ class RegistrationService {
128
128
  * Internal, only public for testing
129
129
  */
130
130
  static fakeCreateSession(tokio, { e164 }) {
131
- const server = (0, net_1.newNativeHandle)(Native.TESTING_FakeChatServer_Create());
131
+ const server = (0, internal_1.newNativeHandle)(Native.TESTING_FakeChatServer_Create());
132
132
  const registration = async () => {
133
133
  const handle = await Native.TESTING_FakeRegistrationSession_CreateSession(tokio, { number: e164 }, server);
134
134
  return new RegistrationService(handle, tokio);
package/dist/net.d.ts CHANGED
@@ -24,7 +24,6 @@ export type ChatRequest = Readonly<{
24
24
  timeoutMillis?: number;
25
25
  }>;
26
26
  type ConnectionManager = Native.Wrapper<Native.ConnectionManager>;
27
- export declare function newNativeHandle<T>(handle: T): Native.Wrapper<T>;
28
27
  /** Low-level async runtime control, mostly just exported for testing. */
29
28
  export declare class TokioAsyncContext {
30
29
  readonly _nativeHandle: Native.TokioAsyncContext;
package/dist/net.js CHANGED
@@ -18,7 +18,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
18
18
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.Net = exports.SIGNAL_TLS_PROXY_SCHEME = exports.TokioAsyncContext = exports.newNativeHandle = exports.Environment = void 0;
21
+ exports.Net = exports.SIGNAL_TLS_PROXY_SCHEME = exports.TokioAsyncContext = exports.Environment = void 0;
22
22
  const Native = require("../Native");
23
23
  const CDSI_1 = require("./net/CDSI");
24
24
  const Chat_1 = require("./net/Chat");
@@ -33,12 +33,6 @@ var Environment;
33
33
  Environment[Environment["Staging"] = 0] = "Staging";
34
34
  Environment[Environment["Production"] = 1] = "Production";
35
35
  })(Environment || (exports.Environment = Environment = {}));
36
- function newNativeHandle(handle) {
37
- return {
38
- _nativeHandle: handle,
39
- };
40
- }
41
- exports.newNativeHandle = newNativeHandle;
42
36
  /** Low-level async runtime control, mostly just exported for testing. */
43
37
  class TokioAsyncContext {
44
38
  constructor(handle) {
@@ -68,10 +62,10 @@ class Net {
68
62
  this.options = options;
69
63
  this.asyncContext = new TokioAsyncContext(Native.TokioAsyncContext_new());
70
64
  if (options.localTestServer) {
71
- this._connectionManager = newNativeHandle(Native.TESTING_ConnectionManager_newLocalOverride(options.userAgent, options.TESTING_localServer_chatPort, options.TESTING_localServer_cdsiPort, options.TESTING_localServer_svr2Port, options.TESTING_localServer_rootCertificateDer));
65
+ this._connectionManager = (0, internal_1.newNativeHandle)(Native.TESTING_ConnectionManager_newLocalOverride(options.userAgent, options.TESTING_localServer_chatPort, options.TESTING_localServer_cdsiPort, options.TESTING_localServer_svr2Port, options.TESTING_localServer_rootCertificateDer));
72
66
  }
73
67
  else {
74
- this._connectionManager = newNativeHandle(Native.ConnectionManager_new(options.env, options.userAgent, new internal_1.BridgedStringMap(options.remoteConfig || new Map())));
68
+ this._connectionManager = (0, internal_1.newNativeHandle)(Native.ConnectionManager_new(options.env, options.userAgent, new internal_1.BridgedStringMap(options.remoteConfig || new Map())));
75
69
  }
76
70
  }
77
71
  /**
@@ -157,7 +151,7 @@ class Net {
157
151
  }
158
152
  const { scheme, host, port, username, password } = hostOrOptions;
159
153
  try {
160
- const proxyConfig = newNativeHandle(Native.ConnectionProxyConfig_new(scheme, host,
154
+ const proxyConfig = (0, internal_1.newNativeHandle)(Native.ConnectionProxyConfig_new(scheme, host,
161
155
  // i32::MIN represents "no port provided"; we don't expect anyone to pass that manually.
162
156
  port ?? -2147483648, username ?? null, password ?? null));
163
157
  Native.ConnectionManager_set_proxy(this._connectionManager, proxyConfig);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalapp/libsignal-client",
3
- "version": "0.71.1",
3
+ "version": "0.72.0",
4
4
  "license": "AGPL-3.0-only",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",