@signalapp/libsignal-client 0.46.1 → 0.47.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
@@ -407,6 +407,7 @@ export function ServerCertificate_GetKeyId(obj: Wrapper<ServerCertificate>): num
407
407
  export function ServerCertificate_GetSerialized(obj: Wrapper<ServerCertificate>): Buffer;
408
408
  export function ServerCertificate_GetSignature(obj: Wrapper<ServerCertificate>): Buffer;
409
409
  export function ServerCertificate_New(keyId: number, serverKey: Wrapper<PublicKey>, trustRoot: Wrapper<PrivateKey>): ServerCertificate;
410
+ export function ServerMessageAck_Send(asyncRuntime: Wrapper<TokioAsyncContext>, ack: Wrapper<ServerMessageAck>): Promise<void>;
410
411
  export function ServerPublicParams_CreateAuthCredentialWithPniPresentationDeterministic(serverPublicParams: Wrapper<ServerPublicParams>, randomness: Buffer, groupSecretParams: Serialized<GroupSecretParams>, authCredentialWithPniBytes: Buffer): Buffer;
411
412
  export function ServerPublicParams_CreateExpiringProfileKeyCredentialPresentationDeterministic(serverPublicParams: Wrapper<ServerPublicParams>, randomness: Buffer, groupSecretParams: Serialized<GroupSecretParams>, profileKeyCredential: Serialized<ExpiringProfileKeyCredential>): Buffer;
412
413
  export function ServerPublicParams_CreateProfileKeyCredentialRequestContextDeterministic(serverPublicParams: Wrapper<ServerPublicParams>, randomness: Buffer, userId: Buffer, profileKey: Serialized<ProfileKey>): Serialized<ProfileKeyCredentialRequestContext>;
@@ -467,6 +468,7 @@ export function SignedPreKeyRecord_GetTimestamp(obj: Wrapper<SignedPreKeyRecord>
467
468
  export function SignedPreKeyRecord_New(id: number, timestamp: Timestamp, pubKey: Wrapper<PublicKey>, privKey: Wrapper<PrivateKey>, signature: Buffer): SignedPreKeyRecord;
468
469
  export function SignedPreKeyRecord_Serialize(obj: Wrapper<SignedPreKeyRecord>): Buffer;
469
470
  export function Svr3Backup(asyncRuntime: Wrapper<TokioAsyncContext>, connectionManager: Wrapper<ConnectionManager>, secret: Buffer, password: string, maxTries: number, username: string, enclavePassword: string): Promise<Buffer>;
471
+ export function Svr3Remove(asyncRuntime: Wrapper<TokioAsyncContext>, connectionManager: Wrapper<ConnectionManager>, username: string, enclavePassword: string): Promise<void>;
470
472
  export function Svr3Restore(asyncRuntime: Wrapper<TokioAsyncContext>, connectionManager: Wrapper<ConnectionManager>, password: string, shareSet: Buffer, username: string, enclavePassword: string): Promise<Buffer>;
471
473
  export function TESTING_CdsiLookupErrorConvert(errorDescription: string): void;
472
474
  export function TESTING_CdsiLookupResponseConvert(asyncRuntime: Wrapper<TokioAsyncContext>): Promise<LookupResponse>;
@@ -479,6 +481,7 @@ export function TESTING_ChatServiceErrorConvert(): void;
479
481
  export function TESTING_ChatServiceInactiveErrorConvert(): void;
480
482
  export function TESTING_ChatServiceResponseAndDebugInfoConvert(): ResponseAndDebugInfo;
481
483
  export function TESTING_ChatServiceResponseConvert(bodyPresent: boolean): ChatResponse;
484
+ export function TESTING_ChatService_InjectRawServerRequest(chat: Wrapper<Chat>, bytes: Buffer): void;
482
485
  export function TESTING_ErrorOnBorrowAsync(_input: null): Promise<void>;
483
486
  export function TESTING_ErrorOnBorrowIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _input: null): Promise<void>;
484
487
  export function TESTING_ErrorOnBorrowSync(_input: null): void;
@@ -490,6 +493,7 @@ export function TESTING_FutureProducesOtherPointerType(asyncRuntime: Wrapper<Non
490
493
  export function TESTING_FutureProducesPointerType(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, input: number): Promise<TestingHandleType>;
491
494
  export function TESTING_FutureSuccess(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, input: number): Promise<number>;
492
495
  export function TESTING_NonSuspendingBackgroundThreadRuntime_New(): NonSuspendingBackgroundThreadRuntime;
496
+ export function TESTING_OnlyCompletesByCancellation(asyncRuntime: Wrapper<TokioAsyncContext>): Promise<void>;
493
497
  export function TESTING_OtherTestingHandleType_getValue(handle: Wrapper<OtherTestingHandleType>): string;
494
498
  export function TESTING_PanicInBodyAsync(_input: null): Promise<void>;
495
499
  export function TESTING_PanicInBodyIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _input: null): Promise<void>;
