@signalapp/libsignal-client 0.83.0 → 0.84.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
@@ -229,6 +229,10 @@ export function BackupAuthCredential_GetBackupId(credentialBytes: Uint8Array): U
229
229
  export function BackupAuthCredential_GetBackupLevel(credentialBytes: Uint8Array): number;
230
230
  export function BackupAuthCredential_GetType(credentialBytes: Uint8Array): number;
231
231
  export function BackupAuthCredential_PresentDeterministic(credentialBytes: Uint8Array, serverParamsBytes: Uint8Array, randomness: Uint8Array): Uint8Array;
232
+ export function BackupJsonExporter_ExportFrames(exporter: Wrapper<BackupJsonExporter>, frames: Uint8Array): string;
233
+ export function BackupJsonExporter_Finish(exporter: Wrapper<BackupJsonExporter>): string;
234
+ export function BackupJsonExporter_GetInitialChunk(exporter: Wrapper<BackupJsonExporter>): string;
235
+ export function BackupJsonExporter_New(backupInfo: Uint8Array, shouldValidate: boolean): BackupJsonExporter;
232
236
  export function BackupKey_DeriveBackupId(backupKey: Uint8Array, aci: Uint8Array): Uint8Array;
233
237
  export function BackupKey_DeriveEcKey(backupKey: Uint8Array, aci: Uint8Array): PrivateKey;
234
238
  export function BackupKey_DeriveLocalBackupMetadataKey(backupKey: Uint8Array): Uint8Array;
@@ -347,7 +351,7 @@ export function HsmEnclaveClient_InitialRequest(obj: Wrapper<HsmEnclaveClient>):
347
351
  export function HsmEnclaveClient_New(trustedPublicKey: Uint8Array, trustedCodeHashes: Uint8Array): HsmEnclaveClient;
348
352
  export function HttpRequest_add_header(request: Wrapper<HttpRequest>, name: string, value: string): void;
349
353
  export function HttpRequest_new(method: string, path: string, bodyAsSlice: Uint8Array | null): HttpRequest;
350
- export function IdentityKeyPair_Deserialize(buffer: Uint8Array): {publicKey:PublicKey,privateKey:PrivateKey};
354
+ export function IdentityKeyPair_Deserialize(input: Uint8Array): [PublicKey, PrivateKey];
351
355
  export function IdentityKeyPair_Serialize(publicKey: Wrapper<PublicKey>, privateKey: Wrapper<PrivateKey>): Uint8Array;
352
356
  export function IdentityKeyPair_SignAlternateIdentity(publicKey: Wrapper<PublicKey>, privateKey: Wrapper<PrivateKey>, otherIdentity: Wrapper<PublicKey>): Uint8Array;
353
357
  export function IdentityKey_VerifyAlternateIdentity(publicKey: Wrapper<PublicKey>, otherIdentity: Wrapper<PublicKey>, signature: Uint8Array): boolean;
