@signalapp/libsignal-client 0.54.2 → 0.55.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.
package/Native.d.ts CHANGED
@@ -29,7 +29,6 @@ interface ChatResponse {
29
29
  }
30
30
 
31
31
  interface ChatServiceDebugInfo {
32
- reconnectCount: number;
33
32
  ipType: number;
34
33
  durationMillis: number;
35
34
  connectionInfo: string;
@@ -180,7 +179,8 @@ export function Cds2ClientState_New(mrenclave: Buffer, attestationMsg: Buffer, c
180
179
  export function CdsiLookup_complete(asyncRuntime: Wrapper<TokioAsyncContext>, lookup: Wrapper<CdsiLookup>): Promise<LookupResponse>;
181
180
  export function CdsiLookup_new(asyncRuntime: Wrapper<TokioAsyncContext>, connectionManager: Wrapper<ConnectionManager>, username: string, password: string, request: Wrapper<LookupRequest>): Promise<CdsiLookup>;
182
181
  export function CdsiLookup_token(lookup: Wrapper<CdsiLookup>): Buffer;
183
- export function ChatServer_SetListener(runtime: Wrapper<TokioAsyncContext>, chat: Wrapper<Chat>, makeListener: MakeChatListener | null): void;
182
+ export function ChatService_SetListenerAuth(runtime: Wrapper<TokioAsyncContext>, chat: Wrapper<Chat>, makeListener: MakeChatListener | null): void;
183
+ export function ChatService_SetListenerUnauth(runtime: Wrapper<TokioAsyncContext>, chat: Wrapper<Chat>, makeListener: MakeChatListener | null): void;
184
184
  export function ChatService_auth_send(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<Chat>, httpRequest: Wrapper<HttpRequest>, timeoutMillis: number): Promise<ChatResponse>;
185
185
  export function ChatService_auth_send_and_debug(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<Chat>, httpRequest: Wrapper<HttpRequest>, timeoutMillis: number): Promise<ResponseAndDebugInfo>;
186
186
  export function ChatService_connect_auth(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<Chat>): Promise<ChatServiceDebugInfo>;
@@ -669,7 +669,7 @@ For more information on this, and how to apply and follow the GNU AGPL, see
669
669
 
670
670
  ```
671
671
 
672
- ## attest 0.1.0, libsignal-ffi 0.54.2, libsignal-jni 0.54.2, libsignal-jni-testing 0.54.2, libsignal-node 0.54.2, signal-neon-futures 0.1.0, signal-neon-futures-tests 0.1.0, libsignal-bridge 0.1.0, libsignal-bridge-macros 0.1.0, libsignal-bridge-testing 0.1.0, libsignal-bridge-types 0.1.0, libsignal-core 0.1.0, signal-crypto 0.1.0, device-transfer 0.1.0, signal-media 0.1.0, libsignal-message-backup 0.1.0, libsignal-message-backup-macros 0.1.0, libsignal-net 0.1.0, signal-pin 0.1.0, poksho 0.7.0, libsignal-protocol 0.1.0, libsignal-svr3 0.1.0, usernames 0.1.0, zkcredential 0.1.0, zkgroup 0.9.0
672
+ ## attest 0.1.0, libsignal-ffi 0.55.0, libsignal-jni 0.55.0, libsignal-jni-testing 0.55.0, libsignal-node 0.55.0, signal-neon-futures 0.1.0, signal-neon-futures-tests 0.1.0, libsignal-bridge 0.1.0, libsignal-bridge-macros 0.1.0, libsignal-bridge-testing 0.1.0, libsignal-bridge-types 0.1.0, libsignal-core 0.1.0, signal-crypto 0.1.0, device-transfer 0.1.0, signal-media 0.1.0, libsignal-message-backup 0.1.0, libsignal-message-backup-macros 0.1.0, libsignal-net 0.1.0, signal-pin 0.1.0, poksho 0.7.0, libsignal-protocol 0.1.0, libsignal-svr3 0.1.0, usernames 0.1.0, zkcredential 0.1.0, zkgroup 0.9.0
673
673
 
674
674
  ```
675
675
  GNU AFFERO GENERAL PUBLIC LICENSE
package/dist/net.d.ts CHANGED
@@ -51,7 +51,16 @@ export declare class ChatServerMessageAck {
51
51
  constructor(asyncContext: TokioAsyncContext, _nativeHandle: Native.ServerMessageAck);
52
52
  send(statusCode: number): Promise<void>;
53
53
  }
54
- export interface ChatServiceListener {
54
+ export interface ConnectionEventsListener {
55
+ /**
56
+ * Called when the client gets disconnected from the server.
57
+ *
58
+ * This includes both deliberate disconnects as well as unexpected socket closures that will be
59
+ * automatically retried.
60
+ */
61
+ onConnectionInterrupted(): void;
62
+ }
63
+ export interface ChatServiceListener extends ConnectionEventsListener {
55
64
  /**
56
65
  * Called when the server delivers an incoming message to the client.
57
66
  *
@@ -68,16 +77,6 @@ export interface ChatServiceListener {
68
77
  * were in the queue *when the connection was established* have been delivered.
69
78
  */
70
79
  onQueueEmpty(): void;
71
- /**
72
- * Called when the client gets disconnected from the server.
73
- *
74
- * This includes both deliberate disconnects as well as unexpected socket closures that will be
75
- * automatically retried.
76
- *
77
- * Will not be called if no other requests have been invoked for this connection attempt. That is,
78
- * you should never see this as the first callback, nor two of these callbacks in a row.
79
- */
80
- onConnectionInterrupted(): void;
81
80
  }
82
81
  /**
83
82
  * Provides API methods to connect and communicate with the Chat Service.
@@ -155,7 +154,7 @@ export declare class AuthenticatedChatService implements ChatService {
155
154
  export declare class UnauthenticatedChatService implements ChatService {
156
155
  private readonly asyncContext;
157
156
  readonly chatService: Wrapper<Native.Chat>;
158
- constructor(asyncContext: TokioAsyncContext, connectionManager: ConnectionManager);
157
+ constructor(asyncContext: TokioAsyncContext, connectionManager: ConnectionManager, listener: ConnectionEventsListener);
159
158
  disconnect(): Promise<void>;
160
159
  connect(options?: {
161
160
  abortSignal?: AbortSignal;
@@ -188,7 +187,7 @@ export declare class Net {
188
187
  /**
189
188
  * Creates a new instance of {@link UnauthenticatedChatService}.
190
189
  */
191
- newUnauthenticatedChatService(): UnauthenticatedChatService;
190
+ newUnauthenticatedChatService(listener: ConnectionEventsListener): UnauthenticatedChatService;
192
191
  /**
193
192
  * Enables/disables IPv6 for all new connections (until changed).
194
193
  *
package/dist/net.js CHANGED
@@ -77,7 +77,7 @@ class AuthenticatedChatService {
77
77
  listener.onConnectionInterrupted();
78
78
  },
79
79
  };
80
- Native.ChatServer_SetListener(asyncContext, this.chatService, nativeChatListener);
80
+ Native.ChatService_SetListenerAuth(asyncContext, this.chatService, nativeChatListener);
81
81
  }
82
82
  disconnect() {
83
83
  return Native.ChatService_disconnect(this.asyncContext, this.chatService);
@@ -97,9 +97,21 @@ exports.AuthenticatedChatService = AuthenticatedChatService;
97
97
  * Provides API methods to connect and communicate with the Chat Service over an unauthenticated channel.
98
98
  */
99
99
  class UnauthenticatedChatService {
100
- constructor(asyncContext, connectionManager) {
100
+ constructor(asyncContext, connectionManager, listener) {
101
101
  this.asyncContext = asyncContext;
102
102
  this.chatService = newNativeHandle(Native.ChatService_new(connectionManager, '', '', false));
103
+ const nativeChatListener = {
104
+ _incoming_message(_envelope, _timestamp, _ack) {
105
+ throw new Error('Event not supported on unauthenticated connection');
106
+ },
107
+ _queue_empty() {
108
+ throw new Error('Event not supported on unauthenticated connection');
109
+ },
110
+ _connection_interrupted() {
111
+ listener.onConnectionInterrupted();
112
+ },
113
+ };
114
+ Native.ChatService_SetListenerUnauth(asyncContext, this.chatService, nativeChatListener);
103
115
  }
104
116
  disconnect() {
105
117
  return Native.ChatService_disconnect(this.asyncContext, this.chatService);
@@ -148,8 +160,8 @@ class Net {
148
160
  /**
149
161
  * Creates a new instance of {@link UnauthenticatedChatService}.
150
162
  */
151
- newUnauthenticatedChatService() {
152
- return new UnauthenticatedChatService(this.asyncContext, this.connectionManager);
163
+ newUnauthenticatedChatService(listener) {
164
+ return new UnauthenticatedChatService(this.asyncContext, this.connectionManager, listener);
153
165
  }
154
166
  /**
155
167
  * Enables/disables IPv6 for all new connections (until changed).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalapp/libsignal-client",
3
- "version": "0.54.2",
3
+ "version": "0.55.0",
4
4
  "license": "AGPL-3.0-only",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",