@@ -506,6 +510,7 @@ export function TESTING_PanicOnReturnSync(_needsCleanup: null): null;
506
510
  export function TESTING_ProcessBytestringArray(input: Buffer[]): Buffer[];
507
511
  export function TESTING_ReturnStringArray(): string[];
508
512
  export function TESTING_TestingHandleType_getValue(handle: Wrapper<TestingHandleType>): number;
513
+ export function TokioAsyncContext_cancel(context: Wrapper<TokioAsyncContext>, rawCancellationId: bigint): void;
509
514
  export function TokioAsyncContext_new(): TokioAsyncContext;
510
515
  export function UnidentifiedSenderMessageContent_Deserialize(data: Buffer): UnidentifiedSenderMessageContent;
511
516
  export function UnidentifiedSenderMessageContent_GetContentHint(m: Wrapper<UnidentifiedSenderMessageContent>): number;
@@ -575,6 +580,7 @@ interface SenderKeyDistributionMessage { readonly __type: unique symbol; }
575
580
  interface SenderKeyMessage { readonly __type: unique symbol; }
576
581
  interface SenderKeyRecord { readonly __type: unique symbol; }
577
582
  interface ServerCertificate { readonly __type: unique symbol; }
583
+ interface ServerMessageAck { readonly __type: unique symbol; }
578
584
  interface ServerPublicParams { readonly __type: unique symbol; }
579
585
  interface ServerSecretParams { readonly __type: unique symbol; }
580
586
  interface SessionRecord { readonly __type: unique symbol; }
package/dist/Errors.d.ts CHANGED
@@ -145,5 +145,6 @@ export type SvrRequestFailedError = LibSignalErrorCommon & {
145
145
  };
146
146
  export type SvrRestoreFailedError = LibSignalErrorCommon & {
147
147
  code: ErrorCode.SvrRestoreFailed;
148
+ readonly triesRemaining: number;
148
149
  };
149
150
  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;
@@ -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.46.1, libsignal-jni 0.46.1, libsignal-message-backup 0.1.0, libsignal-message-backup-io 0.1.0, libsignal-message-backup-macros 0.1.0, libsignal-net 0.1.0, libsignal-node 0.46.1, 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
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.47.0, libsignal-jni 0.47.0, libsignal-message-backup 0.1.0, libsignal-message-backup-macros 0.1.0, libsignal-net 0.1.0, libsignal-node 0.47.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
@@ -6830,6 +6830,39 @@ SOFTWARE.
6830
6830
 
6831
6831
  ```
6832
6832
 
6833
+ ## atomic-take 1.1.0
6834
+
6835
+ ```
6836
+ The MIT License (MIT)
6837
+
6838
+ Copyright (c) 2019 Alice Ryhl
6839
+
6840
+ Permission is hereby granted, free of charge, to any
6841
+ person obtaining a copy of this software and associated
6842
+ documentation files (the "Software"), to deal in the
6843
+ Software without restriction, including without
6844
+ limitation the rights to use, copy, modify, merge,
6845
+ publish, distribute, sublicense, and/or sell copies of
6846
+ the Software, and to permit persons to whom the Software
6847
+ is furnished to do so, subject to the following
6848
+ conditions:
6849
+
6850
+ The above copyright notice and this permission notice
6851
+ shall be included in all copies or substantial portions
6852
+ of the Software.
6853
+
6854
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
6855
+ ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
6856
+ TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
6857
+ PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
6858
+ SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
6859
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
6860
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
6861
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
6862
+ DEALINGS IN THE SOFTWARE.
6863
+
6864
+ ```
6865
+
6833
6866
  ## crossbeam-deque 0.8.5, crossbeam-epoch 0.9.18, crossbeam-utils 0.8.19
6834
6867
 
6835
6868
  ```
