@signalapp/libsignal-client 0.65.6 → 0.66.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/Native.d.ts +6 -20
- package/dist/acknowledgments.md +1 -1
- package/dist/net.d.ts +1 -103
- package/dist/net.js +2 -77
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/@signalapp+libsignal-client.node +0 -0
- package/prebuilds/darwin-x64/@signalapp+libsignal-client.node +0 -0
- package/prebuilds/linux-arm64/@signalapp+libsignal-client.node +0 -0
- package/prebuilds/linux-x64/@signalapp+libsignal-client.node +0 -0
- package/prebuilds/win32-arm64/@signalapp+libsignal-client.node +0 -0
- package/prebuilds/win32-x64/@signalapp+libsignal-client.node +0 -0
package/Native.d.ts
CHANGED
|
@@ -211,18 +211,6 @@ export function CdsiLookup_token(lookup: Wrapper<CdsiLookup>): Buffer;
|
|
|
211
211
|
export function ChatConnectionInfo_description(connectionInfo: Wrapper<ChatConnectionInfo>): string;
|
|
212
212
|
export function ChatConnectionInfo_ip_version(connectionInfo: Wrapper<ChatConnectionInfo>): number;
|
|
213
213
|
export function ChatConnectionInfo_local_port(connectionInfo: Wrapper<ChatConnectionInfo>): number;
|
|
214
|
-
export function ChatService_SetListenerAuth(runtime: Wrapper<TokioAsyncContext>, chat: Wrapper<AuthChat>, listener: ChatListener | null): void;
|
|
215
|
-
export function ChatService_SetListenerUnauth(runtime: Wrapper<TokioAsyncContext>, chat: Wrapper<UnauthChat>, listener: ChatListener | null): void;
|
|
216
|
-
export function ChatService_auth_send(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<AuthChat>, httpRequest: Wrapper<HttpRequest>, timeoutMillis: number): CancellablePromise<ChatResponse>;
|
|
217
|
-
export function ChatService_auth_send_and_debug(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<AuthChat>, httpRequest: Wrapper<HttpRequest>, timeoutMillis: number): CancellablePromise<ResponseAndDebugInfo>;
|
|
218
|
-
export function ChatService_connect_auth(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<AuthChat>): CancellablePromise<ChatServiceDebugInfo>;
|
|
219
|
-
export function ChatService_connect_unauth(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<UnauthChat>): CancellablePromise<ChatServiceDebugInfo>;
|
|
220
|
-
export function ChatService_disconnect_auth(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<AuthChat>): CancellablePromise<void>;
|
|
221
|
-
export function ChatService_disconnect_unauth(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<UnauthChat>): CancellablePromise<void>;
|
|
222
|
-
export function ChatService_new_auth(connectionManager: Wrapper<ConnectionManager>, username: string, password: string, receiveStories: boolean): AuthChat;
|
|
223
|
-
export function ChatService_new_unauth(connectionManager: Wrapper<ConnectionManager>): UnauthChat;
|
|
224
|
-
export function ChatService_unauth_send(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<UnauthChat>, httpRequest: Wrapper<HttpRequest>, timeoutMillis: number): CancellablePromise<ChatResponse>;
|
|
225
|
-
export function ChatService_unauth_send_and_debug(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<UnauthChat>, httpRequest: Wrapper<HttpRequest>, timeoutMillis: number): CancellablePromise<ResponseAndDebugInfo>;
|
|
226
214
|
export function CiphertextMessage_FromPlaintextContent(m: Wrapper<PlaintextContent>): CiphertextMessage;
|
|
227
215
|
export function CiphertextMessage_Serialize(obj: Wrapper<CiphertextMessage>): Buffer;
|
|
228
216
|
export function CiphertextMessage_Type(msg: Wrapper<CiphertextMessage>): number;
|
|
@@ -532,13 +520,8 @@ export function TESTING_ChatRequestGetBody(request: Wrapper<HttpRequest>): Buffe
|
|
|
532
520
|
export function TESTING_ChatRequestGetHeaderValue(request: Wrapper<HttpRequest>, headerName: string): string;
|
|
533
521
|
export function TESTING_ChatRequestGetMethod(request: Wrapper<HttpRequest>): string;
|
|
534
522
|
export function TESTING_ChatRequestGetPath(request: Wrapper<HttpRequest>): string;
|
|
535
|
-
export function
|
|
523
|
+
export function TESTING_ChatResponseConvert(bodyPresent: boolean): ChatResponse;
|
|
536
524
|
export function TESTING_ChatServiceErrorConvert(errorDescription: string): void;
|
|
537
|
-
export function TESTING_ChatServiceResponseAndDebugInfoConvert(): ResponseAndDebugInfo;
|
|
538
|
-
export function TESTING_ChatServiceResponseConvert(bodyPresent: boolean): ChatResponse;
|
|
539
|
-
export function TESTING_ChatService_InjectConnectionInterrupted(chat: Wrapper<AuthChat>): void;
|
|
540
|
-
export function TESTING_ChatService_InjectIntentionalDisconnect(chat: Wrapper<AuthChat>): void;
|
|
541
|
-
export function TESTING_ChatService_InjectRawServerRequest(chat: Wrapper<AuthChat>, bytes: Buffer): void;
|
|
542
525
|
export function TESTING_ConnectionManager_isUsingProxy(manager: Wrapper<ConnectionManager>): number;
|
|
543
526
|
export function TESTING_ConnectionManager_newLocalOverride(userAgent: string, chatPort: number, cdsiPort: number, svr2Port: number, svr3SgxPort: number, svr3NitroPort: number, svr3Tpm2SnpPort: number, rootCertificateDer: Buffer): ConnectionManager;
|
|
544
527
|
export function TESTING_ErrorOnBorrowAsync(_input: null): Promise<void>;
|
|
@@ -551,7 +534,11 @@ export function TESTING_FakeChatConnection_Create(tokio: Wrapper<TokioAsyncConte
|
|
|
551
534
|
export function TESTING_FakeChatConnection_TakeAuthenticatedChat(chat: Wrapper<FakeChatConnection>): AuthenticatedChatConnection;
|
|
552
535
|
export function TESTING_FakeChatConnection_TakeRemote(chat: Wrapper<FakeChatConnection>): FakeChatRemoteEnd;
|
|
553
536
|
export function TESTING_FakeChatRemoteEnd_InjectConnectionInterrupted(chat: Wrapper<FakeChatRemoteEnd>): void;
|
|
537
|
+
export function TESTING_FakeChatRemoteEnd_ReceiveIncomingRequest(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<FakeChatRemoteEnd>): CancellablePromise<FakeChatSentRequest | null>;
|
|
554
538
|
export function TESTING_FakeChatRemoteEnd_SendRawServerRequest(chat: Wrapper<FakeChatRemoteEnd>, bytes: Buffer): void;
|
|
539
|
+
export function TESTING_FakeChatRemoteEnd_SendRawServerResponse(chat: Wrapper<FakeChatRemoteEnd>, bytes: Buffer): void;
|
|
540
|
+
export function TESTING_FakeChatSentRequest_RequestId(request: Wrapper<FakeChatSentRequest>): bigint;
|
|
541
|
+
export function TESTING_FakeChatSentRequest_TakeHttpRequest(request: Wrapper<FakeChatSentRequest>): HttpRequest;
|
|
555
542
|
export function TESTING_FutureFailure(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _input: number): CancellablePromise<number>;
|
|
556
543
|
export function TESTING_FutureProducesOtherPointerType(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, input: string): CancellablePromise<OtherTestingHandleType>;
|
|
557
544
|
export function TESTING_FutureProducesPointerType(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, input: number): CancellablePromise<TestingHandleType>;
|
|
@@ -611,7 +598,6 @@ export function WebpSanitizer_Sanitize(input: SyncInputStream): void;
|
|
|
611
598
|
export function initLogger(maxLevel: LogLevel, callback: (level: LogLevel, target: string, file: string | null, line: number | null, message: string) => void): void
|
|
612
599
|
export function test_only_fn_returns_123(): number;
|
|
613
600
|
interface Aes256GcmSiv { readonly __type: unique symbol; }
|
|
614
|
-
interface AuthChat { readonly __type: unique symbol; }
|
|
615
601
|
interface AuthenticatedChatConnection { readonly __type: unique symbol; }
|
|
616
602
|
interface CdsiLookup { readonly __type: unique symbol; }
|
|
617
603
|
interface ChatConnectionInfo { readonly __type: unique symbol; }
|
|
@@ -625,6 +611,7 @@ interface ExpiringProfileKeyCredential { readonly __type: unique symbol; }
|
|
|
625
611
|
interface ExpiringProfileKeyCredentialResponse { readonly __type: unique symbol; }
|
|
626
612
|
interface FakeChatConnection { readonly __type: unique symbol; }
|
|
627
613
|
interface FakeChatRemoteEnd { readonly __type: unique symbol; }
|
|
614
|
+
interface FakeChatSentRequest { readonly __type: unique symbol; }
|
|
628
615
|
interface Fingerprint { readonly __type: unique symbol; }
|
|
629
616
|
interface GroupMasterKey { readonly __type: unique symbol; }
|
|
630
617
|
interface GroupPublicParams { readonly __type: unique symbol; }
|
|
@@ -674,7 +661,6 @@ interface SignalMessage { readonly __type: unique symbol; }
|
|
|
674
661
|
interface SignedPreKeyRecord { readonly __type: unique symbol; }
|
|
675
662
|
interface TestingHandleType { readonly __type: unique symbol; }
|
|
676
663
|
interface TokioAsyncContext { readonly __type: unique symbol; }
|
|
677
|
-
interface UnauthChat { readonly __type: unique symbol; }
|
|
678
664
|
interface UnauthenticatedChatConnection { readonly __type: unique symbol; }
|
|
679
665
|
interface UnidentifiedSenderMessageContent { readonly __type: unique symbol; }
|
|
680
666
|
interface UuidCiphertext { readonly __type: unique symbol; }
|
package/dist/acknowledgments.md
CHANGED
|
@@ -2685,7 +2685,7 @@ third-party/chromium/LICENSE.
|
|
|
2685
2685
|
|
|
2686
2686
|
```
|
|
2687
2687
|
|
|
2688
|
-
## windows-core 0.52.0, windows-sys 0.45.0, windows-sys 0.52.0, windows-sys 0.59.0, windows-targets 0.42.2, windows-targets 0.52.6, windows_aarch64_msvc 0.42.2, windows_aarch64_msvc 0.52.6, windows_x86_64_gnu 0.52.6, windows_x86_64_msvc 0.42.2, windows_x86_64_msvc 0.52.6
|
|
2688
|
+
## windows-core 0.52.0, windows-sys 0.45.0, windows-sys 0.52.0, windows-sys 0.59.0, windows-targets 0.42.2, windows-targets 0.48.5, windows-targets 0.52.6, windows_aarch64_msvc 0.42.2, windows_aarch64_msvc 0.48.5, windows_aarch64_msvc 0.52.6, windows_x86_64_gnu 0.48.5, windows_x86_64_gnu 0.52.6, windows_x86_64_msvc 0.42.2, windows_x86_64_msvc 0.48.5, windows_x86_64_msvc 0.52.6
|
|
2689
2689
|
|
|
2690
2690
|
```
|
|
2691
2691
|
MIT License
|
package/dist/net.d.ts
CHANGED
|
@@ -83,59 +83,6 @@ export interface ChatServiceListener extends ConnectionEventsListener {
|
|
|
83
83
|
*/
|
|
84
84
|
onQueueEmpty(): void;
|
|
85
85
|
}
|
|
86
|
-
/**
|
|
87
|
-
* Provides API methods to connect and communicate with the Chat Service.
|
|
88
|
-
* Before sending/receiving requests, a {@link #connect()} method must be called.
|
|
89
|
-
* It's also important to call {@link #disconnect()} method when the instance is no longer needed.
|
|
90
|
-
*/
|
|
91
|
-
export type ChatService = {
|
|
92
|
-
/**
|
|
93
|
-
* Initiates establishing of the underlying connection to the Chat Service. Once the
|
|
94
|
-
* service is connected, all the requests will be using the established connection. Also, if the
|
|
95
|
-
* connection is lost for any reason other than the call to {@link #disconnect()}, an automatic
|
|
96
|
-
* reconnect attempt will be made.
|
|
97
|
-
*
|
|
98
|
-
* Calling this method will result in starting to accept incoming requests from the Chat Service.
|
|
99
|
-
*
|
|
100
|
-
* @throws {AppExpiredError} if the current app version is too old (as judged by the server).
|
|
101
|
-
* @throws {DeviceDelinkedError} if the current device has been delinked.
|
|
102
|
-
* @throws {RateLimitedError} if the device should wait, then retry.
|
|
103
|
-
* @throws {LibSignalError} with other codes for other failures.
|
|
104
|
-
*/
|
|
105
|
-
connect(options?: {
|
|
106
|
-
abortSignal?: AbortSignal;
|
|
107
|
-
}): Promise<Native.ChatServiceDebugInfo>;
|
|
108
|
-
/**
|
|
109
|
-
* Initiates termination of the underlying connection to the Chat Service. After the service is
|
|
110
|
-
* disconnected, it will not attempt to automatically reconnect until you call
|
|
111
|
-
* {@link #connect()}.
|
|
112
|
-
*
|
|
113
|
-
* Note: the same instance of `ChatService` can be reused after {@link #disconnect()} was
|
|
114
|
-
* called.
|
|
115
|
-
*/
|
|
116
|
-
disconnect(): Promise<void>;
|
|
117
|
-
/**
|
|
118
|
-
* Sends request to the Chat Service.
|
|
119
|
-
*
|
|
120
|
-
* In addition to the response, an object containing debug information about the request flow is
|
|
121
|
-
* returned.
|
|
122
|
-
*
|
|
123
|
-
* @throws {ChatServiceInactive} if you haven't called {@link #connect()} (as a
|
|
124
|
-
* rejection of the promise).
|
|
125
|
-
*/
|
|
126
|
-
fetchAndDebug(chatRequest: ChatRequest, options?: {
|
|
127
|
-
abortSignal?: AbortSignal;
|
|
128
|
-
}): Promise<Native.ResponseAndDebugInfo>;
|
|
129
|
-
/**
|
|
130
|
-
* Sends request to the Chat Service.
|
|
131
|
-
*
|
|
132
|
-
* @throws {ChatServiceInactive} if you haven't called {@link #connect()} (as a
|
|
133
|
-
* rejection of the promise).
|
|
134
|
-
*/
|
|
135
|
-
fetch(chatRequest: ChatRequest, options?: {
|
|
136
|
-
abortSignal?: AbortSignal;
|
|
137
|
-
}): Promise<Native.ChatResponse>;
|
|
138
|
-
};
|
|
139
86
|
/**
|
|
140
87
|
* A connection to the Chat Service.
|
|
141
88
|
*
|
|
@@ -201,42 +148,6 @@ export declare class AuthenticatedChatConnection implements ChatConnection {
|
|
|
201
148
|
disconnect(): Promise<void>;
|
|
202
149
|
connectionInfo(): ConnectionInfo;
|
|
203
150
|
}
|
|
204
|
-
/**
|
|
205
|
-
* Provides API methods to connect and communicate with the Chat Service over an authenticated channel.
|
|
206
|
-
*/
|
|
207
|
-
export declare class AuthenticatedChatService implements ChatService {
|
|
208
|
-
private readonly asyncContext;
|
|
209
|
-
readonly chatService: Wrapper<Native.AuthChat>;
|
|
210
|
-
constructor(asyncContext: TokioAsyncContext, connectionManager: ConnectionManager, username: string, password: string, receiveStories: boolean, listener: ChatServiceListener);
|
|
211
|
-
disconnect(): Promise<void>;
|
|
212
|
-
connect(options?: {
|
|
213
|
-
abortSignal?: AbortSignal;
|
|
214
|
-
}): Promise<Native.ChatServiceDebugInfo>;
|
|
215
|
-
fetchAndDebug(chatRequest: ChatRequest, options?: {
|
|
216
|
-
abortSignal?: AbortSignal;
|
|
217
|
-
}): Promise<Native.ResponseAndDebugInfo>;
|
|
218
|
-
fetch(chatRequest: ChatRequest, options?: {
|
|
219
|
-
abortSignal?: AbortSignal;
|
|
220
|
-
}): Promise<Native.ChatResponse>;
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* Provides API methods to connect and communicate with the Chat Service over an unauthenticated channel.
|
|
224
|
-
*/
|
|
225
|
-
export declare class UnauthenticatedChatService implements ChatService {
|
|
226
|
-
private readonly asyncContext;
|
|
227
|
-
readonly chatService: Wrapper<Native.UnauthChat>;
|
|
228
|
-
constructor(asyncContext: TokioAsyncContext, connectionManager: ConnectionManager, listener: ConnectionEventsListener);
|
|
229
|
-
disconnect(): Promise<void>;
|
|
230
|
-
connect(options?: {
|
|
231
|
-
abortSignal?: AbortSignal;
|
|
232
|
-
}): Promise<Native.ChatServiceDebugInfo>;
|
|
233
|
-
fetchAndDebug(chatRequest: ChatRequest, options?: {
|
|
234
|
-
abortSignal?: AbortSignal;
|
|
235
|
-
}): Promise<Native.ResponseAndDebugInfo>;
|
|
236
|
-
fetch(chatRequest: ChatRequest, options?: {
|
|
237
|
-
abortSignal?: AbortSignal;
|
|
238
|
-
}): Promise<Native.ChatResponse>;
|
|
239
|
-
}
|
|
240
151
|
export declare function buildHttpRequest(chatRequest: ChatRequest): Wrapper<Native.HttpRequest>;
|
|
241
152
|
export type NetConstructorOptions = Readonly<{
|
|
242
153
|
localTestServer?: false;
|
|
@@ -268,19 +179,6 @@ export declare class Net {
|
|
|
268
179
|
/** Exposed only for testing. */
|
|
269
180
|
readonly _connectionManager: ConnectionManager;
|
|
270
181
|
constructor(options: NetConstructorOptions);
|
|
271
|
-
/**
|
|
272
|
-
* Creates a new instance of {@link AuthenticatedChatService}.
|
|
273
|
-
*
|
|
274
|
-
* Note that created `AuthenticatedChatService` will hold a **non-garbage-collectable** reference to `listener`.
|
|
275
|
-
* If `listener` contains a strong reference to this ChatService (directly or indirectly), both objects will be kept
|
|
276
|
-
* alive even with no other references. If such reference cycle is created, it's the responsibility of the caller
|
|
277
|
-
* to eventually break it (either using a weak reference or by assigning over the strong reference).
|
|
278
|
-
*/
|
|
279
|
-
newAuthenticatedChatService(username: string, password: string, receiveStories: boolean, listener: ChatServiceListener): AuthenticatedChatService;
|
|
280
|
-
/**
|
|
281
|
-
* Creates a new instance of {@link UnauthenticatedChatService}.
|
|
282
|
-
*/
|
|
283
|
-
newUnauthenticatedChatService(listener: ConnectionEventsListener): UnauthenticatedChatService;
|
|
284
182
|
/**
|
|
285
183
|
*
|
|
286
184
|
* Creates a new instance of {@link UnauthenticatedChatConnection}.
|
|
@@ -310,7 +208,7 @@ export declare class Net {
|
|
|
310
208
|
* If CC is enabled, *new* connections and services may try additional routes to the Signal
|
|
311
209
|
* servers. Existing connections and services will continue with the setting they were created
|
|
312
210
|
* with. (In particular, changing this setting will not affect any existing
|
|
313
|
-
* {@link
|
|
211
|
+
* {@link ChatConnection ChatConnections}.)
|
|
314
212
|
*
|
|
315
213
|
* CC is off by default.
|
|
316
214
|
*/
|
package/dist/net.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.Net = exports.SIGNAL_TLS_PROXY_SCHEME = exports.buildHttpRequest = exports.
|
|
7
|
+
exports.Net = exports.SIGNAL_TLS_PROXY_SCHEME = exports.buildHttpRequest = exports.AuthenticatedChatConnection = exports.UnauthenticatedChatConnection = exports.ChatServerMessageAck = exports.TokioAsyncContext = exports.newNativeHandle = exports.Environment = void 0;
|
|
8
8
|
const Native = require("../Native");
|
|
9
9
|
const Address_1 = require("./Address");
|
|
10
10
|
const node_buffer_1 = require("node:buffer");
|
|
@@ -183,64 +183,6 @@ class WeakListenerWrapper {
|
|
|
183
183
|
this.listener.deref()?._queue_empty();
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
/**
|
|
187
|
-
* Provides API methods to connect and communicate with the Chat Service over an authenticated channel.
|
|
188
|
-
*/
|
|
189
|
-
class AuthenticatedChatService {
|
|
190
|
-
constructor(asyncContext, connectionManager, username, password, receiveStories, listener) {
|
|
191
|
-
this.asyncContext = asyncContext;
|
|
192
|
-
this.chatService = newNativeHandle(Native.ChatService_new_auth(connectionManager, username, password, receiveStories));
|
|
193
|
-
const nativeChatListener = {
|
|
194
|
-
_incoming_message(envelope, timestamp, ack) {
|
|
195
|
-
listener.onIncomingMessage(envelope, timestamp, new ChatServerMessageAck(asyncContext, ack));
|
|
196
|
-
},
|
|
197
|
-
_queue_empty() {
|
|
198
|
-
listener.onQueueEmpty();
|
|
199
|
-
},
|
|
200
|
-
_connection_interrupted(cause) {
|
|
201
|
-
listener.onConnectionInterrupted(cause);
|
|
202
|
-
},
|
|
203
|
-
};
|
|
204
|
-
Native.ChatService_SetListenerAuth(asyncContext, this.chatService, nativeChatListener);
|
|
205
|
-
}
|
|
206
|
-
disconnect() {
|
|
207
|
-
return Native.ChatService_disconnect_auth(this.asyncContext, this.chatService);
|
|
208
|
-
}
|
|
209
|
-
connect(options) {
|
|
210
|
-
return this.asyncContext.makeCancellable(options?.abortSignal, Native.ChatService_connect_auth(this.asyncContext, this.chatService));
|
|
211
|
-
}
|
|
212
|
-
fetchAndDebug(chatRequest, options) {
|
|
213
|
-
return this.asyncContext.makeCancellable(options?.abortSignal, Native.ChatService_auth_send_and_debug(this.asyncContext, this.chatService, buildHttpRequest(chatRequest), chatRequest.timeoutMillis ?? DEFAULT_CHAT_REQUEST_TIMEOUT_MILLIS));
|
|
214
|
-
}
|
|
215
|
-
fetch(chatRequest, options) {
|
|
216
|
-
return this.asyncContext.makeCancellable(options?.abortSignal, Native.ChatService_auth_send(this.asyncContext, this.chatService, buildHttpRequest(chatRequest), chatRequest.timeoutMillis ?? DEFAULT_CHAT_REQUEST_TIMEOUT_MILLIS));
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
exports.AuthenticatedChatService = AuthenticatedChatService;
|
|
220
|
-
/**
|
|
221
|
-
* Provides API methods to connect and communicate with the Chat Service over an unauthenticated channel.
|
|
222
|
-
*/
|
|
223
|
-
class UnauthenticatedChatService {
|
|
224
|
-
constructor(asyncContext, connectionManager, listener) {
|
|
225
|
-
this.asyncContext = asyncContext;
|
|
226
|
-
this.chatService = newNativeHandle(Native.ChatService_new_unauth(connectionManager));
|
|
227
|
-
const nativeChatListener = makeNativeChatListener(asyncContext, listener);
|
|
228
|
-
Native.ChatService_SetListenerUnauth(asyncContext, this.chatService, nativeChatListener);
|
|
229
|
-
}
|
|
230
|
-
disconnect() {
|
|
231
|
-
return Native.ChatService_disconnect_unauth(this.asyncContext, this.chatService);
|
|
232
|
-
}
|
|
233
|
-
connect(options) {
|
|
234
|
-
return this.asyncContext.makeCancellable(options?.abortSignal, Native.ChatService_connect_unauth(this.asyncContext, this.chatService));
|
|
235
|
-
}
|
|
236
|
-
fetchAndDebug(chatRequest, options) {
|
|
237
|
-
return this.asyncContext.makeCancellable(options?.abortSignal, Native.ChatService_unauth_send_and_debug(this.asyncContext, this.chatService, buildHttpRequest(chatRequest), chatRequest.timeoutMillis ?? DEFAULT_CHAT_REQUEST_TIMEOUT_MILLIS));
|
|
238
|
-
}
|
|
239
|
-
fetch(chatRequest, options) {
|
|
240
|
-
return this.asyncContext.makeCancellable(options?.abortSignal, Native.ChatService_unauth_send(this.asyncContext, this.chatService, buildHttpRequest(chatRequest), chatRequest.timeoutMillis ?? DEFAULT_CHAT_REQUEST_TIMEOUT_MILLIS));
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
exports.UnauthenticatedChatService = UnauthenticatedChatService;
|
|
244
186
|
function makeNativeChatListener(asyncContext, listener) {
|
|
245
187
|
if ('onQueueEmpty' in listener) {
|
|
246
188
|
return {
|
|
@@ -292,23 +234,6 @@ class Net {
|
|
|
292
234
|
this._connectionManager = newNativeHandle(Native.ConnectionManager_new(options.env, options.userAgent));
|
|
293
235
|
}
|
|
294
236
|
}
|
|
295
|
-
/**
|
|
296
|
-
* Creates a new instance of {@link AuthenticatedChatService}.
|
|
297
|
-
*
|
|
298
|
-
* Note that created `AuthenticatedChatService` will hold a **non-garbage-collectable** reference to `listener`.
|
|
299
|
-
* If `listener` contains a strong reference to this ChatService (directly or indirectly), both objects will be kept
|
|
300
|
-
* alive even with no other references. If such reference cycle is created, it's the responsibility of the caller
|
|
301
|
-
* to eventually break it (either using a weak reference or by assigning over the strong reference).
|
|
302
|
-
*/
|
|
303
|
-
newAuthenticatedChatService(username, password, receiveStories, listener) {
|
|
304
|
-
return new AuthenticatedChatService(this.asyncContext, this._connectionManager, username, password, receiveStories, listener);
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* Creates a new instance of {@link UnauthenticatedChatService}.
|
|
308
|
-
*/
|
|
309
|
-
newUnauthenticatedChatService(listener) {
|
|
310
|
-
return new UnauthenticatedChatService(this.asyncContext, this._connectionManager, listener);
|
|
311
|
-
}
|
|
312
237
|
/**
|
|
313
238
|
*
|
|
314
239
|
* Creates a new instance of {@link UnauthenticatedChatConnection}.
|
|
@@ -340,7 +265,7 @@ class Net {
|
|
|
340
265
|
* If CC is enabled, *new* connections and services may try additional routes to the Signal
|
|
341
266
|
* servers. Existing connections and services will continue with the setting they were created
|
|
342
267
|
* with. (In particular, changing this setting will not affect any existing
|
|
343
|
-
* {@link
|
|
268
|
+
* {@link ChatConnection ChatConnections}.)
|
|
344
269
|
*
|
|
345
270
|
* CC is off by default.
|
|
346
271
|
*/
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|