@signalapp/libsignal-client 0.58.3 → 0.60.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
@@ -156,17 +156,19 @@ export function AuthCredentialWithPni_CheckValidContents(bytes: Buffer): void;
156
156
  export function BackupAuthCredentialPresentation_CheckValidContents(presentationBytes: Buffer): void;
157
157
  export function BackupAuthCredentialPresentation_GetBackupId(presentationBytes: Buffer): Buffer;
158
158
  export function BackupAuthCredentialPresentation_GetBackupLevel(presentationBytes: Buffer): number;
159
+ export function BackupAuthCredentialPresentation_GetType(presentationBytes: Buffer): number;
159
160
  export function BackupAuthCredentialPresentation_Verify(presentationBytes: Buffer, now: Timestamp, serverParamsBytes: Buffer): void;
160
161
  export function BackupAuthCredentialRequestContext_CheckValidContents(contextBytes: Buffer): void;
161
162
  export function BackupAuthCredentialRequestContext_GetRequest(contextBytes: Buffer): Buffer;
162
163
  export function BackupAuthCredentialRequestContext_New(backupKey: Buffer, uuid: Uuid): Buffer;
163
164
  export function BackupAuthCredentialRequestContext_ReceiveResponse(contextBytes: Buffer, responseBytes: Buffer, expectedRedemptionTime: Timestamp, paramsBytes: Buffer): Buffer;
164
165
  export function BackupAuthCredentialRequest_CheckValidContents(requestBytes: Buffer): void;
165
- export function BackupAuthCredentialRequest_IssueDeterministic(requestBytes: Buffer, redemptionTime: Timestamp, backupLevel: number, paramsBytes: Buffer, randomness: Buffer): Buffer;
166
+ export function BackupAuthCredentialRequest_IssueDeterministic(requestBytes: Buffer, redemptionTime: Timestamp, backupLevel: number, credentialType: number, paramsBytes: Buffer, randomness: Buffer): Buffer;
166
167
  export function BackupAuthCredentialResponse_CheckValidContents(responseBytes: Buffer): void;
167
168
  export function BackupAuthCredential_CheckValidContents(paramsBytes: Buffer): void;
168
169
  export function BackupAuthCredential_GetBackupId(credentialBytes: Buffer): Buffer;
169
170
  export function BackupAuthCredential_GetBackupLevel(credentialBytes: Buffer): number;
171
+ export function BackupAuthCredential_GetType(credentialBytes: Buffer): number;
170
172
  export function BackupAuthCredential_PresentDeterministic(credentialBytes: Buffer, serverParamsBytes: Buffer, randomness: Buffer): Buffer;
171
173
  export function CallLinkAuthCredentialPresentation_CheckValidContents(presentationBytes: Buffer): void;
172
174
  export function CallLinkAuthCredentialPresentation_GetUserId(presentationBytes: Buffer): Serialized<UuidCiphertext>;
