@signalapp/libsignal-client 0.84.0 → 0.85.1

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.
Files changed (107) hide show
  1. package/dist/AccountKeys.js +1 -1
  2. package/dist/Address.d.ts +1 -1
  3. package/dist/Address.js +1 -1
  4. package/dist/EcKeys.d.ts +1 -1
  5. package/dist/EcKeys.js +1 -1
  6. package/dist/Errors.d.ts +38 -4
  7. package/dist/Errors.js +24 -1
  8. package/dist/MessageBackup.d.ts +1 -1
  9. package/dist/MessageBackup.js +1 -1
  10. package/dist/Minidump.js +1 -1
  11. package/dist/Mp4Sanitizer.d.ts +1 -1
  12. package/dist/Mp4Sanitizer.js +1 -1
  13. package/dist/Native.d.ts +365 -0
  14. package/dist/Native.js +14 -0
  15. package/dist/SealedSenderMultiRecipientMessage.d.ts +1 -1
  16. package/dist/SealedSenderMultiRecipientMessage.js +1 -1
  17. package/dist/WebpSanitizer.js +1 -1
  18. package/dist/acknowledgments.md +1 -1
  19. package/dist/incremental_mac.js +9 -2
  20. package/dist/index.d.ts +3 -2
  21. package/dist/index.js +2 -1
  22. package/dist/internal.d.ts +1 -1
  23. package/dist/internal.js +1 -1
  24. package/dist/io.d.ts +1 -1
  25. package/dist/net/CDSI.d.ts +1 -1
  26. package/dist/net/CDSI.js +1 -1
  27. package/dist/net/Chat.d.ts +7 -6
  28. package/dist/net/Chat.js +4 -3
  29. package/dist/net/FakeChat.d.ts +31 -0
  30. package/dist/net/FakeChat.js +67 -0
  31. package/dist/net/KeyTransparency.d.ts +1 -1
  32. package/dist/net/KeyTransparency.js +1 -1
  33. package/dist/net/Registration.d.ts +5 -4
  34. package/dist/net/Registration.js +8 -4
  35. package/dist/net/SvrB.d.ts +1 -1
  36. package/dist/net/SvrB.js +1 -1
  37. package/dist/net/chat/UnauthMessagesService.d.ts +48 -0
  38. package/dist/net/chat/UnauthMessagesService.js +24 -0
  39. package/dist/net/chat/UnauthUsernamesService.d.ts +19 -0
  40. package/dist/net/chat/UnauthUsernamesService.js +6 -1
  41. package/dist/net.d.ts +2 -1
  42. package/dist/net.js +2 -1
  43. package/dist/usernames.js +1 -1
  44. package/dist/uuid.d.ts +1 -0
  45. package/dist/uuid.js +6 -0
  46. package/dist/zkgroup/GenericServerPublicParams.js +1 -1
  47. package/dist/zkgroup/GenericServerSecretParams.js +1 -1
  48. package/dist/zkgroup/ServerPublicParams.d.ts +1 -1
  49. package/dist/zkgroup/ServerPublicParams.js +1 -1
  50. package/dist/zkgroup/ServerSecretParams.d.ts +1 -1
  51. package/dist/zkgroup/ServerSecretParams.js +1 -1
  52. package/dist/zkgroup/auth/AuthCredentialPresentation.js +1 -1
  53. package/dist/zkgroup/auth/AuthCredentialWithPni.js +1 -1
  54. package/dist/zkgroup/auth/AuthCredentialWithPniResponse.js +1 -1
  55. package/dist/zkgroup/auth/ClientZkAuthOperations.js +1 -1
  56. package/dist/zkgroup/auth/ServerZkAuthOperations.js +1 -1
  57. package/dist/zkgroup/backups/BackupAuthCredential.js +1 -1
  58. package/dist/zkgroup/backups/BackupAuthCredentialPresentation.js +1 -1
  59. package/dist/zkgroup/backups/BackupAuthCredentialRequest.js +1 -1
  60. package/dist/zkgroup/backups/BackupAuthCredentialRequestContext.js +1 -1
  61. package/dist/zkgroup/backups/BackupAuthCredentialResponse.js +1 -1
  62. package/dist/zkgroup/calllinks/CallLinkAuthCredential.js +1 -1
  63. package/dist/zkgroup/calllinks/CallLinkAuthCredentialPresentation.js +1 -1
  64. package/dist/zkgroup/calllinks/CallLinkAuthCredentialResponse.js +1 -1
  65. package/dist/zkgroup/calllinks/CallLinkPublicParams.js +1 -1
  66. package/dist/zkgroup/calllinks/CallLinkSecretParams.js +1 -1
  67. package/dist/zkgroup/calllinks/CreateCallLinkCredential.js +1 -1
  68. package/dist/zkgroup/calllinks/CreateCallLinkCredentialPresentation.js +1 -1
  69. package/dist/zkgroup/calllinks/CreateCallLinkCredentialRequest.js +1 -1
  70. package/dist/zkgroup/calllinks/CreateCallLinkCredentialRequestContext.js +1 -1
  71. package/dist/zkgroup/calllinks/CreateCallLinkCredentialResponse.js +1 -1
  72. package/dist/zkgroup/groups/ClientZkGroupCipher.js +1 -1
  73. package/dist/zkgroup/groups/GroupPublicParams.js +1 -1
  74. package/dist/zkgroup/groups/GroupSecretParams.js +1 -1
  75. package/dist/zkgroup/groups/ProfileKeyCiphertext.js +1 -1
  76. package/dist/zkgroup/groups/UuidCiphertext.js +1 -1
  77. package/dist/zkgroup/groupsend/GroupSendDerivedKeyPair.js +1 -1
  78. package/dist/zkgroup/groupsend/GroupSendEndorsement.js +1 -1
  79. package/dist/zkgroup/groupsend/GroupSendEndorsementsResponse.js +1 -1
  80. package/dist/zkgroup/groupsend/GroupSendFullToken.js +1 -1
  81. package/dist/zkgroup/groupsend/GroupSendToken.js +1 -1
  82. package/dist/zkgroup/internal/ByteArray.js +1 -1
  83. package/dist/zkgroup/profiles/ClientZkProfileOperations.js +1 -1
  84. package/dist/zkgroup/profiles/ExpiringProfileKeyCredential.js +1 -1
  85. package/dist/zkgroup/profiles/ExpiringProfileKeyCredentialResponse.js +1 -1
  86. package/dist/zkgroup/profiles/ProfileKey.js +1 -1
  87. package/dist/zkgroup/profiles/ProfileKeyCommitment.js +1 -1
  88. package/dist/zkgroup/profiles/ProfileKeyCredentialPresentation.js +1 -1
  89. package/dist/zkgroup/profiles/ProfileKeyCredentialRequest.js +1 -1
  90. package/dist/zkgroup/profiles/ProfileKeyCredentialRequestContext.js +1 -1
  91. package/dist/zkgroup/profiles/ServerZkProfileOperations.js +1 -1
  92. package/dist/zkgroup/receipts/ClientZkReceiptOperations.js +1 -1
  93. package/dist/zkgroup/receipts/ReceiptCredential.js +1 -1
  94. package/dist/zkgroup/receipts/ReceiptCredentialPresentation.js +1 -1
  95. package/dist/zkgroup/receipts/ReceiptCredentialRequest.js +1 -1
  96. package/dist/zkgroup/receipts/ReceiptCredentialRequestContext.js +1 -1
  97. package/dist/zkgroup/receipts/ReceiptCredentialResponse.js +1 -1
  98. package/dist/zkgroup/receipts/ServerZkReceiptOperations.js +1 -1
  99. package/package.json +4 -3
  100. package/prebuilds/darwin-arm64/@signalapp+libsignal-client.node +0 -0
  101. package/prebuilds/darwin-x64/@signalapp+libsignal-client.node +0 -0
  102. package/prebuilds/linux-arm64/@signalapp+libsignal-client.node +0 -0
  103. package/prebuilds/linux-x64/@signalapp+libsignal-client.node +0 -0
  104. package/prebuilds/win32-arm64/@signalapp+libsignal-client.node +0 -0
  105. package/prebuilds/win32-x64/@signalapp+libsignal-client.node +0 -0
  106. package/Native.d.ts +0 -819
  107. package/Native.js +0 -9
