@signalapp/libsignal-client 0.82.0 → 0.83.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
@@ -270,13 +270,13 @@ export function ComparableBackup_GetComparableString(backup: Wrapper<ComparableB
270
270
  export function ComparableBackup_GetUnknownFields(backup: Wrapper<ComparableBackup>): string[];
271
271
  export function ComparableBackup_ReadUnencrypted(stream: InputStream, len: bigint, purpose: number): Promise<ComparableBackup>;
272
272
  export function ConnectionManager_clear_proxy(connectionManager: Wrapper<ConnectionManager>): void;
273
- export function ConnectionManager_new(environment: number, userAgent: string, remoteConfig: Wrapper<BridgedStringMap>): ConnectionManager;
273
+ export function ConnectionManager_new(environment: number, userAgent: string, remoteConfig: Wrapper<BridgedStringMap>, buildVariant: number): ConnectionManager;
274
274
  export function ConnectionManager_on_network_change(connectionManager: Wrapper<ConnectionManager>): void;
275
275
  export function ConnectionManager_set_censorship_circumvention_enabled(connectionManager: Wrapper<ConnectionManager>, enabled: boolean): void;
276
276
  export function ConnectionManager_set_invalid_proxy(connectionManager: Wrapper<ConnectionManager>): void;
277
277
  export function ConnectionManager_set_ipv6_enabled(connectionManager: Wrapper<ConnectionManager>, ipv6Enabled: boolean): void;
278
278
  export function ConnectionManager_set_proxy(connectionManager: Wrapper<ConnectionManager>, proxy: Wrapper<ConnectionProxyConfig>): void;
279
- export function ConnectionManager_set_remote_config(connectionManager: Wrapper<ConnectionManager>, remoteConfig: Wrapper<BridgedStringMap>): void;
279
+ export function ConnectionManager_set_remote_config(connectionManager: Wrapper<ConnectionManager>, remoteConfig: Wrapper<BridgedStringMap>, buildVariant: number): void;
280
280
  export function ConnectionProxyConfig_new(scheme: string, host: string, port: number, username: string | null, password: string | null): ConnectionProxyConfig;
281
281
  export function CreateCallLinkCredentialPresentation_CheckValidContents(presentationBytes: Uint8Array): void;
282
282
  export function CreateCallLinkCredentialPresentation_Verify(presentationBytes: Uint8Array, roomId: Uint8Array, now: Timestamp, serverParamsBytes: Uint8Array, callLinkParamsBytes: Uint8Array): void;
@@ -503,7 +503,7 @@ export function SealedSenderDecryptionResult_GetSenderE164(obj: Wrapper<SealedSe
503
503
  export function SealedSenderDecryptionResult_GetSenderUuid(obj: Wrapper<SealedSenderDecryptionResult>): string;
504
504
  export function SealedSenderDecryptionResult_Message(obj: Wrapper<SealedSenderDecryptionResult>): Uint8Array;
505
505
  export function SealedSenderMultiRecipientMessage_Parse(buffer: Uint8Array): SealedSenderMultiRecipientMessage;
506
- export function SealedSender_DecryptMessage(message: Uint8Array, trustRoot: Wrapper<PublicKey>, timestamp: Timestamp, localE164: string | null, localUuid: string, localDeviceId: number, sessionStore: SessionStore, identityStore: IdentityKeyStore, prekeyStore: PreKeyStore, signedPrekeyStore: SignedPreKeyStore, kyberPrekeyStore: KyberPreKeyStore, usePqRatchet: boolean): Promise<SealedSenderDecryptionResult>;
506
+ export function SealedSender_DecryptMessage(message: Uint8Array, trustRoot: Wrapper<PublicKey>, timestamp: Timestamp, localE164: string | null, localUuid: string, localDeviceId: number, sessionStore: SessionStore, identityStore: IdentityKeyStore, prekeyStore: PreKeyStore, signedPrekeyStore: SignedPreKeyStore, kyberPrekeyStore: KyberPreKeyStore): Promise<SealedSenderDecryptionResult>;
507
507
  export function SealedSender_DecryptToUsmc(ctext: Uint8Array, identityStore: IdentityKeyStore): Promise<UnidentifiedSenderMessageContent>;
508
508
  export function SealedSender_Encrypt(destination: Wrapper<ProtocolAddress>, content: Wrapper<UnidentifiedSenderMessageContent>, identityKeyStore: IdentityKeyStore): Promise<Uint8Array>;
509
509
  export function SealedSender_MultiRecipientEncrypt(recipients: Wrapper<ProtocolAddress>[], recipientSessions: Wrapper<SessionRecord>[], excludedRecipients: Uint8Array, content: Wrapper<UnidentifiedSenderMessageContent>, identityKeyStore: IdentityKeyStore): Promise<Uint8Array>;
@@ -579,8 +579,8 @@ export function ServiceId_ParseFromServiceIdString(input: string): Uint8Array;
579
579
  export function ServiceId_ServiceIdBinary(value: Uint8Array): Uint8Array;
580
580
  export function ServiceId_ServiceIdLog(value: Uint8Array): string;
581
581
  export function ServiceId_ServiceIdString(value: Uint8Array): string;
582
- export function SessionBuilder_ProcessPreKeyBundle(bundle: Wrapper<PreKeyBundle>, protocolAddress: Wrapper<ProtocolAddress>, sessionStore: SessionStore, identityKeyStore: IdentityKeyStore, now: Timestamp, usePqRatchet: boolean): Promise<void>;
583
- export function SessionCipher_DecryptPreKeySignalMessage(message: Wrapper<PreKeySignalMessage>, protocolAddress: Wrapper<ProtocolAddress>, sessionStore: SessionStore, identityKeyStore: IdentityKeyStore, prekeyStore: PreKeyStore, signedPrekeyStore: SignedPreKeyStore, kyberPrekeyStore: KyberPreKeyStore, usePqRatchet: boolean): Promise<Uint8Array>;
582
+ export function SessionBuilder_ProcessPreKeyBundle(bundle: Wrapper<PreKeyBundle>, protocolAddress: Wrapper<ProtocolAddress>, sessionStore: SessionStore, identityKeyStore: IdentityKeyStore, now: Timestamp): Promise<void>;
583
+ export function SessionCipher_DecryptPreKeySignalMessage(message: Wrapper<PreKeySignalMessage>, protocolAddress: Wrapper<ProtocolAddress>, sessionStore: SessionStore, identityKeyStore: IdentityKeyStore, prekeyStore: PreKeyStore, signedPrekeyStore: SignedPreKeyStore, kyberPrekeyStore: KyberPreKeyStore): Promise<Uint8Array>;
584
584
  export function SessionCipher_DecryptSignalMessage(message: Wrapper<SignalMessage>, protocolAddress: Wrapper<ProtocolAddress>, sessionStore: SessionStore, identityKeyStore: IdentityKeyStore): Promise<Uint8Array>;
585
585
  export function SessionCipher_EncryptMessage(ptext: Uint8Array, protocolAddress: Wrapper<ProtocolAddress>, sessionStore: SessionStore, identityKeyStore: IdentityKeyStore, now: Timestamp): Promise<CiphertextMessage>;
586
586
  export function SessionRecord_ArchiveCurrentState(sessionRecord: Wrapper<SessionRecord>): void;
package/dist/Address.js CHANGED
@@ -4,6 +4,7 @@
4
4
  //
5
5
  import Native from '../Native.js';
6
6
  import * as uuid from 'uuid';
7
+ import { Buffer } from 'node:buffer';
7
8
  export var ServiceIdKind;
8
9
  (function (ServiceIdKind) {
9
10
  ServiceIdKind[ServiceIdKind["Aci"] = 0] = "Aci";
@@ -2,6 +2,7 @@
2
2
  // Copyright 2024 Signal Messenger, LLC.
3
3
  // SPDX-License-Identifier: AGPL-3.0-only
4
4
  //
5
+ import { Buffer } from 'node:buffer';
5
6
  import Native from '../Native.js';
6
7
  /**
7
8
  * A parsed Sealed Sender v2 "SentMessage", ready to be fanned out to multiple recipients.
@@ -2,8 +2,9 @@
2
2
  // Copyright 2023 Signal Messenger, LLC.
3
3
  // SPDX-License-Identifier: AGPL-3.0-only
4
4
  //
5
- import Native from '../Native.js';
6
5
  import * as stream from 'node:stream';
6
+ import { Buffer } from 'node:buffer';
7
+ import Native from '../Native.js';
7
8
  import { LibSignalErrorBase, } from './Errors.js';
8
9
  export function everyNthByte(n) {
9
10
  return { kind: 'everyN', n: n };
package/dist/index.d.ts CHANGED
@@ -24,10 +24,6 @@ export declare enum ContentHint {
24
24
  Resendable = 1,
25
25
  Implicit = 2
26
26
  }
27
- export declare enum UsePQRatchet {
28
- Yes = 0,
29
- No = 1
30
- }
31
27
  export type Uuid = string;
32
28
  export declare function hkdf(outputLength: number, keyMaterial: Uint8Array, label: Uint8Array, salt: Uint8Array | null): Uint8Array;
33
29
  export declare class ScannableFingerprint {
@@ -379,10 +375,10 @@ export declare class DecryptionErrorMessage {
379
375
  deviceId(): number;
380
376
  ratchetKey(): PublicKey | undefined;
381
377
  }
382
- export declare function processPreKeyBundle(bundle: PreKeyBundle, address: ProtocolAddress, sessionStore: SessionStore, identityStore: IdentityKeyStore, usePqRatchet: UsePQRatchet, now?: Date): Promise<void>;
378
+ export declare function processPreKeyBundle(bundle: PreKeyBundle, address: ProtocolAddress, sessionStore: SessionStore, identityStore: IdentityKeyStore, now?: Date): Promise<void>;
383
379
  export declare function signalEncrypt(message: Uint8Array, address: ProtocolAddress, sessionStore: SessionStore, identityStore: IdentityKeyStore, now?: Date): Promise<CiphertextMessage>;
384
380
  export declare function signalDecrypt(message: SignalMessage, address: ProtocolAddress, sessionStore: SessionStore, identityStore: IdentityKeyStore): Promise<Uint8Array>;
385
- export declare function signalDecryptPreKey(message: PreKeySignalMessage, address: ProtocolAddress, sessionStore: SessionStore, identityStore: IdentityKeyStore, prekeyStore: PreKeyStore, signedPrekeyStore: SignedPreKeyStore, kyberPrekeyStore: KyberPreKeyStore, usePqRatchet: UsePQRatchet): Promise<Uint8Array>;
381
+ export declare function signalDecryptPreKey(message: PreKeySignalMessage, address: ProtocolAddress, sessionStore: SessionStore, identityStore: IdentityKeyStore, prekeyStore: PreKeyStore, signedPrekeyStore: SignedPreKeyStore, kyberPrekeyStore: KyberPreKeyStore): Promise<Uint8Array>;
386
382
  export declare function sealedSenderEncryptMessage(message: Uint8Array, address: ProtocolAddress, senderCert: SenderCertificate, sessionStore: SessionStore, identityStore: IdentityKeyStore): Promise<Uint8Array>;
387
383
  export declare function sealedSenderEncrypt(content: UnidentifiedSenderMessageContent, address: ProtocolAddress, identityStore: IdentityKeyStore): Promise<Uint8Array>;
388
384
  export type SealedSenderMultiRecipientEncryptOptions = {
@@ -395,7 +391,7 @@ export type SealedSenderMultiRecipientEncryptOptions = {
395
391
  export declare function sealedSenderMultiRecipientEncrypt(options: SealedSenderMultiRecipientEncryptOptions): Promise<Uint8Array>;
396
392
  export declare function sealedSenderMultiRecipientEncrypt(content: UnidentifiedSenderMessageContent, recipients: ProtocolAddress[], identityStore: IdentityKeyStore, sessionStore: SessionStore): Promise<Uint8Array>;
397
393
  export declare function sealedSenderMultiRecipientMessageForSingleRecipient(message: Uint8Array): Uint8Array;
398
- export declare function sealedSenderDecryptMessage(message: Uint8Array, trustRoot: PublicKey, timestamp: number, localE164: string | null, localUuid: string, localDeviceId: number, sessionStore: SessionStore, identityStore: IdentityKeyStore, prekeyStore: PreKeyStore, signedPrekeyStore: SignedPreKeyStore, kyberPrekeyStore: KyberPreKeyStore, usePqRatchet: UsePQRatchet): Promise<SealedSenderDecryptionResult>;
394
+ export declare function sealedSenderDecryptMessage(message: Uint8Array, trustRoot: PublicKey, timestamp: number, localE164: string | null, localUuid: string, localDeviceId: number, sessionStore: SessionStore, identityStore: IdentityKeyStore, prekeyStore: PreKeyStore, signedPrekeyStore: SignedPreKeyStore, kyberPrekeyStore: KyberPreKeyStore): Promise<SealedSenderDecryptionResult>;
399
395
  export declare function sealedSenderDecryptToUsmc(message: Uint8Array, identityStore: IdentityKeyStore): Promise<UnidentifiedSenderMessageContent>;
400
396
  export declare class Cds2Client {
401
397
  readonly _nativeHandle: Native.SgxClientState;
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
  // Copyright 2020-2022 Signal Messenger, LLC.
3
3
  // SPDX-License-Identifier: AGPL-3.0-only
4
4
  //
5
+ import { Buffer } from 'node:buffer';
5
6
  import * as uuid from 'uuid';
6
7
  import * as Errors from './Errors.js';
7
8
  export * from './Errors.js';
@@ -36,11 +37,6 @@ export var ContentHint;
36
37
  ContentHint[ContentHint["Resendable"] = 1] = "Resendable";
37
38
  ContentHint[ContentHint["Implicit"] = 2] = "Implicit";
38
39
  })(ContentHint || (ContentHint = {}));
39
- export var UsePQRatchet;
40
- (function (UsePQRatchet) {
41
- UsePQRatchet[UsePQRatchet["Yes"] = 0] = "Yes";
42
- UsePQRatchet[UsePQRatchet["No"] = 1] = "No";
43
- })(UsePQRatchet || (UsePQRatchet = {}));
44
40
  export function hkdf(outputLength, keyMaterial, label, salt) {
45
41
  return Native.HKDF_DeriveSecrets(outputLength, keyMaterial, label, salt);
46
42
  }
@@ -787,8 +783,8 @@ export class DecryptionErrorMessage {
787
783
  }
788
784
  }
789
785
  }
790
- export function processPreKeyBundle(bundle, address, sessionStore, identityStore, usePqRatchet, now = new Date()) {
791
- return Native.SessionBuilder_ProcessPreKeyBundle(bundle, address, sessionStore, identityStore, now.getTime(), usePqRatchet == UsePQRatchet.Yes);
786
+ export function processPreKeyBundle(bundle, address, sessionStore, identityStore, now = new Date()) {
787
+ return Native.SessionBuilder_ProcessPreKeyBundle(bundle, address, sessionStore, identityStore, now.getTime());
792
788
  }
793
789
  export async function signalEncrypt(message, address, sessionStore, identityStore, now = new Date()) {
794
790
  return CiphertextMessage._fromNativeHandle(await Native.SessionCipher_EncryptMessage(message, address, sessionStore, identityStore, now.getTime()));
@@ -796,8 +792,8 @@ export async function signalEncrypt(message, address, sessionStore, identityStor
796
792
  export function signalDecrypt(message, address, sessionStore, identityStore) {
797
793
  return Native.SessionCipher_DecryptSignalMessage(message, address, sessionStore, identityStore);
798
794
  }
799
- export function signalDecryptPreKey(message, address, sessionStore, identityStore, prekeyStore, signedPrekeyStore, kyberPrekeyStore, usePqRatchet) {
800
- return Native.SessionCipher_DecryptPreKeySignalMessage(message, address, sessionStore, identityStore, prekeyStore, signedPrekeyStore, kyberPrekeyStore, usePqRatchet == UsePQRatchet.Yes);
795
+ export function signalDecryptPreKey(message, address, sessionStore, identityStore, prekeyStore, signedPrekeyStore, kyberPrekeyStore) {
796
+ return Native.SessionCipher_DecryptPreKeySignalMessage(message, address, sessionStore, identityStore, prekeyStore, signedPrekeyStore, kyberPrekeyStore);
801
797
  }
802
798
  export async function sealedSenderEncryptMessage(message, address, senderCert, sessionStore, identityStore) {
803
799
  const ciphertext = await signalEncrypt(message, address, sessionStore, identityStore);
@@ -830,8 +826,8 @@ export async function sealedSenderMultiRecipientEncrypt(contentOrOptions, recipi
830
826
  export function sealedSenderMultiRecipientMessageForSingleRecipient(message) {
831
827
  return Native.SealedSender_MultiRecipientMessageForSingleRecipient(message);
832
828
  }
833
- export async function sealedSenderDecryptMessage(message, trustRoot, timestamp, localE164, localUuid, localDeviceId, sessionStore, identityStore, prekeyStore, signedPrekeyStore, kyberPrekeyStore, usePqRatchet) {
834
- const ssdr = await Native.SealedSender_DecryptMessage(message, trustRoot, timestamp, localE164, localUuid, localDeviceId, sessionStore, identityStore, prekeyStore, signedPrekeyStore, kyberPrekeyStore, usePqRatchet == UsePQRatchet.Yes);
829
+ export async function sealedSenderDecryptMessage(message, trustRoot, timestamp, localE164, localUuid, localDeviceId, sessionStore, identityStore, prekeyStore, signedPrekeyStore, kyberPrekeyStore) {
830
+ const ssdr = await Native.SealedSender_DecryptMessage(message, trustRoot, timestamp, localE164, localUuid, localDeviceId, sessionStore, identityStore, prekeyStore, signedPrekeyStore, kyberPrekeyStore);
835
831
  return SealedSenderDecryptionResult._fromNativeHandle(ssdr);
836
832
  }
837
833
  export async function sealedSenderDecryptToUsmc(message, identityStore) {
@@ -124,6 +124,8 @@ export interface Client {
124
124
  * @throws {ChatServiceInactive} if the chat connection has been closed.
125
125
  * @throws {IoError} if an error occurred while communicating with the
126
126
  * server.
127
+ * @throws {RateLimitedError} if the server is rate limiting this client. This is **retryable**
128
+ * after waiting the designated delay.
127
129
  * */
128
130
  search: (request: Request, store: Store, options?: Readonly<Options>) => Promise<void>;
129
131
  /**
@@ -155,6 +157,8 @@ export interface Client {
155
157
  * @throws {ChatServiceInactive} if the chat connection has been closed.
156
158
  * @throws {IoError} if an error occurred while communicating with the
157
159
  * server.
160
+ * @throws {RateLimitedError} if the server is rate limiting this client. This is **retryable**
161
+ * after waiting the designated delay.
158
162
  */
159
163
  monitor: (request: MonitorRequest, store: Store, options?: Readonly<Options>) => Promise<void>;
160
164
  }
@@ -166,5 +170,5 @@ export declare class ClientImpl implements Client {
166
170
  search(request: Request, store: Store, options?: Readonly<Options>): Promise<void>;
167
171
  monitor(request: MonitorRequest, store: Store, options?: Readonly<Options>): Promise<void>;
168
172
  private updateDistinguished;
169
- private getLatestDistinguished;
173
+ _getLatestDistinguished(store: Store, options: Readonly<Options>): Promise<Uint8Array>;
170
174
  }
@@ -23,7 +23,7 @@ export class ClientImpl {
23
23
  this.env = env;
24
24
  }
25
25
  async search(request, store, options) {
26
- const distinguished = await this.getLatestDistinguished(store, options ?? {});
26
+ const distinguished = await this._getLatestDistinguished(store, options ?? {});
27
27
  const { abortSignal } = options ?? {};
28
28
  const { aciInfo: { aci, identityKey: aciIdentityKey }, e164Info, usernameHash, } = request;
29
29
  const { e164, unidentifiedAccessKey } = e164Info ?? {
@@ -34,7 +34,7 @@ export class ClientImpl {
34
34
  await store.setAccountData(aci, accountData);
35
35
  }
36
36
  async monitor(request, store, options) {
37
- const distinguished = await this.getLatestDistinguished(store, options ?? {});
37
+ const distinguished = await this._getLatestDistinguished(store, options ?? {});
38
38
  const { abortSignal } = options ?? {};
39
39
  const { aciInfo: { aci, identityKey: aciIdentityKey }, e164Info, usernameHash, mode, } = request;
40
40
  const { e164, unidentifiedAccessKey } = e164Info ?? {
@@ -49,7 +49,7 @@ export class ClientImpl {
49
49
  await store.setLastDistinguishedTreeHead(bytes);
50
50
  return bytes;
51
51
  }
52
- async getLatestDistinguished(store, options) {
52
+ async _getLatestDistinguished(store, options) {
53
53
  return ((await store.getLastDistinguishedTreeHead()) ??
54
54
  (await this.updateDistinguished(store, options)));
55
55
  }
@@ -2,6 +2,7 @@
2
2
  // Copyright 2025 Signal Messenger, LLC.
3
3
  // SPDX-License-Identifier: AGPL-3.0-only
4
4
  //
5
+ import { Buffer } from 'node:buffer';
5
6
  import Native from '../../../Native.js';
6
7
  import { Aci } from '../../Address.js';
7
8
  import { UnauthenticatedChatConnection } from '../Chat.js';
package/dist/net.d.ts CHANGED
@@ -13,6 +13,19 @@ export declare enum Environment {
13
13
  Staging = 0,
14
14
  Production = 1
15
15
  }
16
+ /**
17
+ * Build variant for remote config key selection.
18
+ *
19
+ * This must match the libsignal-bridge Rust enum of the same name.
20
+ *
21
+ * - `Production`: Use for release builds. Only uses base remote config keys without suffixes.
22
+ * - `Beta`: Use for all other builds (nightly, alpha, internal, public betas). Prefers
23
+ * keys with a `.beta` suffix, falling back to base keys if the suffixed key is not present.
24
+ */
25
+ export declare enum BuildVariant {
26
+ Production = 0,
27
+ Beta = 1
28
+ }
16
29
  export type ServiceAuth = {
17
30
  username: string;
18
31
  password: string;
@@ -36,6 +49,7 @@ export type NetConstructorOptions = Readonly<{
36
49
  env: Environment;
37
50
  userAgent: string;
38
51
  remoteConfig?: Map<string, string>;
52
+ buildVariant?: BuildVariant;
39
53
  } | {
40
54
  localTestServer: true;
41
55
  userAgent: string;
@@ -208,9 +222,30 @@ export declare class Net {
208
222
  * Only new connections made *after* this call will use the new remote config settings.
209
223
  * Existing connections are not affected.
210
224
  *
225
+ * @deprecated Calling without buildVariant is deprecated. Please explicitly specify BuildVariant.Production or BuildVariant.Beta.
211
226
  * @param remoteConfig A map containing preprocessed libsignal configuration keys and their associated values.
212
227
  */
213
228
  setRemoteConfig(remoteConfig: ReadonlyMap<string, string>): void;
229
+ /**
230
+ * Updates libsignal's remote configuration settings.
231
+ *
232
+ * The provided configuration map must conform to the following requirements:
233
+ * - Each key represents an enabled configuration and directly indicates that the setting is enabled.
234
+ * - Keys must have had the platform-specific prefix (e.g., `"desktop.libsignal."`) removed.
235
+ * - Entries explicitly disabled by the server must not appear in the map.
236
+ * - Values originally set to `null` by the server must be represented as empty strings.
237
+ * - Values should otherwise maintain the same format as they are returned by the server.
238
+ *
239
+ * These constraints ensure configurations passed to libsignal precisely reflect enabled
240
+ * server-provided settings without ambiguity.
241
+ *
242
+ * Only new connections made *after* this call will use the new remote config settings.
243
+ * Existing connections are not affected.
244
+ *
245
+ * @param remoteConfig A map containing preprocessed libsignal configuration keys and their associated values.
246
+ * @param buildVariant The build variant (BuildVariant.Production or BuildVariant.Beta) that determines which remote config keys to use.
247
+ */
248
+ setRemoteConfig(remoteConfig: ReadonlyMap<string, string>, buildVariant: BuildVariant): void;
214
249
  /**
215
250
  * Notifies libsignal that the network has changed.
216
251
  *
package/dist/net.js CHANGED
@@ -19,6 +19,20 @@ export var Environment;
19
19
  Environment[Environment["Staging"] = 0] = "Staging";
20
20
  Environment[Environment["Production"] = 1] = "Production";
21
21
  })(Environment || (Environment = {}));
22
+ /**
23
+ * Build variant for remote config key selection.
24
+ *
25
+ * This must match the libsignal-bridge Rust enum of the same name.
26
+ *
27
+ * - `Production`: Use for release builds. Only uses base remote config keys without suffixes.
28
+ * - `Beta`: Use for all other builds (nightly, alpha, internal, public betas). Prefers
29
+ * keys with a `.beta` suffix, falling back to base keys if the suffixed key is not present.
30
+ */
31
+ export var BuildVariant;
32
+ (function (BuildVariant) {
33
+ BuildVariant[BuildVariant["Production"] = 0] = "Production";
34
+ BuildVariant[BuildVariant["Beta"] = 1] = "Beta";
35
+ })(BuildVariant || (BuildVariant = {}));
22
36
  /** Low-level async runtime control, mostly just exported for testing. */
23
37
  export class TokioAsyncContext {
24
38
  constructor(handle) {
@@ -50,7 +64,8 @@ export class Net {
50
64
  this._connectionManager = newNativeHandle(Native.TESTING_ConnectionManager_newLocalOverride(options.userAgent, options.TESTING_localServer_chatPort, options.TESTING_localServer_cdsiPort, options.TESTING_localServer_svr2Port, options.TESTING_localServer_svrBPort, options.TESTING_localServer_rootCertificateDer));
51
65
  }
52
66
  else {
53
- this._connectionManager = newNativeHandle(Native.ConnectionManager_new(options.env, options.userAgent, new BridgedStringMap(options.remoteConfig || new Map())));
67
+ const { env, userAgent, remoteConfig = new Map(), buildVariant = BuildVariant.Production, } = options;
68
+ this._connectionManager = newNativeHandle(Native.ConnectionManager_new(env, userAgent, new BridgedStringMap(remoteConfig), buildVariant));
54
69
  }
55
70
  }
56
71
  /**
@@ -232,26 +247,8 @@ export class Net {
232
247
  clearProxy() {
233
248
  Native.ConnectionManager_clear_proxy(this._connectionManager);
234
249
  }
235
- /**
236
- * Updates libsignal's remote configuration settings.
237
- *
238
- * The provided configuration map must conform to the following requirements:
239
- * - Each key represents an enabled configuration and directly indicates that the setting is enabled.
240
- * - Keys must have had the platform-specific prefix (e.g., `"desktop.libsignal."`) removed.
241
- * - Entries explicitly disabled by the server must not appear in the map.
242
- * - Values originally set to `null` by the server must be represented as empty strings.
243
- * - Values should otherwise maintain the same format as they are returned by the server.
244
- *
245
- * These constraints ensure configurations passed to libsignal precisely reflect enabled
246
- * server-provided settings without ambiguity.
247
- *
248
- * Only new connections made *after* this call will use the new remote config settings.
249
- * Existing connections are not affected.
250
- *
251
- * @param remoteConfig A map containing preprocessed libsignal configuration keys and their associated values.
252
- */
253
- setRemoteConfig(remoteConfig) {
254
- Native.ConnectionManager_set_remote_config(this._connectionManager, new BridgedStringMap(remoteConfig));
250
+ setRemoteConfig(remoteConfig, buildVariant = BuildVariant.Production) {
251
+ Native.ConnectionManager_set_remote_config(this._connectionManager, new BridgedStringMap(remoteConfig), buildVariant);
255
252
  }
256
253
  /**
257
254
  * Notifies libsignal that the network has changed.
@@ -3,6 +3,7 @@
3
3
  // SPDX-License-Identifier: AGPL-3.0-only
4
4
  //
5
5
  import ByteArray from '../internal/ByteArray.js';
6
+ import { Buffer } from 'node:buffer';
6
7
  class GroupIdentifier extends ByteArray {
7
8
  constructor(contents) {
8
9
  super(contents, GroupIdentifier.checkLength(GroupIdentifier.SIZE));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalapp/libsignal-client",
3
- "version": "0.82.0",
3
+ "version": "0.83.0",
4
4
  "license": "AGPL-3.0-only",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -56,7 +56,7 @@
56
56
  "eslint-import-resolver-typescript": "^2.0.0",
57
57
  "eslint-plugin-chai-expect": "^3.1.0",
58
58
  "eslint-plugin-header": "^3.1.0",
59
- "eslint-plugin-import": "^2.26.0",
59
+ "eslint-plugin-import": "^2.32.0",
60
60
  "eslint-plugin-jsdoc": "^48.2.0",
61
61
  "eslint-plugin-mocha": "^10.1.0",
62
62
  "eslint-plugin-node-import": "1.0.5",