@@ -309,7 +311,9 @@ export function LookupRequest_addPreviousE164(request: Wrapper<LookupRequest>, e
309
311
  export function LookupRequest_new(): LookupRequest;
310
312
  export function LookupRequest_setReturnAcisWithoutUaks(request: Wrapper<LookupRequest>, returnAcisWithoutUaks: boolean): void;
311
313
  export function LookupRequest_setToken(request: Wrapper<LookupRequest>, token: Buffer): void;
312
- export function MessageBackupKey_New(masterKey: Buffer, aci: Buffer): MessageBackupKey;
314
+ export function MessageBackupKey_FromAccountEntropyPool(accountEntropy: string, aci: Buffer): MessageBackupKey;
315
+ export function MessageBackupKey_FromBackupKeyAndBackupId(backupKey: Buffer, backupId: Buffer): MessageBackupKey;
316
+ export function MessageBackupKey_FromMasterKey(masterKey: Buffer, aci: Buffer): MessageBackupKey;
313
317
  export function MessageBackupValidator_Validate(key: Wrapper<MessageBackupKey>, firstStream: InputStream, secondStream: InputStream, len: bigint, purpose: number): Promise<MessageBackupValidationOutcome>;
314
318
  export function MinidumpToJSONString(buffer: Buffer): string;
315
319
  export function Mp4Sanitizer_Sanitize(input: InputStream, len: bigint): Promise<SanitizedMetadata>;
@@ -508,6 +512,7 @@ export function TESTING_ChatServiceResponseConvert(bodyPresent: boolean): ChatRe
508
512
  export function TESTING_ChatService_InjectConnectionInterrupted(chat: Wrapper<AuthChat>): void;
509
513
  export function TESTING_ChatService_InjectIntentionalDisconnect(chat: Wrapper<AuthChat>): void;
510
514
  export function TESTING_ChatService_InjectRawServerRequest(chat: Wrapper<AuthChat>, bytes: Buffer): void;
515
+ export function TESTING_ConnectionManager_newLocalOverride(userAgent: string, chatPort: number, cdsiPort: number, svr2Port: number, svr3SgxPort: number, svr3NitroPort: number, svr3Tpm2SnpPort: number, rootCertificateDer: Buffer): ConnectionManager;
511
516
  export function TESTING_ErrorOnBorrowAsync(_input: null): Promise<void>;
512
517
  export function TESTING_ErrorOnBorrowIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _input: null): Promise<void>;
513
518
  export function TESTING_ErrorOnBorrowSync(_input: null): void;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The randomly-generated user-memorized entropy used to derive the backup key,