@@ -10,7 +10,7 @@
10
10
  * @module AccountKeys
11
11
  */
12
12
  import * as crypto from 'node:crypto';
13
- import Native from '../Native.js';
13
+ import * as Native from './Native.js';
14
14
  import ByteArray from './zkgroup/internal/ByteArray.js';
15
15
  import { PrivateKey } from './EcKeys.js';
16
16
  /**
package/dist/Address.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import Native from '../Native.js';
1
+ import * as Native from './Native.js';
2
2
  export declare enum ServiceIdKind {
3
3
  Aci = 0,
4
4
  Pni = 1
package/dist/Address.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 Native from '../Native.js';
5
+ import * as Native from './Native.js';
6
6
  import * as uuid from 'uuid';
7
7
  import { Buffer } from 'node:buffer';
8
8
  export var ServiceIdKind;
package/dist/EcKeys.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import Native from '../Native.js';
1
+ import * as Native from './Native.js';
2
2
  export declare class PublicKey {
3
3
  readonly _nativeHandle: Native.PublicKey;
4
4
  private constructor();
package/dist/EcKeys.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // Copyright 2020-2022 Signal Messenger, LLC.
3
3
  // SPDX-License-Identifier: AGPL-3.0-only
4
4
  //
5
- import Native from '../Native.js';
5
+ import * as Native from './Native.js';
6
6
  export class PublicKey {
7
7
  constructor(handle) {
8
8
  this._nativeHandle = handle;
package/dist/Errors.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ProtocolAddress } from './Address.js';
2
- import Native from '../Native.js';
1
+ import { ProtocolAddress, ServiceId } from './Address.js';
2
+ import * as Native from './Native.js';
3
3
  export declare enum ErrorCode {
4
4
  Generic = 0,
5
5
  DuplicatedMessage = 1,
@@ -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 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;
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);
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * @module MessageBackup
5
5
  */
