@signalapp/libsignal-client 0.42.0 → 0.43.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 +18 -12
- package/dist/Errors.d.ts +22 -10
- package/dist/Errors.js +12 -9
- package/dist/acknowledgments.md +1 -1
- package/dist/net.d.ts +59 -25
- package/dist/net.js +47 -6
- package/dist/zkgroup/internal/ByteArray.d.ts +1 -1
- package/dist/zkgroup/internal/ByteArray.js +2 -1
- 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
|
@@ -21,22 +21,24 @@ interface LookupResponseEntry {
|
|
|
21
21
|
readonly pni: string | undefined;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
interface
|
|
24
|
+
interface ChatResponse {
|
|
25
25
|
status: number;
|
|
26
26
|
message: string | undefined;
|
|
27
27
|
headers: ReadonlyArray<[string, string]>;
|
|
28
28
|
body: Buffer | undefined;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
interface
|
|
31
|
+
interface ChatServiceDebugInfo {
|
|
32
32
|
connectionReused: boolean;
|
|
33
33
|
reconnectCount: number;
|
|
34
34
|
ipType: number;
|
|
35
|
+
durationMillis: number;
|
|
36
|
+
connectionInfo: string;
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
interface ResponseAndDebugInfo {
|
|
38
|
-
response:
|
|
39
|
-
debugInfo:
|
|
40
|
+
response: ChatResponse;
|
|
41
|
+
debugInfo: ChatServiceDebugInfo;
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
interface SealedSenderMultiRecipientMessageRecipient {
|
|
@@ -164,11 +166,13 @@ export function CallLinkSecretParams_DeriveFromRootKey(rootKey: Buffer): Buffer;
|
|
|
164
166
|
export function CallLinkSecretParams_GetPublicParams(paramsBytes: Buffer): Buffer;
|
|
165
167
|
export function Cds2ClientState_New(mrenclave: Buffer, attestationMsg: Buffer, currentTimestamp: Timestamp): SgxClientState;
|
|
166
168
|
export function CdsiLookup_complete(asyncRuntime: Wrapper<TokioAsyncContext>, lookup: Wrapper<CdsiLookup>): Promise<LookupResponse>;
|
|
167
|
-
export function CdsiLookup_new(asyncRuntime: Wrapper<TokioAsyncContext>, connectionManager: Wrapper<ConnectionManager>, username: string, password: string, request: Wrapper<LookupRequest
|
|
169
|
+
export function CdsiLookup_new(asyncRuntime: Wrapper<TokioAsyncContext>, connectionManager: Wrapper<ConnectionManager>, username: string, password: string, request: Wrapper<LookupRequest>): Promise<CdsiLookup>;
|
|
168
170
|
export function CdsiLookup_token(lookup: Wrapper<CdsiLookup>): Buffer;
|
|
171
|
+
export function ChatService_connect_auth(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<Chat>): Promise<ChatServiceDebugInfo>;
|
|
172
|
+
export function ChatService_connect_unauth(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<Chat>): Promise<ChatServiceDebugInfo>;
|
|
169
173
|
export function ChatService_disconnect(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<Chat>): Promise<void>;
|
|
170
174
|
export function ChatService_new(connectionManager: Wrapper<ConnectionManager>, username: string, password: string): Chat;
|
|
171
|
-
export function ChatService_unauth_send(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<Chat>, httpRequest: Wrapper<HttpRequest>, timeoutMillis: number): Promise<
|
|
175
|
+
export function ChatService_unauth_send(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<Chat>, httpRequest: Wrapper<HttpRequest>, timeoutMillis: number): Promise<ChatResponse>;
|
|
172
176
|
export function ChatService_unauth_send_and_debug(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<Chat>, httpRequest: Wrapper<HttpRequest>, timeoutMillis: number): Promise<ResponseAndDebugInfo>;
|
|
173
177
|
export function CiphertextMessage_FromPlaintextContent(m: Wrapper<PlaintextContent>): CiphertextMessage;
|
|
174
178
|
export function CiphertextMessage_Serialize(obj: Wrapper<CiphertextMessage>): Buffer;
|
|
@@ -457,17 +461,19 @@ export function SignedPreKeyRecord_GetSignature(obj: Wrapper<SignedPreKeyRecord>
|
|
|
457
461
|
export function SignedPreKeyRecord_GetTimestamp(obj: Wrapper<SignedPreKeyRecord>): Timestamp;
|
|
458
462
|
export function SignedPreKeyRecord_New(id: number, timestamp: Timestamp, pubKey: Wrapper<PublicKey>, privKey: Wrapper<PrivateKey>, signature: Buffer): SignedPreKeyRecord;
|
|
459
463
|
export function SignedPreKeyRecord_Serialize(obj: Wrapper<SignedPreKeyRecord>): Buffer;
|
|
460
|
-
export function Svr3Backup(asyncRuntime: Wrapper<TokioAsyncContext>, connectionManager: Wrapper<ConnectionManager>, secret: Buffer, password: string, maxTries: number, username: string, enclavePassword: string
|
|
461
|
-
export function Svr3Restore(asyncRuntime: Wrapper<TokioAsyncContext>, connectionManager: Wrapper<ConnectionManager>, password: string, shareSet: Buffer, username: string, enclavePassword: string
|
|
462
|
-
export function TESTING_CdsiLookupErrorConvert(): void;
|
|
464
|
+
export function Svr3Backup(asyncRuntime: Wrapper<TokioAsyncContext>, connectionManager: Wrapper<ConnectionManager>, secret: Buffer, password: string, maxTries: number, username: string, enclavePassword: string): Promise<Buffer>;
|
|
465
|
+
export function Svr3Restore(asyncRuntime: Wrapper<TokioAsyncContext>, connectionManager: Wrapper<ConnectionManager>, password: string, shareSet: Buffer, username: string, enclavePassword: string): Promise<Buffer>;
|
|
466
|
+
export function TESTING_CdsiLookupErrorConvert(errorDescription: string): void;
|
|
463
467
|
export function TESTING_CdsiLookupResponseConvert(asyncRuntime: Wrapper<TokioAsyncContext>): Promise<LookupResponse>;
|
|
464
|
-
export function TESTING_ChatRequestGetBody(request: Wrapper<HttpRequest>): Buffer
|
|
468
|
+
export function TESTING_ChatRequestGetBody(request: Wrapper<HttpRequest>): Buffer;
|
|
465
469
|
export function TESTING_ChatRequestGetHeaderValue(request: Wrapper<HttpRequest>, headerName: string): string;
|
|
466
470
|
export function TESTING_ChatRequestGetMethod(request: Wrapper<HttpRequest>): string;
|
|
467
471
|
export function TESTING_ChatRequestGetPath(request: Wrapper<HttpRequest>): string;
|
|
468
|
-
export function TESTING_ChatServiceDebugInfoConvert():
|
|
472
|
+
export function TESTING_ChatServiceDebugInfoConvert(): ChatServiceDebugInfo;
|
|
469
473
|
export function TESTING_ChatServiceErrorConvert(): void;
|
|
470
|
-
export function
|
|
474
|
+
export function TESTING_ChatServiceInactiveErrorConvert(): void;
|
|
475
|
+
export function TESTING_ChatServiceResponseAndDebugInfoConvert(): ResponseAndDebugInfo;
|
|
476
|
+
export function TESTING_ChatServiceResponseConvert(bodyPresent: boolean): ChatResponse;
|
|
471
477
|
export function TESTING_ErrorOnBorrowAsync(_input: null): Promise<void>;
|
|
472
478
|
export function TESTING_ErrorOnBorrowIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _input: null): Promise<void>;
|
|
473
479
|
export function TESTING_ErrorOnBorrowSync(_input: null): void;
|
package/dist/Errors.d.ts
CHANGED
|
@@ -22,15 +22,18 @@ export declare enum ErrorCode {
|
|
|
22
22
|
BadDiscriminatorCharacter = 18,
|
|
23
23
|
DiscriminatorTooLarge = 19,
|
|
24
24
|
IoError = 20,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
CdsiInvalidToken = 21,
|
|
26
|
+
InvalidUri = 22,
|
|
27
|
+
InvalidMediaInput = 23,
|
|
28
|
+
UnsupportedMediaInput = 24,
|
|
29
|
+
InputDataTooLong = 25,
|
|
30
|
+
InvalidEntropyDataLength = 26,
|
|
31
|
+
InvalidUsernameLinkEncryptedData = 27,
|
|
32
|
+
RateLimitedError = 28,
|
|
33
|
+
SvrDataMissing = 29,
|
|
34
|
+
SvrRequestFailed = 30,
|
|
35
|
+
SvrRestoreFailed = 31,
|
|
36
|
+
ChatServiceInactive = 32
|
|
34
37
|
}
|
|
35
38
|
export declare class LibSignalErrorBase extends Error {
|
|
36
39
|
readonly code: ErrorCode;
|
|
@@ -115,6 +118,12 @@ export type InvalidUsernameLinkEncryptedData = LibSignalErrorCommon & {
|
|
|
115
118
|
export type IoError = LibSignalErrorCommon & {
|
|
116
119
|
code: ErrorCode.IoError;
|
|
117
120
|
};
|
|
121
|
+
export type CdsiInvalidTokenError = LibSignalErrorCommon & {
|
|
122
|
+
code: ErrorCode.CdsiInvalidToken;
|
|
123
|
+
};
|
|
124
|
+
export type InvalidUriError = LibSignalErrorCommon & {
|
|
125
|
+
code: ErrorCode.InvalidUri;
|
|
126
|
+
};
|
|
118
127
|
export type InvalidMediaInputError = LibSignalErrorCommon & {
|
|
119
128
|
code: ErrorCode.InvalidMediaInput;
|
|
120
129
|
};
|
|
@@ -125,6 +134,9 @@ export type RateLimitedError = LibSignalErrorBase & {
|
|
|
125
134
|
code: ErrorCode.RateLimitedError;
|
|
126
135
|
readonly retryAfterSecs: number;
|
|
127
136
|
};
|
|
137
|
+
export type ChatServiceInactive = LibSignalErrorBase & {
|
|
138
|
+
code: ErrorCode.ChatServiceInactive;
|
|
139
|
+
};
|
|
128
140
|
export type SvrDataMissingError = LibSignalErrorBase & {
|
|
129
141
|
code: ErrorCode.SvrDataMissing;
|
|
130
142
|
};
|
|
@@ -134,4 +146,4 @@ export type SvrRequestFailedError = LibSignalErrorCommon & {
|
|
|
134
146
|
export type SvrRestoreFailedError = LibSignalErrorCommon & {
|
|
135
147
|
code: ErrorCode.SvrRestoreFailed;
|
|
136
148
|
};
|
|
137
|
-
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 | InvalidMediaInputError | SvrDataMissingError | SvrRestoreFailedError | SvrRequestFailedError | UnsupportedMediaInputError;
|
|
149
|
+
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;
|
package/dist/Errors.js
CHANGED
|
@@ -29,15 +29,18 @@ var ErrorCode;
|
|
|
29
29
|
ErrorCode[ErrorCode["BadDiscriminatorCharacter"] = 18] = "BadDiscriminatorCharacter";
|
|
30
30
|
ErrorCode[ErrorCode["DiscriminatorTooLarge"] = 19] = "DiscriminatorTooLarge";
|
|
31
31
|
ErrorCode[ErrorCode["IoError"] = 20] = "IoError";
|
|
32
|
-
ErrorCode[ErrorCode["
|
|
33
|
-
ErrorCode[ErrorCode["
|
|
34
|
-
ErrorCode[ErrorCode["
|
|
35
|
-
ErrorCode[ErrorCode["
|
|
36
|
-
ErrorCode[ErrorCode["
|
|
37
|
-
ErrorCode[ErrorCode["
|
|
38
|
-
ErrorCode[ErrorCode["
|
|
39
|
-
ErrorCode[ErrorCode["
|
|
40
|
-
ErrorCode[ErrorCode["
|
|
32
|
+
ErrorCode[ErrorCode["CdsiInvalidToken"] = 21] = "CdsiInvalidToken";
|
|
33
|
+
ErrorCode[ErrorCode["InvalidUri"] = 22] = "InvalidUri";
|
|
34
|
+
ErrorCode[ErrorCode["InvalidMediaInput"] = 23] = "InvalidMediaInput";
|
|
35
|
+
ErrorCode[ErrorCode["UnsupportedMediaInput"] = 24] = "UnsupportedMediaInput";
|
|
36
|
+
ErrorCode[ErrorCode["InputDataTooLong"] = 25] = "InputDataTooLong";
|
|
37
|
+
ErrorCode[ErrorCode["InvalidEntropyDataLength"] = 26] = "InvalidEntropyDataLength";
|
|
38
|
+
ErrorCode[ErrorCode["InvalidUsernameLinkEncryptedData"] = 27] = "InvalidUsernameLinkEncryptedData";
|
|
39
|
+
ErrorCode[ErrorCode["RateLimitedError"] = 28] = "RateLimitedError";
|
|
40
|
+
ErrorCode[ErrorCode["SvrDataMissing"] = 29] = "SvrDataMissing";
|
|
41
|
+
ErrorCode[ErrorCode["SvrRequestFailed"] = 30] = "SvrRequestFailed";
|
|
42
|
+
ErrorCode[ErrorCode["SvrRestoreFailed"] = 31] = "SvrRestoreFailed";
|
|
43
|
+
ErrorCode[ErrorCode["ChatServiceInactive"] = 32] = "ChatServiceInactive";
|
|
41
44
|
})(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {}));
|
|
42
45
|
class LibSignalErrorBase extends Error {
|
|
43
46
|
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.43.0, libsignal-jni 0.43.0, libsignal-message-backup 0.1.0, libsignal-message-backup-macros 0.1.0, libsignal-net 0.1.0, libsignal-node 0.43.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
|
package/dist/net.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ export type CDSRequestOptionsType = {
|
|
|
15
15
|
aci: string;
|
|
16
16
|
accessKey: string;
|
|
17
17
|
}>;
|
|
18
|
-
timeout: number;
|
|
19
18
|
returnAcisWithoutUaks: boolean;
|
|
20
19
|
};
|
|
21
20
|
export type CDSResponseEntryType<Aci, Pni> = {
|
|
@@ -43,13 +42,50 @@ export declare class Net {
|
|
|
43
42
|
*/
|
|
44
43
|
svr3: Svr3Client;
|
|
45
44
|
constructor(env: Environment);
|
|
45
|
+
/**
|
|
46
|
+
* Initiates termination of the underlying connection to the Chat Service. After the service is
|
|
47
|
+
* disconnected, it will not attempt to automatically reconnect until you call
|
|
48
|
+
* {@link Net#connectAuthenticatedChatService} and/or {@link Net#connectUnauthenticatedChatService}.
|
|
49
|
+
*
|
|
50
|
+
* Note: the same instance of {@code ChatService} can be reused after {@code disconnect()} was
|
|
51
|
+
* called.
|
|
52
|
+
*/
|
|
46
53
|
disconnectChatService(): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Initiates establishing of the underlying unauthenticated connection to the Chat Service. Once
|
|
56
|
+
* the service is connected, all the requests will be using the established connection. Also, if
|
|
57
|
+
* the connection is lost for any reason other than the call to {@link #disconnect()}, an
|
|
58
|
+
* automatic reconnect attempt will be made.
|
|
59
|
+
*/
|
|
60
|
+
connectUnauthenticatedChatService(): Promise<Native.ChatServiceDebugInfo>;
|
|
61
|
+
/**
|
|
62
|
+
* Initiates establishing of the underlying authenticated connection to the Chat Service. Once the
|
|
63
|
+
* service is connected, all the requests will be using the established connection. Also, if the
|
|
64
|
+
* connection is lost for any reason other than the call to {@link #disconnect()}, an automatic
|
|
65
|
+
* reconnect attempt will be made.
|
|
66
|
+
*
|
|
67
|
+
* Calling this method will result in starting to accept incoming requests from the Chat Service.
|
|
68
|
+
*/
|
|
69
|
+
connectAuthenticatedChatService(): Promise<Native.ChatServiceDebugInfo>;
|
|
70
|
+
/**
|
|
71
|
+
* Sends request to the Chat Service over an unauthenticated channel.
|
|
72
|
+
*
|
|
73
|
+
* In addition to the response, an object containing debug information about the request flow is
|
|
74
|
+
* returned.
|
|
75
|
+
*
|
|
76
|
+
* @throws {ChatServiceInactive} if you haven't called {@link Net#connectUnauthenticatedChatService()}.
|
|
77
|
+
*/
|
|
47
78
|
unauthenticatedFetchAndDebug(chatRequest: ChatRequest): Promise<Native.ResponseAndDebugInfo>;
|
|
48
|
-
|
|
79
|
+
/**
|
|
80
|
+
* Sends request to the Chat Service over an unauthenticated channel.
|
|
81
|
+
*
|
|
82
|
+
* @throws {ChatServiceInactive} if you haven't called {@link Net#connectUnauthenticatedChatService()}.
|
|
83
|
+
*/
|
|
84
|
+
unauthenticatedFetch(chatRequest: ChatRequest): Promise<Native.ChatResponse>;
|
|
49
85
|
static buildHttpRequest(chatRequest: ChatRequest): {
|
|
50
86
|
_nativeHandle: Native.HttpRequest;
|
|
51
87
|
};
|
|
52
|
-
cdsiLookup({ username, password }: Readonly<ServiceAuth>, { e164s, acisAndAccessKeys,
|
|
88
|
+
cdsiLookup({ username, password }: Readonly<ServiceAuth>, { e164s, acisAndAccessKeys, returnAcisWithoutUaks, }: ReadonlyDeep<CDSRequestOptionsType>): Promise<CDSResponseType<string, string>>;
|
|
53
89
|
}
|
|
54
90
|
/**
|
|
55
91
|
* This interface provides functionality for communicating with SVR3
|
|
@@ -67,8 +103,8 @@ export declare class Net {
|
|
|
67
103
|
* // Instantiate ServiceAuth with the username and password obtained from the Chat Server.
|
|
68
104
|
* const auth = { username: USERNAME, password: ENCLAVE_PASSWORD };
|
|
69
105
|
* // Store a value in SVR3. Here 10 is the number of permitted restore attempts.
|
|
70
|
-
* const shareSet = await SVR3.backup(SECRET_TO_BE_STORED, PASSWORD, 10, auth
|
|
71
|
-
* const restoredSecret = await SVR3.restore( PASSWORD, shareSet, auth
|
|
106
|
+
* const shareSet = await SVR3.backup(SECRET_TO_BE_STORED, PASSWORD, 10, auth);
|
|
107
|
+
* const restoredSecret = await SVR3.restore( PASSWORD, shareSet, auth);
|
|
72
108
|
* ```
|
|
73
109
|
*/
|
|
74
110
|
export interface Svr3Client {
|
|
@@ -89,8 +125,6 @@ export interface Svr3Client {
|
|
|
89
125
|
* generally good for about 15 minutes, therefore it can be reused for the
|
|
90
126
|
* subsequent calls to either backup or restore that are not too far apart in
|
|
91
127
|
* time.
|
|
92
|
-
* @param opTimeoutMs - The maximum wall time libsignal is allowed to spend
|
|
93
|
-
* communicating with SVR3 service.
|
|
94
128
|
* @returns A `Promise` which--when awaited--will return a byte array with a
|
|
95
129
|
* serialized masked share set. It is supposed to be an opaque blob for the
|
|
96
130
|
* clients and therefore no assumptions should be made about its contents.
|
|
@@ -98,15 +132,16 @@ export interface Svr3Client {
|
|
|
98
132
|
* secret along with the password. Please note that masked share set does not
|
|
99
133
|
* have to be treated as secret.
|
|
100
134
|
*
|
|
101
|
-
* The returned `Promise` can also fail due to the network issues (including
|
|
102
|
-
* timeout), problems establishing the Noise connection to the
|
|
103
|
-
* invalid arguments' values. {@link IoError} errors can, in
|
|
104
|
-
* retried, although there is already a retry-with-backoff
|
|
105
|
-
* libsignal used to connect to the SVR3 servers. Other
|
|
106
|
-
* by the bad input or data missing on the server. They
|
|
107
|
-
* non-actionable and are guaranteed to be thrown again when
|
|
135
|
+
* The returned `Promise` can also fail due to the network issues (including a
|
|
136
|
+
* connection timeout), problems establishing the Noise connection to the
|
|
137
|
+
* enclaves, or invalid arguments' values. {@link IoError} errors can, in
|
|
138
|
+
* general, be retried, although there is already a retry-with-backoff
|
|
139
|
+
* mechanism inside libsignal used to connect to the SVR3 servers. Other
|
|
140
|
+
* exceptions are caused by the bad input or data missing on the server. They
|
|
141
|
+
* are therefore non-actionable and are guaranteed to be thrown again when
|
|
142
|
+
* retried.
|
|
108
143
|
*/
|
|
109
|
-
backup(what: Buffer, password: string, maxTries: number, auth: Readonly<ServiceAuth
|
|
144
|
+
backup(what: Buffer, password: string, maxTries: number, auth: Readonly<ServiceAuth>): Promise<Buffer>;
|
|
110
145
|
/**
|
|
111
146
|
* Restore a secret from SVR3.
|
|
112
147
|
*
|
|
@@ -122,18 +157,17 @@ export interface Svr3Client {
|
|
|
122
157
|
* generally good for about 15 minutes, therefore it can be reused for the
|
|
123
158
|
* subsequent calls to either backup or restore that are not too far apart in
|
|
124
159
|
* time.
|
|
125
|
-
* @param opTimeoutMs - The maximum wall time libsignal is allowed to spend
|
|
126
|
-
* communicating with SVR3 service.
|
|
127
160
|
* @returns A `Promise` which--when awaited--will return a byte array with the
|
|
128
161
|
* restored secret.
|
|
129
162
|
*
|
|
130
|
-
* The returned `Promise` can also fail due to the network issues (including
|
|
131
|
-
* timeout), problems establishing the Noise connection to the
|
|
132
|
-
* invalid arguments' values. {@link IoError} errors can, in
|
|
133
|
-
* retried, although there is already a retry-with-backoff
|
|
134
|
-
* libsignal used to connect to the SVR3 servers. Other
|
|
135
|
-
* by the bad input or data missing on the server. They
|
|
136
|
-
* non-actionable and are guaranteed to be thrown again when
|
|
163
|
+
* The returned `Promise` can also fail due to the network issues (including
|
|
164
|
+
* the connection timeout), problems establishing the Noise connection to the
|
|
165
|
+
* enclaves, or invalid arguments' values. {@link IoError} errors can, in
|
|
166
|
+
* general, be retried, although there is already a retry-with-backoff
|
|
167
|
+
* mechanism inside libsignal used to connect to the SVR3 servers. Other
|
|
168
|
+
* exceptions are caused by the bad input or data missing on the server. They
|
|
169
|
+
* are therefore non-actionable and are guaranteed to be thrown again when
|
|
170
|
+
* retried.
|
|
137
171
|
*
|
|
138
172
|
* - {@link SvrDataMissingError} is returned when the maximum restore attempts
|
|
139
173
|
* number has been exceeded or if the value has never been backed up.
|
|
@@ -144,5 +178,5 @@ export interface Svr3Client {
|
|
|
144
178
|
* masked share set fails, or when the server requests fail for reasons
|
|
145
179
|
* other than "maximum attempts exceeded".
|
|
146
180
|
*/
|
|
147
|
-
restore(password: string, shareSet: Buffer, auth: Readonly<ServiceAuth
|
|
181
|
+
restore(password: string, shareSet: Buffer, auth: Readonly<ServiceAuth>): Promise<Buffer>;
|
|
148
182
|
}
|
package/dist/net.js
CHANGED
|
@@ -25,12 +25,53 @@ class Net {
|
|
|
25
25
|
};
|
|
26
26
|
this.svr3 = new Svr3ClientImpl(this._asyncContext, this._connectionManager);
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Initiates termination of the underlying connection to the Chat Service. After the service is
|
|
30
|
+
* disconnected, it will not attempt to automatically reconnect until you call
|
|
31
|
+
* {@link Net#connectAuthenticatedChatService} and/or {@link Net#connectUnauthenticatedChatService}.
|
|
32
|
+
*
|
|
33
|
+
* Note: the same instance of {@code ChatService} can be reused after {@code disconnect()} was
|
|
34
|
+
* called.
|
|
35
|
+
*/
|
|
28
36
|
async disconnectChatService() {
|
|
29
37
|
await Native.ChatService_disconnect(this._asyncContext, this._chatService);
|
|
30
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Initiates establishing of the underlying unauthenticated connection to the Chat Service. Once
|
|
41
|
+
* the service is connected, all the requests will be using the established connection. Also, if
|
|
42
|
+
* the connection is lost for any reason other than the call to {@link #disconnect()}, an
|
|
43
|
+
* automatic reconnect attempt will be made.
|
|
44
|
+
*/
|
|
45
|
+
async connectUnauthenticatedChatService() {
|
|
46
|
+
return await Native.ChatService_connect_unauth(this._asyncContext, this._chatService);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Initiates establishing of the underlying authenticated connection to the Chat Service. Once the
|
|
50
|
+
* service is connected, all the requests will be using the established connection. Also, if the
|
|
51
|
+
* connection is lost for any reason other than the call to {@link #disconnect()}, an automatic
|
|
52
|
+
* reconnect attempt will be made.
|
|
53
|
+
*
|
|
54
|
+
* Calling this method will result in starting to accept incoming requests from the Chat Service.
|
|
55
|
+
*/
|
|
56
|
+
async connectAuthenticatedChatService() {
|
|
57
|
+
return await Native.ChatService_connect_auth(this._asyncContext, this._chatService);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Sends request to the Chat Service over an unauthenticated channel.
|
|
61
|
+
*
|
|
62
|
+
* In addition to the response, an object containing debug information about the request flow is
|
|
63
|
+
* returned.
|
|
64
|
+
*
|
|
65
|
+
* @throws {ChatServiceInactive} if you haven't called {@link Net#connectUnauthenticatedChatService()}.
|
|
66
|
+
*/
|
|
31
67
|
async unauthenticatedFetchAndDebug(chatRequest) {
|
|
32
68
|
return await Native.ChatService_unauth_send_and_debug(this._asyncContext, this._chatService, Net.buildHttpRequest(chatRequest), chatRequest.timeoutMillis ?? DEFAULT_CHAT_REQUEST_TIMEOUT_MILLIS);
|
|
33
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Sends request to the Chat Service over an unauthenticated channel.
|
|
72
|
+
*
|
|
73
|
+
* @throws {ChatServiceInactive} if you haven't called {@link Net#connectUnauthenticatedChatService()}.
|
|
74
|
+
*/
|
|
34
75
|
async unauthenticatedFetch(chatRequest) {
|
|
35
76
|
return await Native.ChatService_unauth_send(this._asyncContext, this._chatService, Net.buildHttpRequest(chatRequest), chatRequest.timeoutMillis ?? DEFAULT_CHAT_REQUEST_TIMEOUT_MILLIS);
|
|
36
77
|
}
|
|
@@ -46,7 +87,7 @@ class Net {
|
|
|
46
87
|
});
|
|
47
88
|
return httpRequest;
|
|
48
89
|
}
|
|
49
|
-
async cdsiLookup({ username, password }, { e164s, acisAndAccessKeys,
|
|
90
|
+
async cdsiLookup({ username, password }, { e164s, acisAndAccessKeys, returnAcisWithoutUaks, }) {
|
|
50
91
|
const request = { _nativeHandle: Native.LookupRequest_new() };
|
|
51
92
|
e164s.forEach((e164) => {
|
|
52
93
|
Native.LookupRequest_addE164(request, e164);
|
|
@@ -55,7 +96,7 @@ class Net {
|
|
|
55
96
|
Native.LookupRequest_addAciAndAccessKey(request, Address_1.Aci.parseFromServiceIdString(aciStr).getServiceIdFixedWidthBinary(), Buffer.from(accessKeyStr, 'base64'));
|
|
56
97
|
});
|
|
57
98
|
Native.LookupRequest_setReturnAcisWithoutUaks(request, returnAcisWithoutUaks);
|
|
58
|
-
const lookup = await Native.CdsiLookup_new(this._asyncContext, this._connectionManager, username, password, request
|
|
99
|
+
const lookup = await Native.CdsiLookup_new(this._asyncContext, this._connectionManager, username, password, request);
|
|
59
100
|
return await Native.CdsiLookup_complete(this._asyncContext, {
|
|
60
101
|
_nativeHandle: lookup,
|
|
61
102
|
});
|
|
@@ -67,11 +108,11 @@ class Svr3ClientImpl {
|
|
|
67
108
|
this._asyncContext = _asyncContext;
|
|
68
109
|
this._connectionManager = _connectionManager;
|
|
69
110
|
}
|
|
70
|
-
async backup(what, password, maxTries, auth
|
|
71
|
-
return Native.Svr3Backup(this._asyncContext, this._connectionManager, what, password, maxTries, auth.username, auth.password
|
|
111
|
+
async backup(what, password, maxTries, auth) {
|
|
112
|
+
return Native.Svr3Backup(this._asyncContext, this._connectionManager, what, password, maxTries, auth.username, auth.password);
|
|
72
113
|
}
|
|
73
|
-
async restore(password, shareSet, auth
|
|
74
|
-
return Native.Svr3Restore(this._asyncContext, this._connectionManager, password, shareSet, auth.username, auth.password
|
|
114
|
+
async restore(password, shareSet, auth) {
|
|
115
|
+
return Native.Svr3Restore(this._asyncContext, this._connectionManager, password, shareSet, auth.username, auth.password);
|
|
75
116
|
}
|
|
76
117
|
}
|
|
77
118
|
//# sourceMappingURL=net.js.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const UNCHECKED_AND_UNCLONED: unique symbol;
|
|
3
3
|
export default class ByteArray {
|
|
4
4
|
contents: Buffer;
|
|
5
|
-
constructor(contents: Buffer, checkValid: ((contents: Buffer) => void) | typeof UNCHECKED_AND_UNCLONED);
|
|
5
|
+
protected constructor(contents: Buffer, checkValid: ((contents: Buffer) => void) | typeof UNCHECKED_AND_UNCLONED);
|
|
6
6
|
protected static checkLength(expectedLength: number): (contents: Buffer) => void;
|
|
7
7
|
getContents(): Buffer;
|
|
8
8
|
serialize(): Buffer;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.UNCHECKED_AND_UNCLONED = void 0;
|
|
8
8
|
const Errors_1 = require("../../Errors");
|
|
9
|
+
const Native = require("../../../Native");
|
|
9
10
|
exports.UNCHECKED_AND_UNCLONED = Symbol();
|
|
10
11
|
class ByteArray {
|
|
11
12
|
constructor(contents, checkValid) {
|
|
@@ -13,7 +14,7 @@ class ByteArray {
|
|
|
13
14
|
this.contents = contents;
|
|
14
15
|
}
|
|
15
16
|
else {
|
|
16
|
-
checkValid(contents);
|
|
17
|
+
checkValid.call(Native, contents);
|
|
17
18
|
this.contents = Buffer.from(contents);
|
|
18
19
|
}
|
|
19
20
|
}
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|