@signalapp/libsignal-client 0.78.0 → 0.78.2

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/dist/Errors.d.ts CHANGED
@@ -35,8 +35,8 @@ export declare enum ErrorCode {
35
35
  SvrDataMissing = 31,
36
36
  SvrRequestFailed = 32,
37
37
  SvrRestoreFailed = 33,
38
- SvrMultipleErrors = 34,
39
- SvrAttestationError = 35,
38
+ SvrAttestationError = 34,
39
+ SvrInvalidData = 35,
40
40
  ChatServiceInactive = 36,
41
41
  AppExpired = 37,
42
42
  DeviceDelinked = 38,
@@ -188,12 +188,12 @@ export type SvrRestoreFailedError = LibSignalErrorCommon & {
188
188
  code: ErrorCode.SvrRestoreFailed;
189
189
  readonly triesRemaining: number;
190
190
  };
191
- export type SvrMultipleErrorsError = LibSignalErrorCommon & {
192
- code: ErrorCode.SvrMultipleErrors;
193
- };
194
191
  export type SvrAttestationError = LibSignalErrorCommon & {
195
192
  code: ErrorCode.SvrAttestationError;
196
193
  };
194
+ export type SvrInvalidDataError = LibSignalErrorCommon & {
195
+ code: ErrorCode.SvrInvalidData;
196
+ };
197
197
  export type BackupValidationError = LibSignalErrorCommon & {
198
198
  code: ErrorCode.BackupValidation;
199
199
  readonly unknownFields: ReadonlyArray<string>;
@@ -207,4 +207,4 @@ export type KeyTransparencyError = LibSignalErrorCommon & {
207
207
  export type KeyTransparencyVerificationFailed = LibSignalErrorCommon & {
208
208
  code: ErrorCode.KeyTransparencyVerificationFailed;
209
209
  };
210
- 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 | SvrMultipleErrorsError | SvrAttestationError | UnsupportedMediaInputError | ChatServiceInactive | AppExpiredError | DeviceDelinkedError | ConnectionInvalidatedError | ConnectedElsewhereError | RateLimitedError | RateLimitChallengeError | BackupValidationError | CancellationError | KeyTransparencyError | KeyTransparencyVerificationFailed;
210
+ 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;
package/dist/Errors.js CHANGED
@@ -42,8 +42,8 @@ var ErrorCode;
42
42
  ErrorCode[ErrorCode["SvrDataMissing"] = 31] = "SvrDataMissing";
43
43
  ErrorCode[ErrorCode["SvrRequestFailed"] = 32] = "SvrRequestFailed";
44
44
  ErrorCode[ErrorCode["SvrRestoreFailed"] = 33] = "SvrRestoreFailed";
45
- ErrorCode[ErrorCode["SvrMultipleErrors"] = 34] = "SvrMultipleErrors";
46
- ErrorCode[ErrorCode["SvrAttestationError"] = 35] = "SvrAttestationError";
45
+ ErrorCode[ErrorCode["SvrAttestationError"] = 34] = "SvrAttestationError";
46
+ ErrorCode[ErrorCode["SvrInvalidData"] = 35] = "SvrInvalidData";
47
47
  ErrorCode[ErrorCode["ChatServiceInactive"] = 36] = "ChatServiceInactive";
48
48
  ErrorCode[ErrorCode["AppExpired"] = 37] = "AppExpired";
49
49
  ErrorCode[ErrorCode["DeviceDelinked"] = 38] = "DeviceDelinked";
@@ -96,10 +96,13 @@ export type RestoreBackupResponse = {
96
96
  * ## Secret handling
97
97
  *
98
98
  * When calling {@link SvrB#store}, the `previousSecretData` parameter must be from the last call to
99
- * {@link SvrB#store} or {@link SvrB#restore} that succeeded. The returned secret from a successful
100
- * store or restore should be persisted until it is overwritten by the value from a subsequent
101
- * successful call. The caller should use {@link SvrB#createNewBackupChain} only for the very first
102
- * backup with a particular backup key.
99
+ * {@link SvrB#store} or {@link SvrB#restore} that succeeded. This "chaining" is used to construct
100
+ * each backup file so that it can be decrypted with either the *previous* token stored in SVR-B, or
101
+ * the *next* one, which is important in case the overall backup upload is ever interrupted.
102
+ *
103
+ * The returned secret from a successful store or restore should be persisted until it is
104
+ * overwritten by the value from a subsequent successful call. The caller should use
105
+ * {@link SvrB#createNewBackupChain} only for the very first backup with a particular backup key.
103
106
  *
104
107
  * ## Restore Flow
105
108
  *
@@ -159,7 +162,14 @@ export declare class SvrB {
159
162
  * @param options.abortSignal An AbortSignal that will cancel the request.
160
163
  * @returns a {@link StoreBackupResponse} containing the forward secrecy token, metadata, and
161
164
  * secret data.
162
- * @throws Error if the previous secret data is malformed, or if processing or upload fail.
165
+ * @throws {SvrInvalidDataError} if the previous secret data is malformed. There's no choice here
166
+ * but to **start a new chain**.
167
+ * @throws {RateLimitedError} if the server is rate limiting this client. This is **retryable**
168
+ * after waiting the designated delay.
169
+ * @throws {IoError} if the network operation fails (connection, service, or timeout errors).
170
+ * These are **retryable**, but some may indicate a possible bug in libsignal or in the enclave.
171
+ * @throws {SvrAttestationError} if enclave attestation fails. This indicates a possible bug in
172
+ * libsignal or in the enclave.
163
173
  */
164
174
  store(backupKey: BackupKey, previousSecretData: Uint8Array, options?: {
165
175
  abortSignal?: AbortSignal;
@@ -168,8 +178,8 @@ export declare class SvrB {
168
178
  * Fetches the forward secrecy token needed to decrypt a backup.
169
179
  *
170
180
  * This function makes a network call to the SVR-B server to retrieve the forward secrecy token
171
- * associated with a specific backup. The token is required to derive the message backup keys
172
- * for decryption.
181
+ * associated with a specific backup. The token is required to derive the message backup keys for
182
+ * decryption.
173
183
  *
174
184
  * The typical restore flow:
175
185
  * 1. Fetch the backup metadata (stored in a header in the backup file)
@@ -179,12 +189,23 @@ export declare class SvrB {
179
189
  * 5. Store the returned {@link RestoreBackupResponse#nextBackupSecretData} locally.
180
190
  *
181
191
  * @param backupKey The backup key derived from the Account Entropy Pool (AEP).
182
- * @param metadata The metadata that was stored in a header in the backup file during backup creation.
192
+ * @param metadata The metadata that was stored in a header in the backup file during backup
193
+ * creation.
183
194
  * @param options Optional configuration.
184
195
  * @param options.abortSignal An AbortSignal that will cancel the request.
185
196
  * @returns The forward secrecy token needed to derive keys for decrypting the backup.
186
- * @throws Error if the metadata is invalid, the network operation fails, or the
187
- * backup cannot be found.
197
+ * @throws {SvrInvalidDataError} if the previous secret data is malformed. In this case the user's
198
+ * data is **not recoverable**.
199
+ * @throws {SvrRestoreFailedError} if restoration fails (with remaining tries count). This should
200
+ * never happen but if it does the user's data is **not recoverable**.
201
+ * @throws {SvrDataMissingError} if the backup data is not found on the server, indicating an
202
+ * **incorrect backup key** (which may in turn imply the user's data is not recoverable).
203
+ * @throws {RateLimitedError} if the server is rate limiting this client. This is **retryable**
204
+ * after waiting the designated delay.
205
+ * @throws {IoError} if the network operation fails (connection, service, or timeout errors).
206
+ * These are **retryable**, but some may indicate a possible bug in libsignal or in the enclave.
207
+ * @throws {SvrAttestationError} if enclave attestation fails. This indicates a possible bug in
208
+ * libsignal or in the enclave.
188
209
  */
189
210
  restore(backupKey: BackupKey, metadata: Uint8Array, options?: {
190
211
  abortSignal?: AbortSignal;
package/dist/net/SvrB.js CHANGED
@@ -67,10 +67,13 @@ class RestoreBackupResponseImpl {
67
67
  * ## Secret handling
68
68
  *
69
69
  * When calling {@link SvrB#store}, the `previousSecretData` parameter must be from the last call to
70
- * {@link SvrB#store} or {@link SvrB#restore} that succeeded. The returned secret from a successful
71
- * store or restore should be persisted until it is overwritten by the value from a subsequent
72
- * successful call. The caller should use {@link SvrB#createNewBackupChain} only for the very first
73
- * backup with a particular backup key.
70
+ * {@link SvrB#store} or {@link SvrB#restore} that succeeded. This "chaining" is used to construct
71
+ * each backup file so that it can be decrypted with either the *previous* token stored in SVR-B, or
72
+ * the *next* one, which is important in case the overall backup upload is ever interrupted.
73
+ *
74
+ * The returned secret from a successful store or restore should be persisted until it is
75
+ * overwritten by the value from a subsequent successful call. The caller should use
76
+ * {@link SvrB#createNewBackupChain} only for the very first backup with a particular backup key.
74
77
  *
75
78
  * ## Restore Flow
76
79
  *
@@ -130,7 +133,14 @@ class SvrB {
130
133
  * @param options.abortSignal An AbortSignal that will cancel the request.
131
134
  * @returns a {@link StoreBackupResponse} containing the forward secrecy token, metadata, and
132
135
  * secret data.
133
- * @throws Error if the previous secret data is malformed, or if processing or upload fail.
136
+ * @throws {SvrInvalidDataError} if the previous secret data is malformed. There's no choice here
137
+ * but to **start a new chain**.
138
+ * @throws {RateLimitedError} if the server is rate limiting this client. This is **retryable**
139
+ * after waiting the designated delay.
140
+ * @throws {IoError} if the network operation fails (connection, service, or timeout errors).
141
+ * These are **retryable**, but some may indicate a possible bug in libsignal or in the enclave.
142
+ * @throws {SvrAttestationError} if enclave attestation fails. This indicates a possible bug in
143
+ * libsignal or in the enclave.
134
144
  */
135
145
  async store(backupKey, previousSecretData, options) {
136
146
  const promise = Native.SecureValueRecoveryForBackups_StoreBackup(this.asyncContext, backupKey.serialize(), previousSecretData, this.connectionManager, this.auth.username, this.auth.password);
@@ -141,8 +151,8 @@ class SvrB {
141
151
  * Fetches the forward secrecy token needed to decrypt a backup.
142
152
  *
143
153
  * This function makes a network call to the SVR-B server to retrieve the forward secrecy token
144
- * associated with a specific backup. The token is required to derive the message backup keys
145
- * for decryption.
154
+ * associated with a specific backup. The token is required to derive the message backup keys for
155
+ * decryption.
146
156
  *
147
157
  * The typical restore flow:
148
158
  * 1. Fetch the backup metadata (stored in a header in the backup file)
@@ -152,12 +162,23 @@ class SvrB {
152
162
  * 5. Store the returned {@link RestoreBackupResponse#nextBackupSecretData} locally.
153
163
  *
154
164
  * @param backupKey The backup key derived from the Account Entropy Pool (AEP).
155
- * @param metadata The metadata that was stored in a header in the backup file during backup creation.
165
+ * @param metadata The metadata that was stored in a header in the backup file during backup
166
+ * creation.
156
167
  * @param options Optional configuration.
157
168
  * @param options.abortSignal An AbortSignal that will cancel the request.
158
169
  * @returns The forward secrecy token needed to derive keys for decrypting the backup.
159
- * @throws Error if the metadata is invalid, the network operation fails, or the
160
- * backup cannot be found.
170
+ * @throws {SvrInvalidDataError} if the previous secret data is malformed. In this case the user's
171
+ * data is **not recoverable**.
172
+ * @throws {SvrRestoreFailedError} if restoration fails (with remaining tries count). This should
173
+ * never happen but if it does the user's data is **not recoverable**.
174
+ * @throws {SvrDataMissingError} if the backup data is not found on the server, indicating an
175
+ * **incorrect backup key** (which may in turn imply the user's data is not recoverable).
176
+ * @throws {RateLimitedError} if the server is rate limiting this client. This is **retryable**
177
+ * after waiting the designated delay.
178
+ * @throws {IoError} if the network operation fails (connection, service, or timeout errors).
179
+ * These are **retryable**, but some may indicate a possible bug in libsignal or in the enclave.
180
+ * @throws {SvrAttestationError} if enclave attestation fails. This indicates a possible bug in
181
+ * libsignal or in the enclave.
161
182
  */
162
183
  async restore(backupKey, metadata, options) {
163
184
  const promise = Native.SecureValueRecoveryForBackups_RestoreBackupFromServer(this.asyncContext, backupKey.serialize(), metadata, this.connectionManager, this.auth.username, this.auth.password);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalapp/libsignal-client",
3
- "version": "0.78.0",
3
+ "version": "0.78.2",
4
4
  "license": "AGPL-3.0-only",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",