@signalapp/libsignal-client 0.83.0 → 0.85.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 +10 -7
- package/dist/EcKeys.js +1 -1
- package/dist/Errors.d.ts +37 -3
- package/dist/Errors.js +24 -1
- package/dist/MessageBackup.d.ts +36 -1
- package/dist/MessageBackup.js +41 -0
- package/dist/incremental_mac.js +8 -1
- package/dist/net/chat/UnauthMessagesService.d.ts +48 -0
- package/dist/net/chat/UnauthMessagesService.js +24 -0
- package/dist/net.d.ts +1 -0
- package/dist/net.js +1 -0
- package/package.json +2 -1
- package/prebuilds/darwin-arm64/@signalapp+libsignal-client.node +0 -0
- package/prebuilds/darwin-x64/@signalapp+libsignal-client.node +0 -0
- package/prebuilds/linux-arm64/@signalapp+libsignal-client.node +0 -0
- package/prebuilds/linux-x64/@signalapp+libsignal-client.node +0 -0
- package/prebuilds/win32-arm64/@signalapp+libsignal-client.node +0 -0
- package/prebuilds/win32-x64/@signalapp+libsignal-client.node +0 -0
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(
|
|
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;
|
|
@@ -638,13 +642,11 @@ export function TESTING_FakeChatConnection_TakeAuthenticatedChat(chat: Wrapper<F
|
|
|
638
642
|
export function TESTING_FakeChatConnection_TakeRemote(chat: Wrapper<FakeChatConnection>): FakeChatRemoteEnd;
|
|
639
643
|
export function TESTING_FakeChatConnection_TakeUnauthenticatedChat(chat: Wrapper<FakeChatConnection>): UnauthenticatedChatConnection;
|
|
640
644
|
export function TESTING_FakeChatRemoteEnd_InjectConnectionInterrupted(chat: Wrapper<FakeChatRemoteEnd>): void;
|
|
641
|
-
export function TESTING_FakeChatRemoteEnd_ReceiveIncomingRequest(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<FakeChatRemoteEnd>): CancellablePromise<
|
|
645
|
+
export function TESTING_FakeChatRemoteEnd_ReceiveIncomingRequest(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<FakeChatRemoteEnd>): CancellablePromise<[HttpRequest, bigint] | null>;
|
|
642
646
|
export function TESTING_FakeChatRemoteEnd_SendRawServerRequest(chat: Wrapper<FakeChatRemoteEnd>, bytes: Uint8Array): void;
|
|
643
647
|
export function TESTING_FakeChatRemoteEnd_SendRawServerResponse(chat: Wrapper<FakeChatRemoteEnd>, bytes: Uint8Array): void;
|
|
644
648
|
export function TESTING_FakeChatRemoteEnd_SendServerResponse(chat: Wrapper<FakeChatRemoteEnd>, response: Wrapper<FakeChatResponse>): void;
|
|
645
649
|
export function TESTING_FakeChatResponse_Create(id: bigint, status: number, message: string, headers: string[], body: Uint8Array | null): FakeChatResponse;
|
|
646
|
-
export function TESTING_FakeChatSentRequest_RequestId(request: Wrapper<FakeChatSentRequest>): bigint;
|
|
647
|
-
export function TESTING_FakeChatSentRequest_TakeHttpRequest(request: Wrapper<FakeChatSentRequest>): HttpRequest;
|
|
648
650
|
export function TESTING_FakeChatServer_Create(): FakeChatServer;
|
|
649
651
|
export function TESTING_FakeChatServer_GetNextRemote(asyncRuntime: Wrapper<TokioAsyncContext>, server: Wrapper<FakeChatServer>): CancellablePromise<FakeChatRemoteEnd>;
|
|
650
652
|
export function TESTING_FakeRegistrationSession_CreateSession(asyncRuntime: Wrapper<TokioAsyncContext>, createSession: RegistrationCreateSessionRequest, chat: Wrapper<FakeChatServer>): CancellablePromise<RegistrationService>;
|
|
@@ -685,6 +687,7 @@ export function TESTING_RegistrationService_ResumeSessionErrorConvert(errorDescr
|
|
|
685
687
|
export function TESTING_RegistrationService_SubmitVerificationErrorConvert(errorDescription: string): void;
|
|
686
688
|
export function TESTING_RegistrationService_UpdateSessionErrorConvert(errorDescription: string): void;
|
|
687
689
|
export function TESTING_RegistrationSessionInfoConvert(): RegistrationSession;
|
|
690
|
+
export function TESTING_ReturnPair(): [number, string];
|
|
688
691
|
export function TESTING_ReturnStringArray(): string[];
|
|
689
692
|
export function TESTING_RoundTripI32(input: number): number;
|
|
690
693
|
export function TESTING_RoundTripU16(input: number): number;
|
|
@@ -709,6 +712,7 @@ export function UnauthenticatedChatConnection_info(chat: Wrapper<Unauthenticated
|
|
|
709
712
|
export function UnauthenticatedChatConnection_init_listener(chat: Wrapper<UnauthenticatedChatConnection>, listener: ChatListener): void;
|
|
710
713
|
export function UnauthenticatedChatConnection_look_up_username_hash(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<UnauthenticatedChatConnection>, hash: Uint8Array): CancellablePromise<Uuid | null>;
|
|
711
714
|
export function UnauthenticatedChatConnection_send(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<UnauthenticatedChatConnection>, httpRequest: Wrapper<HttpRequest>, timeoutMillis: number): CancellablePromise<ChatResponse>;
|
|
715
|
+
export function UnauthenticatedChatConnection_send_multi_recipient_message(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<UnauthenticatedChatConnection>, payload: Uint8Array, timestamp: Timestamp, auth: Uint8Array|null, onlineOnly: boolean, isUrgent: boolean): CancellablePromise<Uint8Array[]>;
|
|
712
716
|
export function UnidentifiedSenderMessageContent_Deserialize(data: Uint8Array): UnidentifiedSenderMessageContent;
|
|
713
717
|
export function UnidentifiedSenderMessageContent_GetContentHint(m: Wrapper<UnidentifiedSenderMessageContent>): number;
|
|
714
718
|
export function UnidentifiedSenderMessageContent_GetContents(obj: Wrapper<UnidentifiedSenderMessageContent>): Uint8Array;
|
|
@@ -726,13 +730,14 @@ export function Username_Proof(username: string, randomness: Uint8Array): Uint8A
|
|
|
726
730
|
export function Username_Verify(proof: Uint8Array, hash: Uint8Array): void;
|
|
727
731
|
export function UuidCiphertext_CheckValidContents(buffer: Uint8Array): void;
|
|
728
732
|
export function ValidatingMac_Finalize(mac: Wrapper<ValidatingMac>): number;
|
|
729
|
-
export function ValidatingMac_Initialize(key: Uint8Array, chunkSize: number, digests: Uint8Array): ValidatingMac;
|
|
733
|
+
export function ValidatingMac_Initialize(key: Uint8Array, chunkSize: number, digests: Uint8Array): ValidatingMac | null;
|
|
730
734
|
export function ValidatingMac_Update(mac: Wrapper<ValidatingMac>, bytes: Uint8Array, offset: number, length: number): number;
|
|
731
735
|
export function WebpSanitizer_Sanitize(input: SyncInputStream): void;
|
|
732
736
|
export function initLogger(maxLevel: LogLevel, callback: (level: LogLevel, target: string, file: string | null, line: number | null, message: string) => void): void
|
|
733
737
|
export function test_only_fn_returns_123(): number;
|
|
734
738
|
interface Aes256GcmSiv { readonly __type: unique symbol; }
|
|
735
739
|
interface AuthenticatedChatConnection { readonly __type: unique symbol; }
|
|
740
|
+
interface BackupJsonExporter { readonly __type: unique symbol; }
|
|
736
741
|
interface BackupRestoreResponse { readonly __type: unique symbol; }
|
|
737
742
|
interface BackupStoreResponse { readonly __type: unique symbol; }
|
|
738
743
|
interface BridgedStringMap { readonly __type: unique symbol; }
|
|
@@ -740,7 +745,6 @@ interface CdsiLookup { readonly __type: unique symbol; }
|
|
|
740
745
|
interface ChatConnectionInfo { readonly __type: unique symbol; }
|
|
741
746
|
interface CiphertextMessage { readonly __type: unique symbol; }
|
|
742
747
|
interface ComparableBackup { readonly __type: unique symbol; }
|
|
743
|
-
interface ComparableBackup { readonly __type: unique symbol; }
|
|
744
748
|
interface ConnectionManager { readonly __type: unique symbol; }
|
|
745
749
|
interface ConnectionProxyConfig { readonly __type: unique symbol; }
|
|
746
750
|
interface DecryptionErrorMessage { readonly __type: unique symbol; }
|
|
@@ -749,7 +753,6 @@ interface ExpiringProfileKeyCredentialResponse { readonly __type: unique symbol;
|
|
|
749
753
|
interface FakeChatConnection { readonly __type: unique symbol; }
|
|
750
754
|
interface FakeChatRemoteEnd { readonly __type: unique symbol; }
|
|
751
755
|
interface FakeChatResponse { readonly __type: unique symbol; }
|
|
752
|
-
interface FakeChatSentRequest { readonly __type: unique symbol; }
|
|
753
756
|
interface FakeChatServer { readonly __type: unique symbol; }
|
|
754
757
|
interface Fingerprint { readonly __type: unique symbol; }
|
|
755
758
|
interface GroupMasterKey { 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
|
|
96
|
+
const [publicKey, privateKey] = Native.IdentityKeyPair_Deserialize(buffer);
|
|
97
97
|
return new IdentityKeyPair(PublicKey._fromNativeHandle(publicKey), PrivateKey._fromNativeHandle(privateKey));
|
|
98
98
|
}
|
|
99
99
|
serialize() {
|
package/dist/Errors.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProtocolAddress } from './Address.js';
|
|
1
|
+
import { ProtocolAddress, ServiceId } from './Address.js';
|
|
2
2
|
import Native from '../Native.js';
|
|
3
3
|
export declare enum ErrorCode {
|
|
4
4
|
Generic = 0,
|
|
@@ -46,7 +46,33 @@ export declare enum ErrorCode {
|
|
|
46
46
|
Cancelled = 42,
|
|
47
47
|
KeyTransparencyError = 43,
|
|
48
48
|
KeyTransparencyVerificationFailed = 44,
|
|
49
|
-
IncrementalMacVerificationFailed = 45
|
|
49
|
+
IncrementalMacVerificationFailed = 45,
|
|
50
|
+
RequestUnauthorized = 46,
|
|
51
|
+
MismatchedDevices = 47
|
|
52
|
+
}
|
|
53
|
+
/** Called out as a separate type so it's not confused with a normal ServiceIdBinary. */
|
|
54
|
+
type ServiceIdFixedWidthBinary = Uint8Array;
|
|
55
|
+
/**
|
|
56
|
+
* A failure sending to a recipient on account of not being up to date on their devices.
|
|
57
|
+
*
|
|
58
|
+
* An entry in {@link MismatchedDevicesError}. Each entry represents a recipient that has either
|
|
59
|
+
* added, removed, or relinked some devices in their account (potentially including their primary
|
|
60
|
+
* device), as represented by the {@link MismatchedDevicesEntry#missingDevices},
|
|
61
|
+
* {@link MismatchedDevicesEntry#extraDevices}, and {@link MismatchedDevicesEntry#staleDevices}
|
|
62
|
+
* arrays, respectively. Handling the exception involves removing the "extra" devices and
|
|
63
|
+
* establishing new sessions for the "missing" and "stale" devices.
|
|
64
|
+
*/
|
|
65
|
+
export declare class MismatchedDevicesEntry {
|
|
66
|
+
account: ServiceId;
|
|
67
|
+
missingDevices: number[];
|
|
68
|
+
extraDevices: number[];
|
|
69
|
+
staleDevices: number[];
|
|
70
|
+
constructor({ account, missingDevices, extraDevices, staleDevices, }: {
|
|
71
|
+
account: ServiceId | ServiceIdFixedWidthBinary;
|
|
72
|
+
missingDevices?: number[];
|
|
73
|
+
extraDevices?: number[];
|
|
74
|
+
staleDevices?: number[];
|
|
75
|
+
});
|
|
50
76
|
}
|
|
51
77
|
export declare class LibSignalErrorBase extends Error {
|
|
52
78
|
readonly code: ErrorCode;
|
|
@@ -211,4 +237,12 @@ export type KeyTransparencyVerificationFailed = LibSignalErrorCommon & {
|
|
|
211
237
|
export type IncrementalMacVerificationFailed = LibSignalErrorCommon & {
|
|
212
238
|
code: ErrorCode.IncrementalMacVerificationFailed;
|
|
213
239
|
};
|
|
214
|
-
export type
|
|
240
|
+
export type RequestUnauthorizedError = LibSignalErrorCommon & {
|
|
241
|
+
code: ErrorCode.RequestUnauthorized;
|
|
242
|
+
};
|
|
243
|
+
export type MismatchedDevicesError = LibSignalErrorCommon & {
|
|
244
|
+
code: ErrorCode.MismatchedDevices;
|
|
245
|
+
readonly entries: MismatchedDevicesEntry[];
|
|
246
|
+
};
|
|
247
|
+
export type LibSignalError = GenericError | DuplicatedMessageError | SealedSenderSelfSendError | UntrustedIdentityError | InvalidRegistrationIdError | InvalidProtocolAddress | 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 | SvrAttestationError | SvrInvalidDataError | UnsupportedMediaInputError | ChatServiceInactive | AppExpiredError | DeviceDelinkedError | ConnectionInvalidatedError | ConnectedElsewhereError | RateLimitedError | RateLimitChallengeError | BackupValidationError | CancellationError | KeyTransparencyError | KeyTransparencyVerificationFailed | IncrementalMacVerificationFailed | RequestUnauthorizedError | MismatchedDevicesError;
|
|
248
|
+
export {};
|
package/dist/Errors.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2021 Signal Messenger, LLC.
|
|
3
3
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
4
4
|
//
|
|
5
|
-
import { ProtocolAddress } from './Address.js';
|
|
5
|
+
import { ProtocolAddress, ServiceId } from './Address.js';
|
|
6
6
|
export var ErrorCode;
|
|
7
7
|
(function (ErrorCode) {
|
|
8
8
|
ErrorCode[ErrorCode["Generic"] = 0] = "Generic";
|
|
@@ -51,7 +51,30 @@ export var ErrorCode;
|
|
|
51
51
|
ErrorCode[ErrorCode["KeyTransparencyError"] = 43] = "KeyTransparencyError";
|
|
52
52
|
ErrorCode[ErrorCode["KeyTransparencyVerificationFailed"] = 44] = "KeyTransparencyVerificationFailed";
|
|
53
53
|
ErrorCode[ErrorCode["IncrementalMacVerificationFailed"] = 45] = "IncrementalMacVerificationFailed";
|
|
54
|
+
ErrorCode[ErrorCode["RequestUnauthorized"] = 46] = "RequestUnauthorized";
|
|
55
|
+
ErrorCode[ErrorCode["MismatchedDevices"] = 47] = "MismatchedDevices";
|
|
54
56
|
})(ErrorCode || (ErrorCode = {}));
|
|
57
|
+
/**
|
|
58
|
+
* A failure sending to a recipient on account of not being up to date on their devices.
|
|
59
|
+
*
|
|
60
|
+
* An entry in {@link MismatchedDevicesError}. Each entry represents a recipient that has either
|
|
61
|
+
* added, removed, or relinked some devices in their account (potentially including their primary
|
|
62
|
+
* device), as represented by the {@link MismatchedDevicesEntry#missingDevices},
|
|
63
|
+
* {@link MismatchedDevicesEntry#extraDevices}, and {@link MismatchedDevicesEntry#staleDevices}
|
|
64
|
+
* arrays, respectively. Handling the exception involves removing the "extra" devices and
|
|
65
|
+
* establishing new sessions for the "missing" and "stale" devices.
|
|
66
|
+
*/
|
|
67
|
+
export class MismatchedDevicesEntry {
|
|
68
|
+
constructor({ account, missingDevices, extraDevices, staleDevices, }) {
|
|
69
|
+
this.account =
|
|
70
|
+
account instanceof ServiceId
|
|
71
|
+
? account
|
|
72
|
+
: ServiceId.parseFromServiceIdFixedWidthBinary(account);
|
|
73
|
+
this.missingDevices = missingDevices ?? [];
|
|
74
|
+
this.extraDevices = extraDevices ?? [];
|
|
75
|
+
this.staleDevices = staleDevices ?? [];
|
|
76
|
+
}
|
|
77
|
+
}
|
|
55
78
|
export class LibSignalErrorBase extends Error {
|
|
56
79
|
constructor(message, name, operation, extraProps) {
|
|
57
80
|
super(message);
|
package/dist/MessageBackup.d.ts
CHANGED
|
@@ -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
|
+
}
|
package/dist/MessageBackup.js
CHANGED
|
@@ -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/dist/incremental_mac.js
CHANGED
|
@@ -73,7 +73,14 @@ class ValidatingWritable extends stream.Writable {
|
|
|
73
73
|
constructor(key, sizeChoice, digest) {
|
|
74
74
|
super();
|
|
75
75
|
this._validatedBytes = 0;
|
|
76
|
-
|
|
76
|
+
const handle = Native.ValidatingMac_Initialize(key, chunkSizeInBytes(sizeChoice), digest);
|
|
77
|
+
if (!handle) {
|
|
78
|
+
// Not sure why eslint isn't treating IncrementalMacVerificationFailed as an Error;
|
|
79
|
+
// standalone examples are not reproducing.
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/only-throw-error
|
|
81
|
+
throw makeVerificationError('Invalid configuration data');
|
|
82
|
+
}
|
|
83
|
+
this._nativeHandle = handle;
|
|
77
84
|
}
|
|
78
85
|
validatedSize() {
|
|
79
86
|
return this._validatedBytes;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ServiceId } from '../../Address.js';
|
|
2
|
+
import { RequestOptions } from '../Chat.js';
|
|
3
|
+
import { GroupSendFullToken } from '../../zkgroup/index.js';
|
|
4
|
+
declare module '../Chat' {
|
|
5
|
+
interface UnauthenticatedChatConnection extends UnauthMessagesService {
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
/** See {@link UnauthMessagesService#sendMultiRecipientMessage}. */
|
|
9
|
+
export type MultiRecipientMessageRequest = Readonly<{
|
|
10
|
+
payload: Uint8Array;
|
|
11
|
+
timestamp: number;
|
|
12
|
+
auth: 'story' | GroupSendFullToken;
|
|
13
|
+
onlineOnly: boolean;
|
|
14
|
+
urgent: boolean;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* Successful response for {@link UnauthMessagesService#sendMultiRecipientMessage}.
|
|
18
|
+
*
|
|
19
|
+
* When authenticating using a {@link GroupSendFullToken}, the server will report which recipients
|
|
20
|
+
* are currently unregistered. For `story` auth the list will always be empty.
|
|
21
|
+
*/
|
|
22
|
+
export declare class MultiRecipientMessageResponse {
|
|
23
|
+
unregisteredIds: ServiceId[];
|
|
24
|
+
constructor(unregisteredIds: ServiceId[]);
|
|
25
|
+
}
|
|
26
|
+
export interface UnauthMessagesService {
|
|
27
|
+
/**
|
|
28
|
+
* Sends a multi-recipient message encrypted with Sealed Sender v2.
|
|
29
|
+
*
|
|
30
|
+
* Messages to accounts that have been unregistered will be dropped by the server and (if using
|
|
31
|
+
* {@link GroupSendFullToken}-based auth) reported in the resulting
|
|
32
|
+
* {@link MultiRecipientMessageResponse}.
|
|
33
|
+
*
|
|
34
|
+
* @throws {RequestUnauthorizedError} if `auth` is not valid for the recipients specified in
|
|
35
|
+
* `payload`. (This cannot happen when `auth` is `'story'`.)
|
|
36
|
+
* @throws {MismatchedDevicesError} if the recipient devices specified in `payload` are out of
|
|
37
|
+
* date in some way. This is not a "partial success" result; the message has not been sent to
|
|
38
|
+
* anybody.
|
|
39
|
+
* @throws {ChatServiceInactive} if the chat connection has been closed.
|
|
40
|
+
* @throws {IoError} if an error occurred while communicating with the server.
|
|
41
|
+
* @throws {RateLimitedError} if the server is rate limiting this client. This is **retryable**
|
|
42
|
+
* after waiting the designated delay.
|
|
43
|
+
*
|
|
44
|
+
* @see `sealedSenderMultiRecipientEncrypt`
|
|
45
|
+
* @see {@link MismatchedDevicesEntry}
|
|
46
|
+
*/
|
|
47
|
+
sendMultiRecipientMessage: (request: MultiRecipientMessageRequest, options?: RequestOptions) => Promise<MultiRecipientMessageResponse>;
|
|
48
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 Signal Messenger, LLC.
|
|
3
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
4
|
+
//
|
|
5
|
+
import Native from '../../../Native.js';
|
|
6
|
+
import { ServiceId } from '../../Address.js';
|
|
7
|
+
import { UnauthenticatedChatConnection } from '../Chat.js';
|
|
8
|
+
/**
|
|
9
|
+
* Successful response for {@link UnauthMessagesService#sendMultiRecipientMessage}.
|
|
10
|
+
*
|
|
11
|
+
* When authenticating using a {@link GroupSendFullToken}, the server will report which recipients
|
|
12
|
+
* are currently unregistered. For `story` auth the list will always be empty.
|
|
13
|
+
*/
|
|
14
|
+
export class MultiRecipientMessageResponse {
|
|
15
|
+
constructor(unregisteredIds) {
|
|
16
|
+
this.unregisteredIds = unregisteredIds;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
UnauthenticatedChatConnection.prototype.sendMultiRecipientMessage =
|
|
20
|
+
async function ({ payload, timestamp, auth, onlineOnly, urgent, }, options) {
|
|
21
|
+
const response = await this._asyncContext.makeCancellable(options?.abortSignal, Native.UnauthenticatedChatConnection_send_multi_recipient_message(this._asyncContext, this._chatService, payload, timestamp, auth === 'story' ? null : auth.getContents(), onlineOnly, urgent));
|
|
22
|
+
return new MultiRecipientMessageResponse(response.map((raw) => ServiceId.parseFromServiceIdFixedWidthBinary(raw)));
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=UnauthMessagesService.js.map
|
package/dist/net.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { RegistrationService } from './net/Registration.js';
|
|
|
6
6
|
import { SvrB } from './net/SvrB.js';
|
|
7
7
|
export * from './net/CDSI.js';
|
|
8
8
|
export * from './net/Chat.js';
|
|
9
|
+
export * from './net/chat/UnauthMessagesService.js';
|
|
9
10
|
export * from './net/chat/UnauthUsernamesService.js';
|
|
10
11
|
export * from './net/Registration.js';
|
|
11
12
|
export * from './net/SvrB.js';
|
package/dist/net.js
CHANGED
|
@@ -10,6 +10,7 @@ import { SvrB } from './net/SvrB.js';
|
|
|
10
10
|
import { BridgedStringMap, newNativeHandle } from './internal.js';
|
|
11
11
|
export * from './net/CDSI.js';
|
|
12
12
|
export * from './net/Chat.js';
|
|
13
|
+
export * from './net/chat/UnauthMessagesService.js';
|
|
13
14
|
export * from './net/chat/UnauthUsernamesService.js';
|
|
14
15
|
export * from './net/Registration.js';
|
|
15
16
|
export * from './net/SvrB.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signalapp/libsignal-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.85.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",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|