3
+ * with other possible future uses.
4
+ *
5
+ * Contains log_2(36^64) = ~330 bits of entropy.
6
+ */
7
+ export declare class AccountEntropyPool {
8
+ /**
9
+ * Randomly generates an Account Entropy Pool and returns the cannonical string
10
+ * representation of that pool.
11
+ *
12
+ * @returns cryptographically random 64 character string of characters a-z, 0-9
13
+ */
14
+ static generate(): string;
15
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ //
3
+ // Copyright 2024 Signal Messenger, LLC.
4
+ // SPDX-License-Identifier: AGPL-3.0-only
5
+ //
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.AccountEntropyPool = void 0;
8
+ /**
9
+ * Cryptographic hashing, randomness generation, etc. related to SVR/Backup Keys.
10
+ *
11
+ * Currently only the Account Entropy Pool is exposed, because no other functionality is used on Desktop.
12
+ *
13
+ * @module AccountKeys
14
+ */
15
+ const Native = require("../Native");
16
+ /**
17
+ * The randomly-generated user-memorized entropy used to derive the backup key,
18
+ * with other possible future uses.
19
+ *
20
+ * Contains log_2(36^64) = ~330 bits of entropy.
21
+ */
22
+ class AccountEntropyPool {
23
+ /**
24
+ * Randomly generates an Account Entropy Pool and returns the cannonical string
25
+ * representation of that pool.
26
+ *
27
+ * @returns cryptographically random 64 character string of characters a-z, 0-9
28
+ */
29
+ static generate() {
30
+ return Native.AccountEntropyPool_Generate();
31
+ }
32
+ }
33
+ exports.AccountEntropyPool = AccountEntropyPool;
34
+ //# sourceMappingURL=AccountKeys.js.map
@@ -29,17 +29,37 @@ export declare class ValidationOutcome {
29
29
  get ok(): boolean;
30
30
  constructor(outcome: Native.MessageBackupValidationOutcome);
31
31
  }
32
+ export type MessageBackupKeyInput = Readonly<{
33
+ accountEntropy: string;
34
+ aci: Aci;
35
+ } | {
36
+ backupKey: Buffer;
37
+ backupId: Buffer;
38
+ }>;
32
39
  /**
33
40
  * Key used to encrypt and decrypt a message backup bundle.
34
41
  */
35
42
  export declare class MessageBackupKey {
36
43
  readonly _nativeHandle: Native.MessageBackupKey;
37
44
  /**
38
- * Create a public key from the given master key and ACI.
45
+ * Create a backup bundle key from the given master key and ACI.
39
46
  *
40
47
  * `masterKeyBytes` should contain exactly 32 bytes.
48
+ *
49
+ * @deprecated Use AccountEntropyPool instead.
41
50
  */
42
51
  constructor(masterKeyBytes: Buffer, aci: Aci);
52
+ /**
53
+ * Create a backup bundle key from an account entropy pool and ACI.
54
+ *
55
+ * ...or from a backup key and ID, used when reading from a local backup, which may have been
56
+ * created with a different ACI. This still uses AccountEntropyPool-based key derivation rules; it
57
+ * cannot be used to read a backup created from a master key.
58
+ *
59
+ * The account entropy pool must be **validated**; passing an arbitrary string here is considered
60
+ * a programmer error. Similarly, passing a backup key or ID of the wrong length is also an error.
61
+ */
62
+ constructor(input: MessageBackupKeyInput);
43
63
  }
44
64
  export declare enum Purpose {
45
65
  DeviceTransfer = 0,
@@ -34,13 +34,20 @@ exports.ValidationOutcome = ValidationOutcome;
34
34
  * Key used to encrypt and decrypt a message backup bundle.
35
35
  */
36
36
  class MessageBackupKey {
37
- /**
38
- * Create a public key from the given master key and ACI.
39
- *
40
- * `masterKeyBytes` should contain exactly 32 bytes.
41
- */
42
- constructor(masterKeyBytes, aci) {
43
- this._nativeHandle = Native.MessageBackupKey_New(masterKeyBytes, aci.getServiceIdFixedWidthBinary());
37
+ constructor(inputOrMasterKeyBytes, maybeAci) {
38
+ if (inputOrMasterKeyBytes instanceof Buffer) {
39
+ if (maybeAci === undefined)
40
+ throw new Error('missing ACI parameter');
41
+ this._nativeHandle = Native.MessageBackupKey_FromMasterKey(inputOrMasterKeyBytes, maybeAci.getServiceIdFixedWidthBinary());
42
+ }
43
+ else if ('accountEntropy' in inputOrMasterKeyBytes) {
44
+ const { accountEntropy, aci } = inputOrMasterKeyBytes;
45
+ this._nativeHandle = Native.MessageBackupKey_FromAccountEntropyPool(accountEntropy, aci.getServiceIdFixedWidthBinary());
46
+ }
47
+ else {
48
+ const { backupKey, backupId } = inputOrMasterKeyBytes;
49
+ this._nativeHandle = Native.MessageBackupKey_FromBackupKeyAndBackupId(backupKey, backupId);
50
+ }
44
51
  }
45
52
  }
46
53
  exports.MessageBackupKey = MessageBackupKey;
@@ -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.58.3, libsignal-jni 0.58.3, libsignal-jni-testing 0.58.3, libsignal-node 0.58.3, 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, libsignal-keytrans 0.0.1, signal-media 0.1.0, libsignal-message-backup 0.1.0, libsignal-message-backup-macros 0.1.0, libsignal-net 0.1.0, libsignal-net-infra 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
+ ## libsignal-account-keys 0.1.0, attest 0.1.0, libsignal-ffi 0.60.0, libsignal-jni 0.60.0, libsignal-jni-testing 0.60.0, libsignal-node 0.60.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-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, libsignal-keytrans 0.0.1, signal-media 0.1.0, libsignal-message-backup 0.1.0, libsignal-message-backup-macros 0.1.0, libsignal-net 0.1.0, libsignal-net-infra 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
@@ -2171,7 +2171,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2171
2171
 
2172
2172
  ```
2173
2173
 
2174
- ## bindgen 0.68.1
2174
+ ## bindgen 0.70.1
2175
2175
 
2176
2176
  ```
2177
2177
  BSD 3-Clause License
@@ -3300,7 +3300,7 @@ THE SOFTWARE.
3300
3300
 
3301
3301
  ```
3302
3302
 
3303
- ## either 1.13.0, itertools 0.13.0, petgraph 0.6.5
3303
+ ## either 1.13.0, itertools 0.10.5, itertools 0.13.0, petgraph 0.6.5
3304
3304
 
3305
3305
  ```
3306
3306
  Copyright (c) 2015
@@ -3443,7 +3443,7 @@ DEALINGS IN THE SOFTWARE.
3443
3443
 
3444
3444
  ```
3445
3445
 
3446
- ## gimli 0.31.0, heck 0.5.0, peeking_take_while 0.1.2, unicode-bidi 0.3.15, unicode-normalization 0.1.23
3446
+ ## gimli 0.31.0, heck 0.5.0, unicode-bidi 0.3.15, unicode-normalization 0.1.23
3447
3447
 
3448
3448
  ```
3449
3449
  Copyright (c) 2015 The Rust Project Developers
@@ -6845,38 +6845,6 @@ SOFTWARE.
6845
6845
 
6846
6846
  ```
6847
6847
 
6848
- ## lazycell 1.3.0
6849
-
6850
- ```
6851
- Original work Copyright (c) 2014 The Rust Project Developers
6852
- Modified work Copyright (c) 2016-2018 Nikita Pekin and lazycell contributors
6853
-
6854
- Permission is hereby granted, free of charge, to any
6855
- person obtaining a copy of this software and associated
6856
- documentation files (the "Software"), to deal in the
6857
- Software without restriction, including without
6858
- limitation the rights to use, copy, modify, merge,
6859
- publish, distribute, sublicense, and/or sell copies of
6860
- the Software, and to permit persons to whom the Software
6861
- is furnished to do so, subject to the following
6862
- conditions:
6863
-
6864
- The above copyright notice and this permission notice
6865
- shall be included in all copies or substantial portions
6866
- of the Software.
6867
-
6868
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
6869
- ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
6870
- TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
6871
- PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
6872
- SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
6873
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
6874
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
6875
- IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
6876
- DEALINGS IN THE SOFTWARE.
6877
-
6878
- ```
6879
-
6880
6848
  ## curve25519-dalek-derive 0.1.1, adler2 2.0.0, anyhow 1.0.88, async-trait 0.1.82, atomic-waker 1.1.2, displaydoc 0.2.5, dyn-clone 1.0.17, fastrand 2.1.1, home 0.5.9, itoa 1.0.11, linkme-impl 0.3.28, linkme 0.3.28, linux-raw-sys 0.4.14, minimal-lexical 0.2.1, num_enum 0.7.3, num_enum_derive 0.7.3, once_cell 1.19.0, paste 1.0.15, pin-project-internal 1.1.5, pin-project-lite 0.2.14, pin-project 1.1.5, prettyplease 0.2.22, proc-macro-crate 3.2.0, proc-macro2 1.0.86, quote 1.0.37, rustc-hash 1.1.0, rustix 0.38.37, rustversion 1.0.17, semver 1.0.23, send_wrapper 0.6.0, serde 1.0.210, serde_derive 1.0.210, serde_json 1.0.128, syn-mid 0.6.0, syn 1.0.109, syn 2.0.77, thiserror-impl 1.0.63, thiserror 1.0.63, unicode-ident 1.0.13, utf-8 0.7.6
6881
6849
 
6882
6850
  ```
package/dist/net.d.ts CHANGED
@@ -169,6 +169,21 @@ export declare class UnauthenticatedChatService implements ChatService {
169
169
  }): Promise<Native.ChatResponse>;
170
170
  }
171
171
  export declare function buildHttpRequest(chatRequest: ChatRequest): Wrapper<Native.HttpRequest>;
172
+ export type NetConstructorOptions = Readonly<{
173
+ localTestServer?: false;
174
+ env: Environment;
175
+ userAgent: string;
176
+ } | {
177
+ localTestServer: true;
178
+ userAgent: string;
179
+ TESTING_localServer_chatPort: number;
180
+ TESTING_localServer_cdsiPort: number;
181
+ TESTING_localServer_svr2Port: number;
182
+ TESTING_localServer_svr3SgxPort: number;
183
+ TESTING_localServer_svr3NitroPort: number;
184
+ TESTING_localServer_svr3Tpm2SnpPort: number;
185
+ TESTING_localServer_rootCertificateDer: Buffer;
186
+ }>;
172
187
  export declare class Net {
173
188
  private readonly asyncContext;
174
189
  private readonly connectionManager;
@@ -176,7 +191,7 @@ export declare class Net {
176
191
  * Instance of the {@link Svr3Client} to access SVR3.
177
192
  */
178
193
  svr3: Svr3Client;
179
- constructor(env: Environment, userAgent: string);
194
+ constructor(options: NetConstructorOptions);
180
195
  /**
181
196
  * Creates a new instance of {@link AuthenticatedChatService}.
182
197
  *
package/dist/net.js CHANGED
@@ -141,9 +141,14 @@ function buildHttpRequest(chatRequest) {
141
141
  }
142
142
  exports.buildHttpRequest = buildHttpRequest;
143
143
  class Net {
144
- constructor(env, userAgent) {
144
+ constructor(options) {
145
145
  this.asyncContext = new TokioAsyncContext(Native.TokioAsyncContext_new());
146
- this.connectionManager = newNativeHandle(Native.ConnectionManager_new(env, userAgent));
146
+ if (options.localTestServer) {
147
+ this.connectionManager = newNativeHandle(Native.TESTING_ConnectionManager_newLocalOverride(options.userAgent, options.TESTING_localServer_chatPort, options.TESTING_localServer_cdsiPort, options.TESTING_localServer_svr2Port, options.TESTING_localServer_svr3SgxPort, options.TESTING_localServer_svr3NitroPort, options.TESTING_localServer_svr3Tpm2SnpPort, options.TESTING_localServer_rootCertificateDer));
148
+ }
149
+ else {
150
+ this.connectionManager = newNativeHandle(Native.ConnectionManager_new(options.env, options.userAgent));
151
+ }
147
152
  this.svr3 = new Svr3ClientImpl(this.asyncContext, this.connectionManager);
148
153
  }
149
154
  /**
package/dist/pin.d.ts CHANGED
@@ -1,15 +1,3 @@
1
- /**
2
- * The randomly-generated user-memorized entropy used to derive the backup key,
3
- * with other possible future uses.
4
- *
5
- * Contains log_2(36^64) = ~330 bits of entropy.
6
- */
7
- export declare class AccountEntropyPool {
8
- /**
9
- * Randomly generates an Account Entropy Pool and returns the cannonical string
10
- * representation of that pool.
11
- *
12
- * @returns cryptographically random 64 character string of characters a-z, 0-9
13
- */
14
- static generate(): string;
15
- }
1
+ export {
2
+ /** @deprecated AccountEntropyPool was moved to 'AccountKeys' */
3
+ AccountEntropyPool, } from './AccountKeys';
package/dist/pin.js CHANGED
@@ -5,30 +5,7 @@
5
5
  //
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.AccountEntropyPool = void 0;
8
- /**
9
- * Cryptographic hashing, randomness generation, etc. related to SVR/Backup Keys.
10
- *
11
- * Currently only the Account Entropy Pool is exposed, because no other functionality is used on Desktop.
12
- *
13
- * @module Pin
14
- */
15
- const Native = require("../Native");
16
- /**
17
- * The randomly-generated user-memorized entropy used to derive the backup key,
18
- * with other possible future uses.
19
- *
20
- * Contains log_2(36^64) = ~330 bits of entropy.
21
- */
22
- class AccountEntropyPool {
23
- /**
24
- * Randomly generates an Account Entropy Pool and returns the cannonical string
25
- * representation of that pool.
26
- *
27
- * @returns cryptographically random 64 character string of characters a-z, 0-9
28
- */
29
- static generate() {
30
- return Native.AccountEntropyPool_Generate();
31
- }
32
- }
33
- exports.AccountEntropyPool = AccountEntropyPool;
8
+ var AccountKeys_1 = require("./AccountKeys");
9
+ /** @deprecated AccountEntropyPool was moved to 'AccountKeys' */
10
+ Object.defineProperty(exports, "AccountEntropyPool", { enumerable: true, get: function () { return AccountKeys_1.AccountEntropyPool; } });
34
11
  //# sourceMappingURL=pin.js.map
@@ -3,6 +3,7 @@ import ByteArray from '../internal/ByteArray';
3
3
  import GenericServerPublicParams from '../GenericServerPublicParams';
4
4
  import BackupAuthCredentialPresentation from './BackupAuthCredentialPresentation';
5
5
  import BackupLevel from './BackupLevel';
6
+ import BackupCredentialType from './BackupCredentialType';
6
7
  export default class BackupAuthCredential extends ByteArray {
7
8
  private readonly __type?;
8
9
  constructor(contents: Buffer);
@@ -10,4 +11,5 @@ export default class BackupAuthCredential extends ByteArray {
10
11
  presentWithRandom(serverParams: GenericServerPublicParams, random: Buffer): BackupAuthCredentialPresentation;
11
12
  getBackupId(): Buffer;
12
13
  getBackupLevel(): BackupLevel;
14
+ getType(): BackupCredentialType;
13
15
  }
@@ -10,6 +10,7 @@ const ByteArray_1 = require("../internal/ByteArray");
10
10
  const Constants_1 = require("../internal/Constants");
11
11
  const BackupAuthCredentialPresentation_1 = require("./BackupAuthCredentialPresentation");
12
12
  const BackupLevel_1 = require("./BackupLevel");
13
+ const BackupCredentialType_1 = require("./BackupCredentialType");
13
14
  class BackupAuthCredential extends ByteArray_1.default {
14
15
  constructor(contents) {
15
16
  super(contents, Native.BackupAuthCredential_CheckValidContents);
@@ -31,6 +32,13 @@ class BackupAuthCredential extends ByteArray_1.default {
31
32
  }
32
33
  return n;
33
34
  }
35
+ getType() {
36
+ const n = Native.BackupAuthCredential_GetType(this.contents);
37
+ if (!(n in BackupCredentialType_1.default)) {
38
+ throw new TypeError(`Invalid BackupCredentialType ${n}`);
39
+ }
40
+ return n;
41
+ }
34
42
  }
35
43
  exports.default = BackupAuthCredential;
36
44
  //# sourceMappingURL=BackupAuthCredential.js.map
@@ -2,10 +2,12 @@
2
2
  import ByteArray from '../internal/ByteArray';
3
3
  import GenericServerSecretParams from '../GenericServerSecretParams';
4
4
  import BackupLevel from './BackupLevel';
5
+ import BackupCredentialType from './BackupCredentialType';
5
6
  export default class BackupAuthCredentialPresentation extends ByteArray {
6
7
  private readonly __type?;
7
8
  constructor(contents: Buffer);
8
9
  verify(serverParams: GenericServerSecretParams, now?: Date): void;
9
10
  getBackupId(): Buffer;
10
11
  getBackupLevel(): BackupLevel;
12
+ getType(): BackupCredentialType;
11
13
  }
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  const ByteArray_1 = require("../internal/ByteArray");
8
8
  const Native = require("../../../Native");
9
9
  const BackupLevel_1 = require("./BackupLevel");
10
+ const BackupCredentialType_1 = require("./BackupCredentialType");
10
11
  class BackupAuthCredentialPresentation extends ByteArray_1.default {
11
12
  constructor(contents) {
12
13
  super(contents, Native.BackupAuthCredentialPresentation_CheckValidContents);
@@ -24,6 +25,13 @@ class BackupAuthCredentialPresentation extends ByteArray_1.default {
24
25
  }
25
26
  return n;
26
27
  }
28
+ getType() {
29
+ const n = Native.BackupAuthCredentialPresentation_GetType(this.contents);
30
+ if (!(n in BackupCredentialType_1.default)) {
31
+ throw new TypeError(`Invalid BackupCredentialType ${n}`);
32
+ }
33
+ return n;
34
+ }
27
35
  }
28
36
  exports.default = BackupAuthCredentialPresentation;
29
37
  //# sourceMappingURL=BackupAuthCredentialPresentation.js.map
@@ -3,9 +3,10 @@ import ByteArray from '../internal/ByteArray';
3
3
  import GenericServerSecretParams from '../GenericServerSecretParams';
4
4
  import BackupAuthCredentialResponse from './BackupAuthCredentialResponse';
5
5
  import BackupLevel from './BackupLevel';
6
+ import BackupCredentialType from './BackupCredentialType';
6
7
  export default class BackupAuthCredentialRequest extends ByteArray {
7
8
  private readonly __type?;
8
9
  constructor(contents: Buffer);
9
- issueCredential(timestamp: number, backupLevel: BackupLevel, params: GenericServerSecretParams): BackupAuthCredentialResponse;
10
- issueCredentialWithRandom(timestamp: number, backupLevel: BackupLevel, params: GenericServerSecretParams, random: Buffer): BackupAuthCredentialResponse;
10
+ issueCredential(timestamp: number, backupLevel: BackupLevel, type: BackupCredentialType, params: GenericServerSecretParams): BackupAuthCredentialResponse;
11
+ issueCredentialWithRandom(timestamp: number, backupLevel: BackupLevel, type: BackupCredentialType, params: GenericServerSecretParams, random: Buffer): BackupAuthCredentialResponse;
11
12
  }
@@ -13,12 +13,12 @@ class BackupAuthCredentialRequest extends ByteArray_1.default {
13
13
  constructor(contents) {
14
14
  super(contents, Native.BackupAuthCredentialRequest_CheckValidContents);
15
15
  }
16
- issueCredential(timestamp, backupLevel, params) {
16
+ issueCredential(timestamp, backupLevel, type, params) {
17
17
  const random = (0, crypto_1.randomBytes)(Constants_1.RANDOM_LENGTH);
18
- return this.issueCredentialWithRandom(timestamp, backupLevel, params, random);
18
+ return this.issueCredentialWithRandom(timestamp, backupLevel, type, params, random);
19
19
  }
20
- issueCredentialWithRandom(timestamp, backupLevel, params, random) {
21
- return new BackupAuthCredentialResponse_1.default(Native.BackupAuthCredentialRequest_IssueDeterministic(this.contents, timestamp, backupLevel, params.contents, random));
20
+ issueCredentialWithRandom(timestamp, backupLevel, type, params, random) {
21
+ return new BackupAuthCredentialResponse_1.default(Native.BackupAuthCredentialRequest_IssueDeterministic(this.contents, timestamp, backupLevel, type, params.contents, random));
22
22
  }
23
23
  }
24
24
  exports.default = BackupAuthCredentialRequest;
@@ -0,0 +1,5 @@
1
+ declare enum BackupCredentialType {
2
+ Messages = 1,
3
+ Media = 2
4
+ }
5
+ export default BackupCredentialType;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ //
3
+ // Copyright 2024 Signal Messenger, LLC.
4
+ // SPDX-License-Identifier: AGPL-3.0-only
5
+ //
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ // This must match the Rust version of the enum.
8
+ var BackupCredentialType;
9
+ (function (BackupCredentialType) {
10
+ BackupCredentialType[BackupCredentialType["Messages"] = 1] = "Messages";
11
+ BackupCredentialType[BackupCredentialType["Media"] = 2] = "Media";
12
+ })(BackupCredentialType || (BackupCredentialType = {}));
13
+ exports.default = BackupCredentialType;
14
+ //# sourceMappingURL=BackupCredentialType.js.map
@@ -1,5 +1,5 @@
1
1
  declare enum BackupLevel {
2
- Messages = 200,
3
- Media = 201
2
+ Free = 200,
3
+ Paid = 201
4
4
  }
5
5
  export default BackupLevel;
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  // This must match the Rust version of the enum.
8
8
  var BackupLevel;
9
9
  (function (BackupLevel) {
10
- BackupLevel[BackupLevel["Messages"] = 200] = "Messages";
11
- BackupLevel[BackupLevel["Media"] = 201] = "Media";
10
+ BackupLevel[BackupLevel["Free"] = 200] = "Free";
11
+ BackupLevel[BackupLevel["Paid"] = 201] = "Paid";
12
12
  })(BackupLevel || (BackupLevel = {}));
13
13
  exports.default = BackupLevel;
14
14
  //# sourceMappingURL=BackupLevel.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalapp/libsignal-client",
3
- "version": "0.58.3",
3
+ "version": "0.60.0",
4
4
  "license": "AGPL-3.0-only",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",