6
- import Native from '../Native.js';
6
+ import * as Native from './Native.js';
7
7
  import { BackupForwardSecrecyToken, BackupKey } from './AccountKeys.js';
8
8
  import { Aci } from './Address.js';
9
9
  import { InputStream } from './io.js';
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * @module MessageBackup
9
9
  */
10
- import Native from '../Native.js';
10
+ import * as Native from './Native.js';
11
11
  import { BackupKey } from './AccountKeys.js';
12
12
  /**
13
13
  * Result of validating a message backup bundle.
package/dist/Minidump.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 Signal Messenger, LLC.
3
3
  // SPDX-License-Identifier: AGPL-3.0-only
4
4
  //
5
- import Native from '../Native.js';
5
+ import * as Native from './Native.js';
6
6
  export function toJSONString(buffer) {
7
7
  return Native.MinidumpToJSONString(buffer);
8
8
  }
@@ -25,7 +25,7 @@
25
25
  *
26
26
  * @module Mp4Sanitizer
27
27
  */
28
- import Native from '../Native.js';
28
+ import * as Native from './Native.js';
29
29
  import { InputStream } from './io.js';
30
30
  export declare class SanitizedMetadata {
31
31
  readonly _nativeHandle: Native.SanitizedMetadata;
@@ -29,7 +29,7 @@
29
29
  *
30
30
  * @module Mp4Sanitizer
31
31
  */
32
- import Native from '../Native.js';
32
+ import * as Native from './Native.js';
33
33
  export class SanitizedMetadata {
34
34
  constructor(handle) {
35
35
  this._nativeHandle = handle;