package/dist/net.d.ts CHANGED
@@ -170,8 +170,7 @@ export interface Svr3Client {
170
170
  /**
171
171
  * Backup a secret to SVR3.
172
172
  *
173
- * Error messages are expected to be log-safe and not contain any sensitive
174
- * data.
173
+ * Error messages are log-safe and do not contain any sensitive data.
175
174
  *
176
175
  * @param what - The secret to be stored. Must be 32 bytes long.
177
176
  * @param password - User-provided password that will be used to derive the
@@ -204,8 +203,7 @@ export interface Svr3Client {
204
203
  /**
205
204
  * Restore a secret from SVR3.
206
205
  *
207
- * Error messages are expected to be log-safe and not contain any sensitive
208
- * data.
206
+ * Error messages are log-safe and do not contain any sensitive data.
209
207
  *
210
208
  * @param password - User-provided password that will be used to derive the
211
209
  * decryption key for the secret.
@@ -216,8 +214,8 @@ export interface Svr3Client {
216
214
  * generally good for about 15 minutes, therefore it can be reused for the
217
215
  * subsequent calls to either backup or restore that are not too far apart in
218
216
  * time.
219
- * @returns A `Promise` which--when awaited--will return a byte array with the
220
- * restored secret.
217
+ * @returns A `Promise` which--when awaited--will return a
218
+ * {@link RestoredSecret} object, containing the restored secret.
221
219
  *
222
220
  * The returned `Promise` can also fail due to the network issues (including
223
221
  * the connection timeout), problems establishing the Noise connection to the
@@ -237,6 +235,41 @@ export interface Svr3Client {
237
235
  * masked share set fails, or when the server requests fail for reasons
238
236
  * other than "maximum attempts exceeded".
239
237
  */
240
- restore(password: string, shareSet: Buffer, auth: Readonly<ServiceAuth>): Promise<Buffer>;
238
+ restore(password: string, shareSet: Buffer, auth: Readonly<ServiceAuth>): Promise<RestoredSecret>;
239
+ /**
240
+ * Remove a value stored in SVR3.
241
+ *
242
+ * This method will succeed even if the data has never been backed up in the
243
+ * first place.
244
+ *
245
+ * Error messages are log-safe and do not contain any sensitive data.
246
+ *
247
+ * @param auth - An instance of {@link ServiceAuth} containing the username
248
+ * and password obtained from the Chat Server. The password is an OTP which is
249
+ * generally good for about 15 minutes, therefore it can be reused for the
250
+ * subsequent calls to either backup or restore that are not too far apart in
251
+ * time.
252
+ * @returns A `Promise` successful completion of which will mean the data has
253
+ * been removed.
254
+ *
255
+ * The returned `Promise` can also fail due to the network issues (including
256
+ * the connection timeout), problems establishing the Noise connection to the
257
+ * enclaves, or invalid arguments' values. {@link IoError} errors can, in
258
+ * general, be retried, although there is already a retry-with-backoff
259
+ * mechanism inside libsignal used to connect to the SVR3 servers. Other
260
+ * exceptions are caused by the bad input or data missing on the server. They
261
+ * are therefore non-actionable and are guaranteed to be thrown again when
262
+ * retried.
263
+ */
264
+ remove(auth: Readonly<ServiceAuth>): Promise<void>;
265
+ }
266
+ /**
267
+ * A simple data class containing the secret restored from SVR3 as well as the
268
+ * number of restore attempts remaining.
269
+ */
270
+ export declare class RestoredSecret {
271
+ readonly triesRemaining: number;
272
+ readonly value: Buffer;
273
+ constructor(serialized: Buffer);
241
274
  }
242
275
  export {};
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.ChatService = exports.Environment = void 0;
7
+ exports.RestoredSecret = exports.Net = exports.ChatService = 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;
@@ -172,6 +172,17 @@ class Net {
172
172
  }
173
173
  }
174
174
  exports.Net = Net;
175
+ /**
176
+ * A simple data class containing the secret restored from SVR3 as well as the
177
+ * number of restore attempts remaining.
178
+ */
179
+ class RestoredSecret {
180
+ constructor(serialized) {
181
+ this.triesRemaining = serialized.readInt32BE();
182
+ this.value = serialized.subarray(4);
183
+ }
184
+ }
185
+ exports.RestoredSecret = RestoredSecret;
175
186
  class Svr3ClientImpl {
176
187
  constructor(asyncContext, connectionManager) {
177
188
  this.asyncContext = asyncContext;
@@ -181,7 +192,11 @@ class Svr3ClientImpl {
181
192
  return Native.Svr3Backup(this.asyncContext, this.connectionManager, what, password, maxTries, auth.username, auth.password);
182
193
  }
183
194
  async restore(password, shareSet, auth) {
184
- return Native.Svr3Restore(this.asyncContext, this.connectionManager, password, shareSet, auth.username, auth.password);
195
+ const serialized = await Native.Svr3Restore(this.asyncContext, this.connectionManager, password, shareSet, auth.username, auth.password);
196
+ return new RestoredSecret(serialized);
197
+ }
198
+ async remove(auth) {
199
+ return Native.Svr3Remove(this.asyncContext, this.connectionManager, auth.username, auth.password);
185
200
  }
186
201
  }
187
202
  //# sourceMappingURL=net.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalapp/libsignal-client",
3
- "version": "0.46.1",
3
+ "version": "0.47.0",
4
4
  "license": "AGPL-3.0-only",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
Binary file
Binary file
Binary file