@@ -685,6 +689,7 @@ export function TESTING_RegistrationService_ResumeSessionErrorConvert(errorDescr
685
689
  export function TESTING_RegistrationService_SubmitVerificationErrorConvert(errorDescription: string): void;
686
690
  export function TESTING_RegistrationService_UpdateSessionErrorConvert(errorDescription: string): void;
687
691
  export function TESTING_RegistrationSessionInfoConvert(): RegistrationSession;
692
+ export function TESTING_ReturnPair(): [number, string];
688
693
  export function TESTING_ReturnStringArray(): string[];
689
694
  export function TESTING_RoundTripI32(input: number): number;
690
695
  export function TESTING_RoundTripU16(input: number): number;
@@ -733,6 +738,7 @@ export function initLogger(maxLevel: LogLevel, callback: (level: LogLevel, targe
733
738
  export function test_only_fn_returns_123(): number;
734
739
  interface Aes256GcmSiv { readonly __type: unique symbol; }
735
740
  interface AuthenticatedChatConnection { readonly __type: unique symbol; }
741
+ interface BackupJsonExporter { readonly __type: unique symbol; }
736
742
  interface BackupRestoreResponse { readonly __type: unique symbol; }
737
743
  interface BackupStoreResponse { readonly __type: unique symbol; }
738
744
  interface BridgedStringMap { readonly __type: unique symbol; }
@@ -740,7 +746,6 @@ interface CdsiLookup { readonly __type: unique symbol; }
740
746
  interface ChatConnectionInfo { readonly __type: unique symbol; }
741
747
  interface CiphertextMessage { readonly __type: unique symbol; }
742
748
  interface ComparableBackup { readonly __type: unique symbol; }
743
- interface ComparableBackup { readonly __type: unique symbol; }
744
749
  interface ConnectionManager { readonly __type: unique symbol; }
745
750
  interface ConnectionProxyConfig { readonly __type: unique symbol; }
746
751
  interface DecryptionErrorMessage { readonly __type: unique symbol; }
package/dist/EcKeys.js CHANGED
@@ -93,7 +93,7 @@ export class IdentityKeyPair {
93
93
  return new IdentityKeyPair(privateKey.getPublicKey(), privateKey);
94
94
  }
95
95
  static deserialize(buffer) {
96
- const { privateKey, publicKey } = Native.IdentityKeyPair_Deserialize(buffer);
96
+ const [publicKey, privateKey] = Native.IdentityKeyPair_Deserialize(buffer);
97
97
  return new IdentityKeyPair(PublicKey._fromNativeHandle(publicKey), PrivateKey._fromNativeHandle(privateKey));
98
98
  }
99
99
  serialize() {
@@ -62,7 +62,8 @@ export declare class MessageBackupKey {
62
62
  }
63
63
  export declare enum Purpose {
64
64
  DeviceTransfer = 0,
65
- RemoteBackup = 1
65
+ RemoteBackup = 1,
66
+ TakeoutExport = 2
66
67
  }
67
68
  /**
68
69
  * Validate a backup file
@@ -170,3 +171,37 @@ export declare class ComparableBackup {
170
171
  */
171
172
  get unknownFields(): Array<string>;
172
173
  }
174
+ /**
175
+ * Streaming exporter that produces a human-readable JSON representation of a backup.
176
+ */
177
+ export declare class BackupJsonExporter {
178
+ readonly _nativeHandle: Native.BackupJsonExporter;
179
+ private constructor();
180
+ /**
181
+ * Initializes the streaming exporter and returns the first chunk of output.
182
+ * @param backupInfo The serialized BackupInfo protobuf without a varint header.
183
+ * @param [options] Additional configuration for the exporter.
184
+ * @param [options.validate=true] Whether to run semantic validation on the backup.
185
+ * @returns An object containing the exporter and the first chunk of output, containing the backup info.
186
+ * @throws Error if the input is invalid.
187
+ */
188
+ static start(backupInfo: Uint8Array, options?: {
189
+ validate?: boolean;
190
+ }): {
191
+ exporter: BackupJsonExporter;
192
+ chunk: string;
193
+ };
194
+ /**
195
+ * Validates and exports a human-readable JSON representation of backup frames.
196
+ * @param frames One or more varint delimited Frame serialized protobuf messages.
197
+ * @returns A string containing the exported frames.
198
+ * @throws Error if the input is invalid.
199
+ */
200
+ exportFrames(frames: Uint8Array): string;
201
+ /**
202
+ * Completes the validation and export of the previously exported frames.
203
+ * @returns A string containing the final chunk of the output.
204
+ * @throws Error if some previous input fails validation at the final stage.
205
+ */
206
+ finish(): string;
207
+ }
@@ -70,6 +70,7 @@ export var Purpose;
70
70
  (function (Purpose) {
71
71
  Purpose[Purpose["DeviceTransfer"] = 0] = "DeviceTransfer";
72
72
  Purpose[Purpose["RemoteBackup"] = 1] = "RemoteBackup";
73
+ Purpose[Purpose["TakeoutExport"] = 2] = "TakeoutExport";
73
74
  })(Purpose || (Purpose = {}));
74
75
  /**
75
76
  * Validate a backup file
@@ -202,4 +203,44 @@ export class ComparableBackup {
202
203
  return Native.ComparableBackup_GetUnknownFields(this);
203
204
  }
204
205
  }
206
+ /**
207
+ * Streaming exporter that produces a human-readable JSON representation of a backup.
208
+ */
209
+ export class BackupJsonExporter {
210
+ constructor(handle) {
211
+ this._nativeHandle = handle;
212
+ }
213
+ /**
214
+ * Initializes the streaming exporter and returns the first chunk of output.
215
+ * @param backupInfo The serialized BackupInfo protobuf without a varint header.
216
+ * @param [options] Additional configuration for the exporter.
217
+ * @param [options.validate=true] Whether to run semantic validation on the backup.
218
+ * @returns An object containing the exporter and the first chunk of output, containing the backup info.
219
+ * @throws Error if the input is invalid.
220
+ */
221
+ static start(backupInfo, options) {
222
+ const shouldValidate = options?.validate ?? true;
223
+ const handle = Native.BackupJsonExporter_New(backupInfo, shouldValidate);
224
+ const exporter = new BackupJsonExporter(handle);
225
+ const chunk = Native.BackupJsonExporter_GetInitialChunk(exporter);
226
+ return { exporter, chunk };
227
+ }
228
+ /**
229
+ * Validates and exports a human-readable JSON representation of backup frames.
230
+ * @param frames One or more varint delimited Frame serialized protobuf messages.
231
+ * @returns A string containing the exported frames.
232
+ * @throws Error if the input is invalid.
233
+ */
234
+ exportFrames(frames) {
235
+ return Native.BackupJsonExporter_ExportFrames(this, frames);
236
+ }
237
+ /**
238
+ * Completes the validation and export of the previously exported frames.
239
+ * @returns A string containing the final chunk of the output.
240
+ * @throws Error if some previous input fails validation at the final stage.
241
+ */
242
+ finish() {
243
+ return Native.BackupJsonExporter_Finish(this);
244
+ }
245
+ }
205
246
  //# sourceMappingURL=MessageBackup.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalapp/libsignal-client",
3
- "version": "0.83.0",
3
+ "version": "0.84.0",
4
4
  "license": "AGPL-3.0-only",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -64,6 +64,7 @@
64
64
  "mocha": "^11",
65
65
  "prettier": "^2.7.1",
66
66
  "prettier-plugin-packagejson": "^2.5.19",
67
+ "protobufjs": "^7.5.3",
67
68
  "rimraf": "^6.0.1",
68
69
  "sinon": "^21.0.0",
69
70
  "sinon-chai": "^4.0.1",