@signalapp/libsignal-client 0.47.0 → 0.48.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 +1 -2
- package/dist/Errors.d.ts +14 -2
- package/dist/Errors.js +3 -0
- package/dist/acknowledgments.md +2 -2
- package/dist/net.d.ts +42 -11
- package/dist/net.js +56 -25
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/node.napi.node +0 -0
- package/prebuilds/darwin-x64/node.napi.node +0 -0
- package/prebuilds/linux-arm64/node.napi.node +0 -0
- package/prebuilds/linux-x64/node.napi.node +0 -0
- package/prebuilds/win32-arm64/node.napi.node +0 -0
- package/prebuilds/win32-x64/node.napi.node +0 -0
package/Native.d.ts
CHANGED
|
@@ -477,8 +477,7 @@ export function TESTING_ChatRequestGetHeaderValue(request: Wrapper<HttpRequest>,
|
|
|
477
477
|
export function TESTING_ChatRequestGetMethod(request: Wrapper<HttpRequest>): string;
|
|
478
478
|
export function TESTING_ChatRequestGetPath(request: Wrapper<HttpRequest>): string;
|
|
479
479
|
export function TESTING_ChatServiceDebugInfoConvert(): ChatServiceDebugInfo;
|
|
480
|
-
export function TESTING_ChatServiceErrorConvert(): void;
|
|
481
|
-
export function TESTING_ChatServiceInactiveErrorConvert(): void;
|
|
480
|
+
export function TESTING_ChatServiceErrorConvert(errorDescription: string): void;
|
|
482
481
|
export function TESTING_ChatServiceResponseAndDebugInfoConvert(): ResponseAndDebugInfo;
|
|
483
482
|
export function TESTING_ChatServiceResponseConvert(bodyPresent: boolean): ChatResponse;
|
|
484
483
|
export function TESTING_ChatService_InjectRawServerRequest(chat: Wrapper<Chat>, bytes: Buffer): void;
|
package/dist/Errors.d.ts
CHANGED
|
@@ -33,7 +33,10 @@ export declare enum ErrorCode {
|
|
|
33
33
|
SvrDataMissing = 29,
|
|
34
34
|
SvrRequestFailed = 30,
|
|
35
35
|
SvrRestoreFailed = 31,
|
|
36
|
-
ChatServiceInactive = 32
|
|
36
|
+
ChatServiceInactive = 32,
|
|
37
|
+
AppExpired = 33,
|
|
38
|
+
DeviceDelinked = 34,
|
|
39
|
+
Cancelled = 35
|
|
37
40
|
}
|
|
38
41
|
export declare class LibSignalErrorBase extends Error {
|
|
39
42
|
readonly code: ErrorCode;
|
|
@@ -137,6 +140,12 @@ export type RateLimitedError = LibSignalErrorBase & {
|
|
|
137
140
|
export type ChatServiceInactive = LibSignalErrorBase & {
|
|
138
141
|
code: ErrorCode.ChatServiceInactive;
|
|
139
142
|
};
|
|
143
|
+
export type AppExpiredError = LibSignalErrorBase & {
|
|
144
|
+
code: ErrorCode.AppExpired;
|
|
145
|
+
};
|
|
146
|
+
export type DeviceDelinkedError = LibSignalErrorBase & {
|
|
147
|
+
code: ErrorCode.DeviceDelinked;
|
|
148
|
+
};
|
|
140
149
|
export type SvrDataMissingError = LibSignalErrorBase & {
|
|
141
150
|
code: ErrorCode.SvrDataMissing;
|
|
142
151
|
};
|
|
@@ -147,4 +156,7 @@ export type SvrRestoreFailedError = LibSignalErrorCommon & {
|
|
|
147
156
|
code: ErrorCode.SvrRestoreFailed;
|
|
148
157
|
readonly triesRemaining: number;
|
|
149
158
|
};
|
|
150
|
-
export type
|
|
159
|
+
export type CancellationError = LibSignalErrorCommon & {
|
|
160
|
+
code: ErrorCode.Cancelled;
|
|
161
|
+
};
|
|
162
|
+
export type LibSignalError = GenericError | DuplicatedMessageError | SealedSenderSelfSendError | UntrustedIdentityError | InvalidRegistrationIdError | VerificationFailedError | InvalidSessionError | InvalidSenderKeySessionError | NicknameCannotBeEmptyError | CannotStartWithDigitError | MissingSeparatorError | BadNicknameCharacterError | NicknameTooShortError | NicknameTooLongError | DiscriminatorCannotBeEmptyError | DiscriminatorCannotBeZeroError | DiscriminatorCannotBeSingleDigitError | DiscriminatorCannotHaveLeadingZerosError | BadDiscriminatorCharacterError | DiscriminatorTooLargeError | InputDataTooLong | InvalidEntropyDataLength | InvalidUsernameLinkEncryptedData | IoError | CdsiInvalidTokenError | InvalidUriError | InvalidMediaInputError | SvrDataMissingError | SvrRestoreFailedError | SvrRequestFailedError | UnsupportedMediaInputError | ChatServiceInactive | AppExpiredError | DeviceDelinkedError | CancellationError;
|
package/dist/Errors.js
CHANGED
|
@@ -41,6 +41,9 @@ var ErrorCode;
|
|
|
41
41
|
ErrorCode[ErrorCode["SvrRequestFailed"] = 30] = "SvrRequestFailed";
|
|
42
42
|
ErrorCode[ErrorCode["SvrRestoreFailed"] = 31] = "SvrRestoreFailed";
|
|
43
43
|
ErrorCode[ErrorCode["ChatServiceInactive"] = 32] = "ChatServiceInactive";
|
|
44
|
+
ErrorCode[ErrorCode["AppExpired"] = 33] = "AppExpired";
|
|
45
|
+
ErrorCode[ErrorCode["DeviceDelinked"] = 34] = "DeviceDelinked";
|
|
46
|
+
ErrorCode[ErrorCode["Cancelled"] = 35] = "Cancelled";
|
|
44
47
|
})(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {}));
|
|
45
48
|
class LibSignalErrorBase extends Error {
|
|
46
49
|
constructor(message, name, operation, extraProps) {
|
package/dist/acknowledgments.md
CHANGED
|
@@ -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, device-transfer 0.1.0, libsignal-bridge 0.1.0, libsignal-bridge-macros 0.1.0, libsignal-core 0.1.0, libsignal-ffi 0.
|
|
672
|
+
## attest 0.1.0, device-transfer 0.1.0, libsignal-bridge 0.1.0, libsignal-bridge-macros 0.1.0, libsignal-core 0.1.0, libsignal-ffi 0.48.0, libsignal-jni 0.48.0, libsignal-message-backup 0.1.0, libsignal-message-backup-macros 0.1.0, libsignal-net 0.1.0, libsignal-node 0.48.0, libsignal-protocol 0.1.0, libsignal-svr3 0.1.0, poksho 0.7.0, signal-crypto 0.1.0, signal-media 0.1.0, signal-neon-futures 0.1.0, signal-neon-futures-tests 0.1.0, signal-pin 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
|
|
@@ -4454,7 +4454,7 @@ DEALINGS IN THE SOFTWARE.
|
|
|
4454
4454
|
|
|
4455
4455
|
```
|
|
4456
4456
|
|
|
4457
|
-
## smallvec 1.13.
|
|
4457
|
+
## smallvec 1.13.2
|
|
4458
4458
|
|
|
4459
4459
|
```
|
|
4460
4460
|
Copyright (c) 2018 The Servo Project Developers
|
package/dist/net.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export type CDSRequestOptionsType = {
|
|
|
17
17
|
accessKey: string;
|
|
18
18
|
}>;
|
|
19
19
|
returnAcisWithoutUaks: boolean;
|
|
20
|
+
abortSignal?: AbortSignal;
|
|
20
21
|
};
|
|
21
22
|
export type CDSResponseEntryType<Aci, Pni> = {
|
|
22
23
|
aci: Aci | undefined;
|
|
@@ -34,8 +35,13 @@ export type ChatRequest = Readonly<{
|
|
|
34
35
|
body?: Uint8Array;
|
|
35
36
|
timeoutMillis?: number;
|
|
36
37
|
}>;
|
|
37
|
-
type TokioAsyncContext = Wrapper<Native.TokioAsyncContext>;
|
|
38
38
|
type ConnectionManager = Wrapper<Native.ConnectionManager>;
|
|
39
|
+
/** Low-level async runtime control, mostly just exported for testing. */
|
|
40
|
+
export declare class TokioAsyncContext {
|
|
41
|
+
readonly _nativeHandle: Native.TokioAsyncContext;
|
|
42
|
+
constructor(handle: Native.TokioAsyncContext);
|
|
43
|
+
makeCancellable<T>(abortSignal: AbortSignal | undefined, promise: Promise<T>): Promise<T>;
|
|
44
|
+
}
|
|
39
45
|
/**
|
|
40
46
|
* Provides API methods to connect and communicate with the Chat Service.
|
|
41
47
|
* Before using either authenticated or unauthenticated channels,
|
|
@@ -60,8 +66,13 @@ export declare class ChatService {
|
|
|
60
66
|
* the service is connected, all the requests will be using the established connection. Also, if
|
|
61
67
|
* the connection is lost for any reason other than the call to {@link #disconnect()}, an
|
|
62
68
|
* automatic reconnect attempt will be made.
|
|
69
|
+
*
|
|
70
|
+
* @throws {AppExpiredError} if the current app version is too old (as judged by the server).
|
|
71
|
+
* @throws {LibSignalError} with other codes for other failures.
|
|
63
72
|
*/
|
|
64
|
-
connectUnauthenticated(
|
|
73
|
+
connectUnauthenticated(options?: {
|
|
74
|
+
abortSignal?: AbortSignal;
|
|
75
|
+
}): Promise<Native.ChatServiceDebugInfo>;
|
|
65
76
|
/**
|
|
66
77
|
* Initiates establishing of the underlying authenticated connection to the Chat Service. Once the
|
|
67
78
|
* service is connected, all the requests will be using the established connection. Also, if the
|
|
@@ -69,8 +80,14 @@ export declare class ChatService {
|
|
|
69
80
|
* reconnect attempt will be made.
|
|
70
81
|
*
|
|
71
82
|
* Calling this method will result in starting to accept incoming requests from the Chat Service.
|
|
83
|
+
*
|
|
84
|
+
* @throws {AppExpiredError} if the current app version is too old (as judged by the server).
|
|
85
|
+
* @throws {DeviceDelinkedError} if the current device has been delinked.
|
|
86
|
+
* @throws {LibSignalError} with other codes for other failures.
|
|
72
87
|
*/
|
|
73
|
-
connectAuthenticated(
|
|
88
|
+
connectAuthenticated(options?: {
|
|
89
|
+
abortSignal?: AbortSignal;
|
|
90
|
+
}): Promise<Native.ChatServiceDebugInfo>;
|
|
74
91
|
/**
|
|
75
92
|
* Sends request to the Chat Service over an unauthenticated channel.
|
|
76
93
|
*
|
|
@@ -80,14 +97,18 @@ export declare class ChatService {
|
|
|
80
97
|
* @throws {ChatServiceInactive} if you haven't called {@link #connectUnauthenticated()} (as a
|
|
81
98
|
* rejection of the promise).
|
|
82
99
|
*/
|
|
83
|
-
unauthenticatedFetchAndDebug(chatRequest: ChatRequest
|
|
100
|
+
unauthenticatedFetchAndDebug(chatRequest: ChatRequest, options?: {
|
|
101
|
+
abortSignal?: AbortSignal;
|
|
102
|
+
}): Promise<Native.ResponseAndDebugInfo>;
|
|
84
103
|
/**
|
|
85
104
|
* Sends request to the Chat Service over an unauthenticated channel.
|
|
86
105
|
*
|
|
87
106
|
* @throws {ChatServiceInactive} if you haven't called {@link #connectUnauthenticated()} (as a
|
|
88
107
|
* rejection of the promise).
|
|
89
108
|
*/
|
|
90
|
-
unauthenticatedFetch(chatRequest: ChatRequest
|
|
109
|
+
unauthenticatedFetch(chatRequest: ChatRequest, options?: {
|
|
110
|
+
abortSignal?: AbortSignal;
|
|
111
|
+
}): Promise<Native.ChatResponse>;
|
|
91
112
|
/**
|
|
92
113
|
* Sends request to the Chat Service over an authenticated channel.
|
|
93
114
|
*
|
|
@@ -97,14 +118,18 @@ export declare class ChatService {
|
|
|
97
118
|
* @throws {ChatServiceInactive} if you haven't called {@link #connectAuthenticated()} (as a
|
|
98
119
|
* rejection of the promise).
|
|
99
120
|
*/
|
|
100
|
-
authenticatedFetchAndDebug(chatRequest: ChatRequest
|
|
121
|
+
authenticatedFetchAndDebug(chatRequest: ChatRequest, options?: {
|
|
122
|
+
abortSignal?: AbortSignal;
|
|
123
|
+
}): Promise<Native.ResponseAndDebugInfo>;
|
|
101
124
|
/**
|
|
102
125
|
* Sends request to the Chat Service over an authenticated channel.
|
|
103
126
|
*
|
|
104
127
|
* @throws {ChatServiceInactive} if you haven't called {@link #connectAuthenticated()} (as a
|
|
105
128
|
* rejection of the promise).
|
|
106
129
|
*/
|
|
107
|
-
authenticatedFetch(chatRequest: ChatRequest
|
|
130
|
+
authenticatedFetch(chatRequest: ChatRequest, options?: {
|
|
131
|
+
abortSignal?: AbortSignal;
|
|
132
|
+
}): Promise<Native.ChatResponse>;
|
|
108
133
|
static buildHttpRequest(chatRequest: ChatRequest): {
|
|
109
134
|
_nativeHandle: Native.HttpRequest;
|
|
110
135
|
};
|
|
@@ -144,7 +169,7 @@ export declare class Net {
|
|
|
144
169
|
* method is a no-op.
|
|
145
170
|
*/
|
|
146
171
|
clearProxy(): void;
|
|
147
|
-
cdsiLookup({ username, password }: Readonly<ServiceAuth>, { e164s, acisAndAccessKeys, returnAcisWithoutUaks, }: ReadonlyDeep<CDSRequestOptionsType>): Promise<CDSResponseType<string, string>>;
|
|
172
|
+
cdsiLookup({ username, password }: Readonly<ServiceAuth>, { e164s, acisAndAccessKeys, returnAcisWithoutUaks, abortSignal, }: ReadonlyDeep<CDSRequestOptionsType>): Promise<CDSResponseType<string, string>>;
|
|
148
173
|
}
|
|
149
174
|
/**
|
|
150
175
|
* This interface provides functionality for communicating with SVR3
|
|
@@ -199,7 +224,9 @@ export interface Svr3Client {
|
|
|
199
224
|
* are therefore non-actionable and are guaranteed to be thrown again when
|
|
200
225
|
* retried.
|
|
201
226
|
*/
|
|
202
|
-
backup(what: Buffer, password: string, maxTries: number, auth: Readonly<ServiceAuth
|
|
227
|
+
backup(what: Buffer, password: string, maxTries: number, auth: Readonly<ServiceAuth>, options?: {
|
|
228
|
+
abortSignal?: AbortSignal;
|
|
229
|
+
}): Promise<Buffer>;
|
|
203
230
|
/**
|
|
204
231
|
* Restore a secret from SVR3.
|
|
205
232
|
*
|
|
@@ -235,7 +262,9 @@ export interface Svr3Client {
|
|
|
235
262
|
* masked share set fails, or when the server requests fail for reasons
|
|
236
263
|
* other than "maximum attempts exceeded".
|
|
237
264
|
*/
|
|
238
|
-
restore(password: string, shareSet: Buffer, auth: Readonly<ServiceAuth
|
|
265
|
+
restore(password: string, shareSet: Buffer, auth: Readonly<ServiceAuth>, options?: {
|
|
266
|
+
abortSignal?: AbortSignal;
|
|
267
|
+
}): Promise<RestoredSecret>;
|
|
239
268
|
/**
|
|
240
269
|
* Remove a value stored in SVR3.
|
|
241
270
|
*
|
|
@@ -261,7 +290,9 @@ export interface Svr3Client {
|
|
|
261
290
|
* are therefore non-actionable and are guaranteed to be thrown again when
|
|
262
291
|
* retried.
|
|
263
292
|
*/
|
|
264
|
-
remove(auth: Readonly<ServiceAuth
|
|
293
|
+
remove(auth: Readonly<ServiceAuth>, options?: {
|
|
294
|
+
abortSignal?: AbortSignal;
|
|
295
|
+
}): Promise<void>;
|
|
265
296
|
}
|
|
266
297
|
/**
|
|
267
298
|
* A simple data class containing the secret restored from SVR3 as well as the
|
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.RestoredSecret = exports.Net = exports.ChatService = exports.Environment = void 0;
|
|
7
|
+
exports.RestoredSecret = exports.Net = exports.ChatService = exports.TokioAsyncContext = exports.Environment = void 0;
|
|
8
8
|
const Native = require("../Native");
|
|
9
9
|
const Address_1 = require("./Address");
|
|
10
10
|
const DEFAULT_CHAT_REQUEST_TIMEOUT_MILLIS = 5000;
|
|
@@ -19,6 +19,30 @@ function newNativeHandle(handle) {
|
|
|
19
19
|
_nativeHandle: handle,
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
+
/** Low-level async runtime control, mostly just exported for testing. */
|
|
23
|
+
class TokioAsyncContext {
|
|
24
|
+
constructor(handle) {
|
|
25
|
+
this._nativeHandle = handle;
|
|
26
|
+
}
|
|
27
|
+
makeCancellable(abortSignal, promise) {
|
|
28
|
+
if (abortSignal !== undefined &&
|
|
29
|
+
'_cancellationToken' in promise &&
|
|
30
|
+
typeof promise._cancellationToken === 'bigint') {
|
|
31
|
+
const cancellationToken = promise._cancellationToken;
|
|
32
|
+
const cancel = () => {
|
|
33
|
+
Native.TokioAsyncContext_cancel(this, cancellationToken);
|
|
34
|
+
};
|
|
35
|
+
if (abortSignal.aborted) {
|
|
36
|
+
cancel();
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
abortSignal.addEventListener('abort', cancel);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return promise;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.TokioAsyncContext = TokioAsyncContext;
|
|
22
46
|
/**
|
|
23
47
|
* Provides API methods to connect and communicate with the Chat Service.
|
|
24
48
|
* Before using either authenticated or unauthenticated channels,
|
|
@@ -38,17 +62,20 @@ class ChatService {
|
|
|
38
62
|
* Note: the same instance of `ChatService` can be reused after `disconnect()` was
|
|
39
63
|
* called.
|
|
40
64
|
*/
|
|
41
|
-
|
|
42
|
-
|
|
65
|
+
disconnect() {
|
|
66
|
+
return Native.ChatService_disconnect(this.asyncContext, this.chatService);
|
|
43
67
|
}
|
|
44
68
|
/**
|
|
45
69
|
* Initiates establishing of the underlying unauthenticated connection to the Chat Service. Once
|
|
46
70
|
* the service is connected, all the requests will be using the established connection. Also, if
|
|
47
71
|
* the connection is lost for any reason other than the call to {@link #disconnect()}, an
|
|
48
72
|
* automatic reconnect attempt will be made.
|
|
73
|
+
*
|
|
74
|
+
* @throws {AppExpiredError} if the current app version is too old (as judged by the server).
|
|
75
|
+
* @throws {LibSignalError} with other codes for other failures.
|
|
49
76
|
*/
|
|
50
|
-
|
|
51
|
-
return
|
|
77
|
+
connectUnauthenticated(options) {
|
|
78
|
+
return this.asyncContext.makeCancellable(options?.abortSignal, Native.ChatService_connect_unauth(this.asyncContext, this.chatService));
|
|
52
79
|
}
|
|
53
80
|
/**
|
|
54
81
|
* Initiates establishing of the underlying authenticated connection to the Chat Service. Once the
|
|
@@ -57,9 +84,13 @@ class ChatService {
|
|
|
57
84
|
* reconnect attempt will be made.
|
|
58
85
|
*
|
|
59
86
|
* Calling this method will result in starting to accept incoming requests from the Chat Service.
|
|
87
|
+
*
|
|
88
|
+
* @throws {AppExpiredError} if the current app version is too old (as judged by the server).
|
|
89
|
+
* @throws {DeviceDelinkedError} if the current device has been delinked.
|
|
90
|
+
* @throws {LibSignalError} with other codes for other failures.
|
|
60
91
|
*/
|
|
61
|
-
|
|
62
|
-
return
|
|
92
|
+
connectAuthenticated(options) {
|
|
93
|
+
return this.asyncContext.makeCancellable(options?.abortSignal, Native.ChatService_connect_auth(this.asyncContext, this.chatService));
|
|
63
94
|
}
|
|
64
95
|
/**
|
|
65
96
|
* Sends request to the Chat Service over an unauthenticated channel.
|
|
@@ -70,8 +101,8 @@ class ChatService {
|
|
|
70
101
|
* @throws {ChatServiceInactive} if you haven't called {@link #connectUnauthenticated()} (as a
|
|
71
102
|
* rejection of the promise).
|
|
72
103
|
*/
|
|
73
|
-
|
|
74
|
-
return
|
|
104
|
+
unauthenticatedFetchAndDebug(chatRequest, options) {
|
|
105
|
+
return this.asyncContext.makeCancellable(options?.abortSignal, Native.ChatService_unauth_send_and_debug(this.asyncContext, this.chatService, ChatService.buildHttpRequest(chatRequest), chatRequest.timeoutMillis ?? DEFAULT_CHAT_REQUEST_TIMEOUT_MILLIS));
|
|
75
106
|
}
|
|
76
107
|
/**
|
|
77
108
|
* Sends request to the Chat Service over an unauthenticated channel.
|
|
@@ -79,8 +110,8 @@ class ChatService {
|
|
|
79
110
|
* @throws {ChatServiceInactive} if you haven't called {@link #connectUnauthenticated()} (as a
|
|
80
111
|
* rejection of the promise).
|
|
81
112
|
*/
|
|
82
|
-
|
|
83
|
-
return
|
|
113
|
+
unauthenticatedFetch(chatRequest, options) {
|
|
114
|
+
return this.asyncContext.makeCancellable(options?.abortSignal, Native.ChatService_unauth_send(this.asyncContext, this.chatService, ChatService.buildHttpRequest(chatRequest), chatRequest.timeoutMillis ?? DEFAULT_CHAT_REQUEST_TIMEOUT_MILLIS));
|
|
84
115
|
}
|
|
85
116
|
/**
|
|
86
117
|
* Sends request to the Chat Service over an authenticated channel.
|
|
@@ -91,8 +122,8 @@ class ChatService {
|
|
|
91
122
|
* @throws {ChatServiceInactive} if you haven't called {@link #connectAuthenticated()} (as a
|
|
92
123
|
* rejection of the promise).
|
|
93
124
|
*/
|
|
94
|
-
|
|
95
|
-
return
|
|
125
|
+
authenticatedFetchAndDebug(chatRequest, options) {
|
|
126
|
+
return this.asyncContext.makeCancellable(options?.abortSignal, Native.ChatService_auth_send_and_debug(this.asyncContext, this.chatService, ChatService.buildHttpRequest(chatRequest), chatRequest.timeoutMillis ?? DEFAULT_CHAT_REQUEST_TIMEOUT_MILLIS));
|
|
96
127
|
}
|
|
97
128
|
/**
|
|
98
129
|
* Sends request to the Chat Service over an authenticated channel.
|
|
@@ -100,8 +131,8 @@ class ChatService {
|
|
|
100
131
|
* @throws {ChatServiceInactive} if you haven't called {@link #connectAuthenticated()} (as a
|
|
101
132
|
* rejection of the promise).
|
|
102
133
|
*/
|
|
103
|
-
|
|
104
|
-
return
|
|
134
|
+
authenticatedFetch(chatRequest, options) {
|
|
135
|
+
return this.asyncContext.makeCancellable(options?.abortSignal, Native.ChatService_auth_send(this.asyncContext, this.chatService, ChatService.buildHttpRequest(chatRequest), chatRequest.timeoutMillis ?? DEFAULT_CHAT_REQUEST_TIMEOUT_MILLIS));
|
|
105
136
|
}
|
|
106
137
|
static buildHttpRequest(chatRequest) {
|
|
107
138
|
const { verb, path, body, headers } = chatRequest;
|
|
@@ -119,7 +150,7 @@ class ChatService {
|
|
|
119
150
|
exports.ChatService = ChatService;
|
|
120
151
|
class Net {
|
|
121
152
|
constructor(env, userAgent) {
|
|
122
|
-
this.asyncContext =
|
|
153
|
+
this.asyncContext = new TokioAsyncContext(Native.TokioAsyncContext_new());
|
|
123
154
|
this.connectionManager = newNativeHandle(Native.ConnectionManager_new(env, userAgent));
|
|
124
155
|
this.svr3 = new Svr3ClientImpl(this.asyncContext, this.connectionManager);
|
|
125
156
|
}
|
|
@@ -158,7 +189,7 @@ class Net {
|
|
|
158
189
|
clearProxy() {
|
|
159
190
|
Native.ConnectionManager_clear_proxy(this.connectionManager);
|
|
160
191
|
}
|
|
161
|
-
async cdsiLookup({ username, password }, { e164s, acisAndAccessKeys, returnAcisWithoutUaks, }) {
|
|
192
|
+
async cdsiLookup({ username, password }, { e164s, acisAndAccessKeys, returnAcisWithoutUaks, abortSignal, }) {
|
|
162
193
|
const request = newNativeHandle(Native.LookupRequest_new());
|
|
163
194
|
e164s.forEach((e164) => {
|
|
164
195
|
Native.LookupRequest_addE164(request, e164);
|
|
@@ -167,8 +198,8 @@ class Net {
|
|
|
167
198
|
Native.LookupRequest_addAciAndAccessKey(request, Address_1.Aci.parseFromServiceIdString(aciStr).getServiceIdFixedWidthBinary(), Buffer.from(accessKeyStr, 'base64'));
|
|
168
199
|
});
|
|
169
200
|
Native.LookupRequest_setReturnAcisWithoutUaks(request, returnAcisWithoutUaks);
|
|
170
|
-
const lookup = await Native.CdsiLookup_new(this.asyncContext, this.connectionManager, username, password, request);
|
|
171
|
-
return await Native.CdsiLookup_complete(this.asyncContext, newNativeHandle(lookup));
|
|
201
|
+
const lookup = await this.asyncContext.makeCancellable(abortSignal, Native.CdsiLookup_new(this.asyncContext, this.connectionManager, username, password, request));
|
|
202
|
+
return await this.asyncContext.makeCancellable(abortSignal, Native.CdsiLookup_complete(this.asyncContext, newNativeHandle(lookup)));
|
|
172
203
|
}
|
|
173
204
|
}
|
|
174
205
|
exports.Net = Net;
|
|
@@ -188,15 +219,15 @@ class Svr3ClientImpl {
|
|
|
188
219
|
this.asyncContext = asyncContext;
|
|
189
220
|
this.connectionManager = connectionManager;
|
|
190
221
|
}
|
|
191
|
-
async backup(what, password, maxTries, auth) {
|
|
192
|
-
return Native.Svr3Backup(this.asyncContext, this.connectionManager, what, password, maxTries, auth.username, auth.password);
|
|
222
|
+
async backup(what, password, maxTries, auth, options) {
|
|
223
|
+
return this.asyncContext.makeCancellable(options?.abortSignal, Native.Svr3Backup(this.asyncContext, this.connectionManager, what, password, maxTries, auth.username, auth.password));
|
|
193
224
|
}
|
|
194
|
-
async restore(password, shareSet, auth) {
|
|
195
|
-
const serialized = await Native.Svr3Restore(this.asyncContext, this.connectionManager, password, shareSet, auth.username, auth.password);
|
|
225
|
+
async restore(password, shareSet, auth, options) {
|
|
226
|
+
const serialized = await this.asyncContext.makeCancellable(options?.abortSignal, Native.Svr3Restore(this.asyncContext, this.connectionManager, password, shareSet, auth.username, auth.password));
|
|
196
227
|
return new RestoredSecret(serialized);
|
|
197
228
|
}
|
|
198
|
-
async remove(auth) {
|
|
199
|
-
return Native.Svr3Remove(this.asyncContext, this.connectionManager, auth.username, auth.password);
|
|
229
|
+
async remove(auth, options) {
|
|
230
|
+
return this.asyncContext.makeCancellable(options?.abortSignal, Native.Svr3Remove(this.asyncContext, this.connectionManager, auth.username, auth.password));
|
|
200
231
|
}
|
|
201
232
|
}
|
|
202
233
|
//# sourceMappingURL=net.js.map
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|