@signalapp/libsignal-client 0.52.1 → 0.52.4

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
@@ -192,6 +192,9 @@ export function ChatService_unauth_send_and_debug(asyncRuntime: Wrapper<TokioAsy
192
192
  export function CiphertextMessage_FromPlaintextContent(m: Wrapper<PlaintextContent>): CiphertextMessage;
193
193
  export function CiphertextMessage_Serialize(obj: Wrapper<CiphertextMessage>): Buffer;
194
194
  export function CiphertextMessage_Type(msg: Wrapper<CiphertextMessage>): number;
195
+ export function ComparableBackup_GetComparableString(backup: Wrapper<ComparableBackup>): string;
196
+ export function ComparableBackup_GetUnknownFields(backup: Wrapper<ComparableBackup>): string[];
197
+ export function ComparableBackup_ReadUnencrypted(stream: InputStream, len: bigint, purpose: number): Promise<ComparableBackup>;
195
198
  export function ConnectionManager_clear_proxy(connectionManager: Wrapper<ConnectionManager>): void;
196
199
  export function ConnectionManager_new(environment: number, userAgent: string): ConnectionManager;
197
200
  export function ConnectionManager_set_ipv6_enabled(connectionManager: Wrapper<ConnectionManager>, ipv6Enabled: boolean): void;
@@ -505,6 +508,7 @@ export function TESTING_FutureFailure(asyncRuntime: Wrapper<NonSuspendingBackgro
505
508
  export function TESTING_FutureProducesOtherPointerType(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, input: string): Promise<OtherTestingHandleType>;
506
509
  export function TESTING_FutureProducesPointerType(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, input: number): Promise<TestingHandleType>;
507
510
  export function TESTING_FutureSuccess(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, input: number): Promise<number>;
511
+ export function TESTING_InputStreamReadIntoZeroLengthSlice(capsAlphabetInput: InputStream): Promise<Buffer>;
508
512
  export function TESTING_NonSuspendingBackgroundThreadRuntime_New(): NonSuspendingBackgroundThreadRuntime;
509
513
  export function TESTING_OnlyCompletesByCancellation(asyncRuntime: Wrapper<TokioAsyncContext>): Promise<void>;
510
514
  export function TESTING_OtherTestingHandleType_getValue(handle: Wrapper<OtherTestingHandleType>): string;
@@ -547,10 +551,13 @@ export function ValidatingMac_Initialize(key: Buffer, chunkSize: number, digests
547
551
  export function ValidatingMac_Update(mac: Wrapper<ValidatingMac>, bytes: Buffer, offset: number, length: number): number;
548
552
  export function WebpSanitizer_Sanitize(input: SyncInputStream): void;
549
553
  export function initLogger(maxLevel: LogLevel, callback: (level: LogLevel, target: string, file: string | null, line: number | null, message: string) => void): void
554
+ export function test_only_fn_returns_123(): number;
550
555
  interface Aes256GcmSiv { readonly __type: unique symbol; }
551
556
  interface CdsiLookup { readonly __type: unique symbol; }
552
557
  interface Chat { readonly __type: unique symbol; }
553
558
  interface CiphertextMessage { readonly __type: unique symbol; }
559
+ interface ComparableBackup { readonly __type: unique symbol; }
560
+ interface ComparableBackup { readonly __type: unique symbol; }
554
561
  interface ConnectionManager { readonly __type: unique symbol; }
555
562
  interface DecryptionErrorMessage { readonly __type: unique symbol; }
556
563
  interface ExpiringProfileKeyCredential { readonly __type: unique symbol; }
package/dist/Errors.d.ts CHANGED
@@ -36,7 +36,8 @@ export declare enum ErrorCode {
36
36
  ChatServiceInactive = 32,
37
37
  AppExpired = 33,
38
38
  DeviceDelinked = 34,
39
- Cancelled = 35
39
+ BackupValidation = 35,
40
+ Cancelled = 36
40
41
  }
41
42
  export declare class LibSignalErrorBase extends Error {
42
43
  readonly code: ErrorCode;
@@ -156,6 +157,10 @@ export type SvrRestoreFailedError = LibSignalErrorCommon & {
156
157
  code: ErrorCode.SvrRestoreFailed;
157
158
  readonly triesRemaining: number;
158
159
  };
160
+ export type BackupValidationError = LibSignalErrorCommon & {
161
+ code: ErrorCode.BackupValidation;
162
+ readonly unknownFields: ReadonlyArray<string>;
163
+ };
159
164
  export type CancellationError = LibSignalErrorCommon & {
160
165
  code: ErrorCode.Cancelled;
161
166
  };
package/dist/Errors.js CHANGED
@@ -43,7 +43,8 @@ var ErrorCode;
43
43
  ErrorCode[ErrorCode["ChatServiceInactive"] = 32] = "ChatServiceInactive";
44
44
  ErrorCode[ErrorCode["AppExpired"] = 33] = "AppExpired";
45
45
  ErrorCode[ErrorCode["DeviceDelinked"] = 34] = "DeviceDelinked";
46
- ErrorCode[ErrorCode["Cancelled"] = 35] = "Cancelled";
46
+ ErrorCode[ErrorCode["BackupValidation"] = 35] = "BackupValidation";
47
+ ErrorCode[ErrorCode["Cancelled"] = 36] = "Cancelled";
47
48
  })(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {}));
48
49
  class LibSignalErrorBase extends Error {
49
50
  constructor(message, name, operation, extraProps) {
@@ -56,3 +56,47 @@ export declare enum Purpose {
56
56
  * @throws IoError If an IO error on the input occurs.
57
57
  */
58
58
  export declare function validate(backupKey: MessageBackupKey, purpose: Purpose, inputFactory: InputStreamFactory, length: bigint): Promise<ValidationOutcome>;
59
+ /**
60
+ * An in-memory representation of a backup file used to compare contents.
61
+ *
62
+ * When comparing the contents of two backups:
63
+ * 1. Create a `ComparableBackup` instance for each of the inputs.
64
+ * 2. Check the `unknownFields()` value; if it's not empty, some parts of the
65
+ * backup weren't parsed and won't be compared.
66
+ * 3. Produce a canonical string for each backup with `comparableString()`.
67
+ * 4. Compare the canonical string representations.
68
+ *
69
+ * The diff of the canonical strings (which may be rather large) will show the
70
+ * differences between the logical content of the input backup files.
71
+ */
72
+ export declare class ComparableBackup {
73
+ readonly _nativeHandle: Native.ComparableBackup;
74
+ constructor(handle: Native.ComparableBackup);
75
+ /**
76
+ * Read an unencrypted backup file into memory for comparison.
77
+ *
78
+ * @param purpose Whether the backup is intended for device-to-device transfer or remote storage.
79
+ * @param input An input stream that reads the backup contents.
80
+ * @param length The exact length of the input stream.
81
+ * @returns The in-memory representation.
82
+ * @throws BackupValidationError If an IO error occurs or the input is invalid.
83
+ */
84
+ static fromUnencrypted(purpose: Purpose, input: InputStream, length: bigint): Promise<ComparableBackup>;
85
+ /**
86
+ * Produces a string representation of the contents.
87
+ *
88
+ * The returned strings for two backups will be equal if the backups contain
89
+ * the same logical content. If two backups' strings are not equal, the diff
90
+ * will show what is different between them.
91
+ *
92
+ * @returns a canonical string representation of the backup
93
+ */
94
+ comparableString(): string;
95
+ /**
96
+ * Unrecognized protobuf fields present in the backup.
97
+ *
98
+ * If this is not empty, some parts of the backup were not recognized and
99
+ * won't be present in the string representation.
100
+ */
101
+ get unknownFields(): Array<string>;
102
+ }
@@ -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.validate = exports.Purpose = exports.MessageBackupKey = exports.ValidationOutcome = void 0;
7
+ exports.ComparableBackup = exports.validate = exports.Purpose = exports.MessageBackupKey = exports.ValidationOutcome = void 0;
8
8
  /**
9
9
  * Message backup validation routines.
10
10
  *
@@ -66,4 +66,57 @@ async function validate(backupKey, purpose, inputFactory, length) {
66
66
  return new ValidationOutcome(await Native.MessageBackupValidator_Validate(backupKey, firstStream, secondStream, length, purpose));
67
67
  }
68
68
  exports.validate = validate;
69
+ /**
70
+ * An in-memory representation of a backup file used to compare contents.
71
+ *
72
+ * When comparing the contents of two backups:
73
+ * 1. Create a `ComparableBackup` instance for each of the inputs.
74
+ * 2. Check the `unknownFields()` value; if it's not empty, some parts of the
75
+ * backup weren't parsed and won't be compared.
76
+ * 3. Produce a canonical string for each backup with `comparableString()`.
77
+ * 4. Compare the canonical string representations.
78
+ *
79
+ * The diff of the canonical strings (which may be rather large) will show the
80
+ * differences between the logical content of the input backup files.
81
+ */
82
+ class ComparableBackup {
83
+ constructor(handle) {
84
+ this._nativeHandle = handle;
85
+ }
86
+ /**
87
+ * Read an unencrypted backup file into memory for comparison.
88
+ *
89
+ * @param purpose Whether the backup is intended for device-to-device transfer or remote storage.
90
+ * @param input An input stream that reads the backup contents.
91
+ * @param length The exact length of the input stream.
92
+ * @returns The in-memory representation.
93
+ * @throws BackupValidationError If an IO error occurs or the input is invalid.
94
+ */
95
+ static async fromUnencrypted(purpose, input, length) {
96
+ const handle = await Native.ComparableBackup_ReadUnencrypted(input, length, purpose);
97
+ return new ComparableBackup(handle);
98
+ }
99
+ /**
100
+ * Produces a string representation of the contents.
101
+ *
102
+ * The returned strings for two backups will be equal if the backups contain
103
+ * the same logical content. If two backups' strings are not equal, the diff
104
+ * will show what is different between them.
105
+ *
106
+ * @returns a canonical string representation of the backup
107
+ */
108
+ comparableString() {
109
+ return Native.ComparableBackup_GetComparableString(this);
110
+ }
111
+ /**
112
+ * Unrecognized protobuf fields present in the backup.
113
+ *
114
+ * If this is not empty, some parts of the backup were not recognized and
115
+ * won't be present in the string representation.
116
+ */
117
+ get unknownFields() {
118
+ return Native.ComparableBackup_GetUnknownFields(this);
119
+ }
120
+ }
121
+ exports.ComparableBackup = ComparableBackup;
69
122
  //# sourceMappingURL=MessageBackup.js.map
@@ -669,7 +669,7 @@ For more information on this, and how to apply and follow the GNU AGPL, see
669
669
 
670
670
  ```
671
671
 
672
- ## attest 0.1.0, libsignal-ffi 0.52.0, libsignal-jni 0.52.0, libsignal-node 0.52.0, signal-neon-futures 0.1.0, signal-neon-futures-tests 0.1.0, libsignal-bridge 0.1.0, libsignal-bridge-macros 0.1.0, libsignal-bridge-types 0.1.0, libsignal-core 0.1.0, signal-crypto 0.1.0, device-transfer 0.1.0, signal-media 0.1.0, libsignal-message-backup 0.1.0, libsignal-message-backup-macros 0.1.0, libsignal-net 0.1.0, signal-pin 0.1.0, poksho 0.7.0, libsignal-protocol 0.1.0, libsignal-svr3 0.1.0, usernames 0.1.0, zkcredential 0.1.0, zkgroup 0.9.0
672
+ ## attest 0.1.0, libsignal-ffi 0.52.4, libsignal-jni 0.52.4, libsignal-jni-testing 0.52.4, libsignal-node 0.52.4, signal-neon-futures 0.1.0, signal-neon-futures-tests 0.1.0, libsignal-bridge 0.1.0, libsignal-bridge-macros 0.1.0, libsignal-bridge-testing 0.1.0, libsignal-bridge-types 0.1.0, libsignal-core 0.1.0, signal-crypto 0.1.0, device-transfer 0.1.0, signal-media 0.1.0, libsignal-message-backup 0.1.0, libsignal-message-backup-macros 0.1.0, libsignal-net 0.1.0, signal-pin 0.1.0, poksho 0.7.0, libsignal-protocol 0.1.0, libsignal-svr3 0.1.0, usernames 0.1.0, zkcredential 0.1.0, zkgroup 0.9.0
673
673
 
674
674
  ```
675
675
  GNU AFFERO GENERAL PUBLIC LICENSE
@@ -5576,6 +5576,38 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
5576
5576
  IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
5577
5577
  DEALINGS IN THE SOFTWARE.
5578
5578
 
5579
+ ```
5580
+
5581
+ ## zerocopy-derive 0.7.34, zerocopy 0.7.34
5582
+
5583
+ ```
5584
+ Copyright 2023 The Fuchsia Authors
5585
+
5586
+ Permission is hereby granted, free of charge, to any
5587
+ person obtaining a copy of this software and associated
5588
+ documentation files (the "Software"), to deal in the
5589
+ Software without restriction, including without
5590
+ limitation the rights to use, copy, modify, merge,
5591
+ publish, distribute, sublicense, and/or sell copies of
5592
+ the Software, and to permit persons to whom the Software
5593
+ is furnished to do so, subject to the following
5594
+ conditions:
5595
+
5596
+ The above copyright notice and this permission notice
5597
+ shall be included in all copies or substantial portions
5598
+ of the Software.
5599
+
5600
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
5601
+ ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
5602
+ TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
5603
+ PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
5604
+ SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
5605
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
5606
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
5607
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
5608
+ DEALINGS IN THE SOFTWARE.
5609
+
5610
+
5579
5611
  ```
5580
5612
 
5581
5613
  ## encoding_rs 0.8.34
@@ -6188,21 +6220,6 @@ SOFTWARE.
6188
6220
 
6189
6221
  ```
6190
6222
 
6191
- ## bytemuck 1.16.0
6192
-
6193
- ```
6194
- MIT License
6195
-
6196
- Copyright (c) 2019 Daniel "Lokathor" Gee.
6197
-
6198
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6199
-
6200
- The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
6201
-
6202
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
6203
-
6204
- ```
6205
-
6206
6223
  ## lazycell 1.3.0
6207
6224
 
6208
6225
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalapp/libsignal-client",
3
- "version": "0.52.1",
3
+ "version": "0.52.4",
4
4
  "license": "AGPL-3.0-only",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -17,7 +17,7 @@
17
17
  "prebuilds/*/*.node"
18
18
  ],
19
19
  "scripts": {
20
- "install": "node-gyp-build",
20
+ "install": "echo Use \\`npx node-gyp rebuild\\` to build the native library from scratch if needed",
21
21
  "build": "node-gyp build",
22
22
  "build-with-debug-level-logs": "npx --libsignal-debug-level-logs node-gyp build",
23
23
  "tsc": "tsc -b",