@signalapp/libsignal-client 0.81.0 → 0.82.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.
Files changed (166) hide show
  1. package/Native.d.ts +34 -31
  2. package/Native.js +4 -1
  3. package/dist/AccountKeys.d.ts +3 -3
  4. package/dist/AccountKeys.js +8 -14
  5. package/dist/Address.d.ts +1 -1
  6. package/dist/Address.js +8 -15
  7. package/dist/EcKeys.d.ts +1 -1
  8. package/dist/EcKeys.js +4 -10
  9. package/dist/Errors.d.ts +2 -2
  10. package/dist/Errors.js +5 -9
  11. package/dist/MessageBackup.d.ts +4 -4
  12. package/dist/MessageBackup.js +10 -18
  13. package/dist/Minidump.js +2 -6
  14. package/dist/Mp4Sanitizer.d.ts +2 -2
  15. package/dist/Mp4Sanitizer.js +3 -8
  16. package/dist/SealedSenderMultiRecipientMessage.d.ts +1 -1
  17. package/dist/SealedSenderMultiRecipientMessage.js +2 -5
  18. package/dist/WebpSanitizer.js +2 -6
  19. package/dist/acknowledgments.md +254 -89
  20. package/dist/incremental_mac.d.ts +1 -1
  21. package/dist/incremental_mac.js +11 -19
  22. package/dist/index.d.ts +18 -18
  23. package/dist/index.js +93 -158
  24. package/dist/internal.d.ts +2 -2
  25. package/dist/internal.js +3 -8
  26. package/dist/io.d.ts +1 -1
  27. package/dist/io.js +1 -5
  28. package/dist/net/CDSI.d.ts +2 -2
  29. package/dist/net/CDSI.js +8 -12
  30. package/dist/net/Chat.d.ts +11 -12
  31. package/dist/net/Chat.js +15 -22
  32. package/dist/net/KeyTransparency.d.ts +10 -10
  33. package/dist/net/KeyTransparency.js +4 -8
  34. package/dist/net/Registration.d.ts +5 -5
  35. package/dist/net/Registration.js +16 -22
  36. package/dist/net/SvrB.d.ts +3 -3
  37. package/dist/net/SvrB.js +5 -9
  38. package/dist/net/chat/UnauthUsernamesService.d.ts +4 -4
  39. package/dist/net/chat/UnauthUsernamesService.js +5 -7
  40. package/dist/net.d.ts +11 -11
  41. package/dist/net.js +27 -46
  42. package/dist/usernames.js +12 -23
  43. package/dist/zkgroup/GenericServerPublicParams.d.ts +1 -1
  44. package/dist/zkgroup/GenericServerPublicParams.js +3 -6
  45. package/dist/zkgroup/GenericServerSecretParams.d.ts +2 -2
  46. package/dist/zkgroup/GenericServerSecretParams.js +8 -11
  47. package/dist/zkgroup/NotarySignature.d.ts +1 -1
  48. package/dist/zkgroup/NotarySignature.js +3 -5
  49. package/dist/zkgroup/ServerPublicParams.d.ts +2 -2
  50. package/dist/zkgroup/ServerPublicParams.js +2 -5
  51. package/dist/zkgroup/ServerSecretParams.d.ts +3 -3
  52. package/dist/zkgroup/ServerSecretParams.js +10 -13
  53. package/dist/zkgroup/auth/AuthCredentialPresentation.d.ts +2 -2
  54. package/dist/zkgroup/auth/AuthCredentialPresentation.js +6 -9
  55. package/dist/zkgroup/auth/AuthCredentialWithPni.d.ts +1 -1
  56. package/dist/zkgroup/auth/AuthCredentialWithPni.js +3 -6
  57. package/dist/zkgroup/auth/AuthCredentialWithPniResponse.d.ts +1 -1
  58. package/dist/zkgroup/auth/AuthCredentialWithPniResponse.js +3 -6
  59. package/dist/zkgroup/auth/ClientZkAuthOperations.d.ts +6 -6
  60. package/dist/zkgroup/auth/ClientZkAuthOperations.js +9 -12
  61. package/dist/zkgroup/auth/ServerZkAuthOperations.d.ts +5 -5
  62. package/dist/zkgroup/auth/ServerZkAuthOperations.js +7 -10
  63. package/dist/zkgroup/backups/BackupAuthCredential.d.ts +5 -5
  64. package/dist/zkgroup/backups/BackupAuthCredential.js +12 -15
  65. package/dist/zkgroup/backups/BackupAuthCredentialPresentation.d.ts +4 -4
  66. package/dist/zkgroup/backups/BackupAuthCredentialPresentation.js +7 -10
  67. package/dist/zkgroup/backups/BackupAuthCredentialRequest.d.ts +5 -5
  68. package/dist/zkgroup/backups/BackupAuthCredentialRequest.js +8 -11
  69. package/dist/zkgroup/backups/BackupAuthCredentialRequestContext.d.ts +6 -6
  70. package/dist/zkgroup/backups/BackupAuthCredentialRequestContext.js +8 -11
  71. package/dist/zkgroup/backups/BackupAuthCredentialResponse.d.ts +1 -1
  72. package/dist/zkgroup/backups/BackupAuthCredentialResponse.js +3 -6
  73. package/dist/zkgroup/backups/BackupCredentialType.js +1 -3
  74. package/dist/zkgroup/backups/BackupLevel.js +1 -3
  75. package/dist/zkgroup/calllinks/CallLinkAuthCredential.d.ts +5 -5
  76. package/dist/zkgroup/calllinks/CallLinkAuthCredential.js +8 -11
  77. package/dist/zkgroup/calllinks/CallLinkAuthCredentialPresentation.d.ts +4 -4
  78. package/dist/zkgroup/calllinks/CallLinkAuthCredentialPresentation.js +5 -8
  79. package/dist/zkgroup/calllinks/CallLinkAuthCredentialResponse.d.ts +5 -5
  80. package/dist/zkgroup/calllinks/CallLinkAuthCredentialResponse.js +8 -11
  81. package/dist/zkgroup/calllinks/CallLinkPublicParams.d.ts +1 -1
  82. package/dist/zkgroup/calllinks/CallLinkPublicParams.js +3 -6
  83. package/dist/zkgroup/calllinks/CallLinkSecretParams.d.ts +4 -4
  84. package/dist/zkgroup/calllinks/CallLinkSecretParams.js +9 -12
  85. package/dist/zkgroup/calllinks/CreateCallLinkCredential.d.ts +5 -5
  86. package/dist/zkgroup/calllinks/CreateCallLinkCredential.js +8 -11
  87. package/dist/zkgroup/calllinks/CreateCallLinkCredentialPresentation.d.ts +3 -3
  88. package/dist/zkgroup/calllinks/CreateCallLinkCredentialPresentation.js +3 -6
  89. package/dist/zkgroup/calllinks/CreateCallLinkCredentialRequest.d.ts +4 -4
  90. package/dist/zkgroup/calllinks/CreateCallLinkCredentialRequest.js +8 -11
  91. package/dist/zkgroup/calllinks/CreateCallLinkCredentialRequestContext.d.ts +6 -6
  92. package/dist/zkgroup/calllinks/CreateCallLinkCredentialRequestContext.js +10 -13
  93. package/dist/zkgroup/calllinks/CreateCallLinkCredentialResponse.d.ts +1 -1
  94. package/dist/zkgroup/calllinks/CreateCallLinkCredentialResponse.js +3 -6
  95. package/dist/zkgroup/groups/ClientZkGroupCipher.d.ts +5 -5
  96. package/dist/zkgroup/groups/ClientZkGroupCipher.js +13 -16
  97. package/dist/zkgroup/groups/GroupIdentifier.d.ts +1 -1
  98. package/dist/zkgroup/groups/GroupIdentifier.js +3 -5
  99. package/dist/zkgroup/groups/GroupMasterKey.d.ts +1 -1
  100. package/dist/zkgroup/groups/GroupMasterKey.js +3 -5
  101. package/dist/zkgroup/groups/GroupPublicParams.d.ts +2 -2
  102. package/dist/zkgroup/groups/GroupPublicParams.js +5 -8
  103. package/dist/zkgroup/groups/GroupSecretParams.d.ts +3 -3
  104. package/dist/zkgroup/groups/GroupSecretParams.js +10 -13
  105. package/dist/zkgroup/groups/ProfileKeyCiphertext.d.ts +1 -1
  106. package/dist/zkgroup/groups/ProfileKeyCiphertext.js +3 -6
  107. package/dist/zkgroup/groups/UuidCiphertext.d.ts +1 -1
  108. package/dist/zkgroup/groups/UuidCiphertext.js +3 -6
  109. package/dist/zkgroup/groupsend/GroupSendDerivedKeyPair.d.ts +2 -2
  110. package/dist/zkgroup/groupsend/GroupSendDerivedKeyPair.js +3 -6
  111. package/dist/zkgroup/groupsend/GroupSendEndorsement.d.ts +5 -5
  112. package/dist/zkgroup/groupsend/GroupSendEndorsement.js +10 -13
  113. package/dist/zkgroup/groupsend/GroupSendEndorsementsResponse.d.ts +7 -7
  114. package/dist/zkgroup/groupsend/GroupSendEndorsementsResponse.js +14 -17
  115. package/dist/zkgroup/groupsend/GroupSendFullToken.d.ts +3 -3
  116. package/dist/zkgroup/groupsend/GroupSendFullToken.js +5 -8
  117. package/dist/zkgroup/groupsend/GroupSendToken.d.ts +2 -2
  118. package/dist/zkgroup/groupsend/GroupSendToken.js +5 -8
  119. package/dist/zkgroup/index.d.ts +57 -57
  120. package/dist/zkgroup/index.js +57 -118
  121. package/dist/zkgroup/internal/ByteArray.js +6 -10
  122. package/dist/zkgroup/internal/Constants.js +4 -7
  123. package/dist/zkgroup/profiles/ClientZkProfileOperations.d.ts +8 -8
  124. package/dist/zkgroup/profiles/ClientZkProfileOperations.js +12 -15
  125. package/dist/zkgroup/profiles/ExpiringProfileKeyCredential.d.ts +1 -1
  126. package/dist/zkgroup/profiles/ExpiringProfileKeyCredential.js +3 -6
  127. package/dist/zkgroup/profiles/ExpiringProfileKeyCredentialResponse.d.ts +1 -1
  128. package/dist/zkgroup/profiles/ExpiringProfileKeyCredentialResponse.js +3 -6
  129. package/dist/zkgroup/profiles/ProfileKey.d.ts +4 -4
  130. package/dist/zkgroup/profiles/ProfileKey.js +8 -10
  131. package/dist/zkgroup/profiles/ProfileKeyCommitment.d.ts +1 -1
  132. package/dist/zkgroup/profiles/ProfileKeyCommitment.js +3 -6
  133. package/dist/zkgroup/profiles/ProfileKeyCredentialPresentation.d.ts +3 -3
  134. package/dist/zkgroup/profiles/ProfileKeyCredentialPresentation.js +7 -10
  135. package/dist/zkgroup/profiles/ProfileKeyCredentialRequest.d.ts +1 -1
  136. package/dist/zkgroup/profiles/ProfileKeyCredentialRequest.js +3 -6
  137. package/dist/zkgroup/profiles/ProfileKeyCredentialRequestContext.d.ts +2 -2
  138. package/dist/zkgroup/profiles/ProfileKeyCredentialRequestContext.js +5 -8
  139. package/dist/zkgroup/profiles/ProfileKeyVersion.d.ts +1 -1
  140. package/dist/zkgroup/profiles/ProfileKeyVersion.js +3 -5
  141. package/dist/zkgroup/profiles/ServerZkProfileOperations.d.ts +7 -7
  142. package/dist/zkgroup/profiles/ServerZkProfileOperations.js +7 -10
  143. package/dist/zkgroup/receipts/ClientZkReceiptOperations.d.ts +6 -6
  144. package/dist/zkgroup/receipts/ClientZkReceiptOperations.js +12 -15
  145. package/dist/zkgroup/receipts/ReceiptCredential.d.ts +1 -1
  146. package/dist/zkgroup/receipts/ReceiptCredential.js +3 -6
  147. package/dist/zkgroup/receipts/ReceiptCredentialPresentation.d.ts +2 -2
  148. package/dist/zkgroup/receipts/ReceiptCredentialPresentation.js +6 -8
  149. package/dist/zkgroup/receipts/ReceiptCredentialRequest.d.ts +1 -1
  150. package/dist/zkgroup/receipts/ReceiptCredentialRequest.js +3 -6
  151. package/dist/zkgroup/receipts/ReceiptCredentialRequestContext.d.ts +2 -2
  152. package/dist/zkgroup/receipts/ReceiptCredentialRequestContext.js +6 -8
  153. package/dist/zkgroup/receipts/ReceiptCredentialResponse.d.ts +1 -1
  154. package/dist/zkgroup/receipts/ReceiptCredentialResponse.js +3 -6
  155. package/dist/zkgroup/receipts/ReceiptSerial.d.ts +1 -1
  156. package/dist/zkgroup/receipts/ReceiptSerial.js +3 -5
  157. package/dist/zkgroup/receipts/ServerZkReceiptOperations.d.ts +4 -4
  158. package/dist/zkgroup/receipts/ServerZkReceiptOperations.js +7 -10
  159. package/package.json +24 -20
  160. package/prebuilds/darwin-arm64/@signalapp+libsignal-client.node +0 -0
  161. package/prebuilds/darwin-x64/@signalapp+libsignal-client.node +0 -0
  162. package/prebuilds/linux-arm64/@signalapp+libsignal-client.node +0 -0
  163. package/prebuilds/linux-x64/@signalapp+libsignal-client.node +0 -0
  164. package/prebuilds/win32-arm64/@signalapp+libsignal-client.node +0 -0
  165. package/prebuilds/win32-x64/@signalapp+libsignal-client.node +0 -0
  166. package/zkgroup.js +1 -1
package/Native.d.ts CHANGED
@@ -64,80 +64,83 @@ enum IdentityChange {
64
64
  }
65
65
 
66
66
  type IdentityKeyStore = {
67
- _getIdentityKey(): Promise<PrivateKey>;
68
- _getLocalRegistrationId(): Promise<number>;
69
- _saveIdentity(name: ProtocolAddress, key: PublicKey): Promise<IdentityChange>;
70
- _isTrustedIdentity(
67
+ _getIdentityKey: () => Promise<PrivateKey>;
68
+ _getLocalRegistrationId: () => Promise<number>;
69
+ _saveIdentity: (
70
+ name: ProtocolAddress,
71
+ key: PublicKey
72
+ ) => Promise<IdentityChange>;
73
+ _isTrustedIdentity: (
71
74
  name: ProtocolAddress,
72
75
  key: PublicKey,
73
76
  sending: boolean
74
- ): Promise<boolean>;
75
- _getIdentity(name: ProtocolAddress): Promise<PublicKey | null>;
77
+ ) => Promise<boolean>;
78
+ _getIdentity: (name: ProtocolAddress) => Promise<PublicKey | null>;
76
79
  };
77
80
 
78
81
  type SessionStore = {
79
- _saveSession(addr: ProtocolAddress, record: SessionRecord): Promise<void>;
80
- _getSession(addr: ProtocolAddress): Promise<SessionRecord | null>;
82
+ _saveSession: (addr: ProtocolAddress, record: SessionRecord) => Promise<void>;
83
+ _getSession: (addr: ProtocolAddress) => Promise<SessionRecord | null>;
81
84
  };
82
85
 
83
86
  type PreKeyStore = {
84
- _savePreKey(preKeyId: number, record: PreKeyRecord): Promise<void>;
85
- _getPreKey(preKeyId: number): Promise<PreKeyRecord>;
86
- _removePreKey(preKeyId: number): Promise<void>;
87
+ _savePreKey: (preKeyId: number, record: PreKeyRecord) => Promise<void>;
88
+ _getPreKey: (preKeyId: number) => Promise<PreKeyRecord>;
89
+ _removePreKey: (preKeyId: number) => Promise<void>;
87
90
  };
88
91
 
89
92
  type SignedPreKeyStore = {
90
- _saveSignedPreKey(
93
+ _saveSignedPreKey: (
91
94
  signedPreKeyId: number,
92
95
  record: SignedPreKeyRecord
93
- ): Promise<void>;
94
- _getSignedPreKey(signedPreKeyId: number): Promise<SignedPreKeyRecord>;
96
+ ) => Promise<void>;
97
+ _getSignedPreKey: (signedPreKeyId: number) => Promise<SignedPreKeyRecord>;
95
98
  };
96
99
 
97
100
  type KyberPreKeyStore = {
98
- _saveKyberPreKey(
101
+ _saveKyberPreKey: (
99
102
  kyberPreKeyId: number,
100
103
  record: KyberPreKeyRecord
101
- ): Promise<void>;
102
- _getKyberPreKey(kyberPreKeyId: number): Promise<KyberPreKeyRecord>;
103
- _markKyberPreKeyUsed(
104
+ ) => Promise<void>;
105
+ _getKyberPreKey: (kyberPreKeyId: number) => Promise<KyberPreKeyRecord>;
106
+ _markKyberPreKeyUsed: (
104
107
  kyberPreKeyId: number,
105
108
  signedPreKeyId: number,
106
109
  baseKey: PublicKey
107
- ): Promise<void>;
110
+ ) => Promise<void>;
108
111
  };
109
112
 
110
113
  type SenderKeyStore = {
111
- _saveSenderKey(
114
+ _saveSenderKey: (
112
115
  sender: ProtocolAddress,
113
116
  distributionId: Uuid,
114
117
  record: SenderKeyRecord
115
- ): Promise<void>;
116
- _getSenderKey(
118
+ ) => Promise<void>;
119
+ _getSenderKey: (
117
120
  sender: ProtocolAddress,
118
121
  distributionId: Uuid
119
- ): Promise<SenderKeyRecord | null>;
122
+ ) => Promise<SenderKeyRecord | null>;
120
123
  };
121
124
 
122
125
  type InputStream = {
123
- _read(amount: number): Promise<Uint8Array>;
124
- _skip(amount: number): Promise<void>;
126
+ _read: (amount: number) => Promise<Uint8Array>;
127
+ _skip: (amount: number) => Promise<void>;
125
128
  };
126
129
 
127
130
  type SyncInputStream = Uint8Array;
128
131
 
129
132
  type ChatListener = {
130
- _incoming_message(
133
+ _incoming_message: (
131
134
  envelope: Uint8Array,
132
135
  timestamp: number,
133
136
  ack: ServerMessageAck
134
- ): void;
135
- _queue_empty(): void;
136
- _received_alerts(alerts: string[]): void;
137
- _connection_interrupted(
137
+ ) => void;
138
+ _queue_empty: () => void;
139
+ _received_alerts: (alerts: string[]) => void;
140
+ _connection_interrupted: (
138
141
  // A LibSignalError or null, but not naming the type to avoid circular import dependencies.
139
142
  reason: Error | null
140
- ): void;
143
+ ) => void;
141
144
  };
142
145
 
143
146
  type ChallengeOption = 'pushChallenge' | 'captcha';
package/Native.js CHANGED
@@ -3,4 +3,7 @@
3
3
  // SPDX-License-Identifier: AGPL-3.0-only
4
4
  //
5
5
 
6
- module.exports = require('node-gyp-build')(__dirname);
6
+ import load from 'node-gyp-build';
7
+
8
+ const Native = load(import.meta.dirname);
9
+ export default Native;
@@ -1,6 +1,6 @@
1
- import ByteArray from './zkgroup/internal/ByteArray';
2
- import { Aci } from './Address';
3
- import { PrivateKey } from './EcKeys';
1
+ import ByteArray from './zkgroup/internal/ByteArray.js';
2
+ import { Aci } from './Address.js';
3
+ import { PrivateKey } from './EcKeys.js';
4
4
  /**
5
5
  * The randomly-generated user-memorized entropy used to derive the backup key,
6
6
  * with other possible future uses.
@@ -1,10 +1,7 @@
1
- "use strict";
2
1
  //
3
2
  // Copyright 2024 Signal Messenger, LLC.
4
3
  // SPDX-License-Identifier: AGPL-3.0-only
5
4
  //
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.BackupForwardSecrecyToken = exports.BackupKey = exports.AccountEntropyPool = void 0;
8
5
  /**
9
6
  * Cryptographic hashing, randomness generation, etc. related to SVR/Backup Keys.
10
7
  *
@@ -12,17 +9,17 @@ exports.BackupForwardSecrecyToken = exports.BackupKey = exports.AccountEntropyPo
12
9
  *
13
10
  * @module AccountKeys
14
11
  */
15
- const crypto = require("node:crypto");
16
- const Native = require("../Native");
17
- const ByteArray_1 = require("./zkgroup/internal/ByteArray");
18
- const EcKeys_1 = require("./EcKeys");
12
+ import * as crypto from 'node:crypto';
13
+ import Native from '../Native.js';
14
+ import ByteArray from './zkgroup/internal/ByteArray.js';
15
+ import { PrivateKey } from './EcKeys.js';
19
16
  /**
20
17
  * The randomly-generated user-memorized entropy used to derive the backup key,
21
18
  * with other possible future uses.
22
19
  *
23
20
  * Contains log_2(36^64) = ~330 bits of entropy.
24
21
  */
25
- class AccountEntropyPool {
22
+ export class AccountEntropyPool {
26
23
  /**
27
24
  * Randomly generates an Account Entropy Pool and returns the canonical string
28
25
  * representation of that pool.
@@ -61,7 +58,6 @@ class AccountEntropyPool {
61
58
  return new BackupKey(Native.AccountEntropyPool_DeriveBackupKey(accountEntropyPool));
62
59
  }
63
60
  }
64
- exports.AccountEntropyPool = AccountEntropyPool;
65
61
  /**
66
62
  * A key used for many aspects of backups.
67
63
  *
@@ -69,7 +65,7 @@ exports.AccountEntropyPool = AccountEntropyPool;
69
65
  * root backup key" or just "the backup key") that's derived from an {@link AccountEntropyPool}, and
70
66
  * a "media" key (formally the "media root backup key") that's not derived from anything else.
71
67
  */
72
- class BackupKey extends ByteArray_1.default {
68
+ export class BackupKey extends ByteArray {
73
69
  constructor(contents) {
74
70
  super(contents, BackupKey.checkLength(BackupKey.SIZE));
75
71
  }
@@ -98,7 +94,7 @@ class BackupKey extends ByteArray_1.default {
98
94
  * Used for both message and media backups.
99
95
  */
100
96
  deriveEcKey(aci) {
101
- return EcKeys_1.PrivateKey._fromNativeHandle(Native.BackupKey_DeriveEcKey(this.contents, aci.getServiceIdFixedWidthBinary()));
97
+ return PrivateKey._fromNativeHandle(Native.BackupKey_DeriveEcKey(this.contents, aci.getServiceIdFixedWidthBinary()));
102
98
  }
103
99
  /**
104
100
  * Derives the AES key used for encrypted fields in local backup metadata.
@@ -138,7 +134,6 @@ class BackupKey extends ByteArray_1.default {
138
134
  return Native.BackupKey_DeriveThumbnailTransitEncryptionKey(this.contents, mediaId);
139
135
  }
140
136
  }
141
- exports.BackupKey = BackupKey;
142
137
  BackupKey.SIZE = 32;
143
138
  /**
144
139
  * A forward secrecy token used for deriving message backup keys.
@@ -146,11 +141,10 @@ BackupKey.SIZE = 32;
146
141
  * This token is retrieved from the server when restoring a backup and is used together
147
142
  * with the backup key to derive the actual encryption keys for message backups.
148
143
  */
149
- class BackupForwardSecrecyToken extends ByteArray_1.default {
144
+ export class BackupForwardSecrecyToken extends ByteArray {
150
145
  constructor(contents) {
151
146
  super(contents, BackupForwardSecrecyToken.checkLength(BackupForwardSecrecyToken.SIZE));
152
147
  }
153
148
  }
154
- exports.BackupForwardSecrecyToken = BackupForwardSecrecyToken;
155
149
  BackupForwardSecrecyToken.SIZE = 32;
156
150
  //# sourceMappingURL=AccountKeys.js.map
package/dist/Address.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as Native from '../Native';
1
+ import Native from '../Native.js';
2
2
  export declare enum ServiceIdKind {
3
3
  Aci = 0,
4
4
  Pni = 1
package/dist/Address.js CHANGED
@@ -1,17 +1,14 @@
1
- "use strict";
2
1
  //
3
2
  // Copyright 2021 Signal Messenger, LLC.
4
3
  // SPDX-License-Identifier: AGPL-3.0-only
5
4
  //
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.ProtocolAddress = exports.Pni = exports.Aci = exports.ServiceId = exports.ServiceIdKind = void 0;
8
- const Native = require("../Native");
9
- const uuid = require("uuid");
10
- var ServiceIdKind;
5
+ import Native from '../Native.js';
6
+ import * as uuid from 'uuid';
7
+ export var ServiceIdKind;
11
8
  (function (ServiceIdKind) {
12
9
  ServiceIdKind[ServiceIdKind["Aci"] = 0] = "Aci";
13
10
  ServiceIdKind[ServiceIdKind["Pni"] = 1] = "Pni";
14
- })(ServiceIdKind || (exports.ServiceIdKind = ServiceIdKind = {}));
11
+ })(ServiceIdKind || (ServiceIdKind = {}));
15
12
  const SERVICE_ID_FIXED_WIDTH_BINARY_LEN = 17;
16
13
  /**
17
14
  * Typed representation of a Signal service ID, which can be one of various types.
@@ -19,7 +16,7 @@ const SERVICE_ID_FIXED_WIDTH_BINARY_LEN = 17;
19
16
  * Conceptually this is a UUID in a particular "namespace" representing a particular way to reach a
20
17
  * user on the Signal service.
21
18
  */
22
- class ServiceId extends Object {
19
+ export class ServiceId extends Object {
23
20
  // This has to be public for `InstanceType<T>`, which we use below.
24
21
  constructor(serviceIdFixedWidthBinary) {
25
22
  super();
@@ -102,8 +99,7 @@ class ServiceId extends Object {
102
99
  return result;
103
100
  }
104
101
  }
105
- exports.ServiceId = ServiceId;
106
- class Aci extends ServiceId {
102
+ export class Aci extends ServiceId {
107
103
  static fromUuid(uuidString) {
108
104
  return this.fromUuidBytes(uuid.parse(uuidString));
109
105
  }
@@ -111,8 +107,7 @@ class Aci extends ServiceId {
111
107
  return this.fromUuidBytesAndKind(uuidBytes, ServiceIdKind.Aci);
112
108
  }
113
109
  }
114
- exports.Aci = Aci;
115
- class Pni extends ServiceId {
110
+ export class Pni extends ServiceId {
116
111
  static fromUuid(uuidString) {
117
112
  return this.fromUuidBytes(uuid.parse(uuidString));
118
113
  }
@@ -120,8 +115,7 @@ class Pni extends ServiceId {
120
115
  return this.fromUuidBytesAndKind(uuidBytes, ServiceIdKind.Pni);
121
116
  }
122
117
  }
123
- exports.Pni = Pni;
124
- class ProtocolAddress {
118
+ export class ProtocolAddress {
125
119
  constructor(handle) {
126
120
  this._nativeHandle = handle;
127
121
  }
@@ -161,5 +155,4 @@ class ProtocolAddress {
161
155
  return `${this.name()}.${this.deviceId()}`;
162
156
  }
163
157
  }
164
- exports.ProtocolAddress = ProtocolAddress;
165
158
  //# sourceMappingURL=Address.js.map
package/dist/EcKeys.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as Native from '../Native';
1
+ import 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
@@ -1,12 +1,9 @@
1
- "use strict";
2
1
  //
3
2
  // Copyright 2020-2022 Signal Messenger, LLC.
4
3
  // SPDX-License-Identifier: AGPL-3.0-only
5
4
  //
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.IdentityKeyPair = exports.PrivateKey = exports.PublicKey = void 0;
8
- const Native = require("../Native");
9
- class PublicKey {
5
+ import Native from '../Native.js';
6
+ export class PublicKey {
10
7
  constructor(handle) {
11
8
  this._nativeHandle = handle;
12
9
  }
@@ -49,8 +46,7 @@ class PublicKey {
49
46
  return Native.PublicKey_HpkeSeal(this, msg, infoBuffer, associatedData ?? new Uint8Array());
50
47
  }
51
48
  }
52
- exports.PublicKey = PublicKey;
53
- class PrivateKey {
49
+ export class PrivateKey {
54
50
  constructor(handle) {
55
51
  this._nativeHandle = handle;
56
52
  }
@@ -87,8 +83,7 @@ class PrivateKey {
87
83
  return Native.PrivateKey_HpkeOpen(this, ciphertext, infoBuffer, associatedData ?? new Uint8Array());
88
84
  }
89
85
  }
90
- exports.PrivateKey = PrivateKey;
91
- class IdentityKeyPair {
86
+ export class IdentityKeyPair {
92
87
  constructor(publicKey, privateKey) {
93
88
  this.publicKey = publicKey;
94
89
  this.privateKey = privateKey;
@@ -108,5 +103,4 @@ class IdentityKeyPair {
108
103
  return Native.IdentityKeyPair_SignAlternateIdentity(this.publicKey, this.privateKey, other);
109
104
  }
110
105
  }
111
- exports.IdentityKeyPair = IdentityKeyPair;
112
106
  //# sourceMappingURL=EcKeys.js.map
package/dist/Errors.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ProtocolAddress } from './Address';
2
- import * as Native from '../Native';
1
+ import { ProtocolAddress } from './Address.js';
2
+ import Native from '../Native.js';
3
3
  export declare enum ErrorCode {
4
4
  Generic = 0,
5
5
  DuplicatedMessage = 1,
package/dist/Errors.js CHANGED
@@ -1,12 +1,9 @@
1
- "use strict";
2
1
  //
3
2
  // Copyright 2021 Signal Messenger, LLC.
4
3
  // SPDX-License-Identifier: AGPL-3.0-only
5
4
  //
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.LibSignalErrorBase = exports.ErrorCode = void 0;
8
- const Address_1 = require("./Address");
9
- var ErrorCode;
5
+ import { ProtocolAddress } from './Address.js';
6
+ export var ErrorCode;
10
7
  (function (ErrorCode) {
11
8
  ErrorCode[ErrorCode["Generic"] = 0] = "Generic";
12
9
  ErrorCode[ErrorCode["DuplicatedMessage"] = 1] = "DuplicatedMessage";
@@ -54,8 +51,8 @@ var ErrorCode;
54
51
  ErrorCode[ErrorCode["KeyTransparencyError"] = 43] = "KeyTransparencyError";
55
52
  ErrorCode[ErrorCode["KeyTransparencyVerificationFailed"] = 44] = "KeyTransparencyVerificationFailed";
56
53
  ErrorCode[ErrorCode["IncrementalMacVerificationFailed"] = 45] = "IncrementalMacVerificationFailed";
57
- })(ErrorCode || (exports.ErrorCode = ErrorCode = {}));
58
- class LibSignalErrorBase extends Error {
54
+ })(ErrorCode || (ErrorCode = {}));
55
+ export class LibSignalErrorBase extends Error {
59
56
  constructor(message, name, operation, extraProps) {
60
57
  super(message);
61
58
  // Include the dynamic check for `name in ErrorCode` in case there's a bug in the Rust code.
@@ -82,7 +79,7 @@ class LibSignalErrorBase extends Error {
82
79
  case ErrorCode.UntrustedIdentity:
83
80
  return this._addr;
84
81
  case ErrorCode.InvalidRegistrationId:
85
- return Address_1.ProtocolAddress._fromNativeHandle(this._addr);
82
+ return ProtocolAddress._fromNativeHandle(this._addr);
86
83
  default:
87
84
  throw new TypeError(`cannot get address from this error (${this})`);
88
85
  }
@@ -103,5 +100,4 @@ class LibSignalErrorBase extends Error {
103
100
  return false;
104
101
  }
105
102
  }
106
- exports.LibSignalErrorBase = LibSignalErrorBase;
107
103
  //# sourceMappingURL=Errors.js.map
@@ -3,10 +3,10 @@
3
3
  *
4
4
  * @module MessageBackup
5
5
  */
6
- import * as Native from '../Native';
7
- import { BackupForwardSecrecyToken, BackupKey } from './AccountKeys';
8
- import { Aci } from './Address';
9
- import { InputStream } from './io';
6
+ import Native from '../Native.js';
7
+ import { BackupForwardSecrecyToken, BackupKey } from './AccountKeys.js';
8
+ import { Aci } from './Address.js';
9
+ import { InputStream } from './io.js';
10
10
  export type InputStreamFactory = () => InputStream;
11
11
  /**
12
12
  * Result of validating a message backup bundle.
@@ -1,21 +1,18 @@
1
- "use strict";
2
1
  //
3
2
  // Copyright 2024 Signal Messenger, LLC.
4
3
  // SPDX-License-Identifier: AGPL-3.0-only
5
4
  //
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.ComparableBackup = exports.OnlineBackupValidator = exports.validate = exports.Purpose = exports.MessageBackupKey = exports.ValidationOutcome = void 0;
8
5
  /**
9
6
  * Message backup validation routines.
10
7
  *
11
8
  * @module MessageBackup
12
9
  */
13
- const Native = require("../Native");
14
- const AccountKeys_1 = require("./AccountKeys");
10
+ import Native from '../Native.js';
11
+ import { BackupKey } from './AccountKeys.js';
15
12
  /**
16
13
  * Result of validating a message backup bundle.
17
14
  */
18
- class ValidationOutcome {
15
+ export class ValidationOutcome {
19
16
  /**
20
17
  * `true` if the backup is valid, `false` otherwise.
21
18
  *
@@ -30,13 +27,12 @@ class ValidationOutcome {
30
27
  this.unknownFieldMessages = unknownFieldMessages;
31
28
  }
32
29
  }
33
- exports.ValidationOutcome = ValidationOutcome;
34
30
  /**
35
31
  * Key used to encrypt and decrypt a message backup bundle.
36
32
  *
37
33
  * @see {@link BackupKey}
38
34
  */
39
- class MessageBackupKey {
35
+ export class MessageBackupKey {
40
36
  /**
41
37
  * Create a backup bundle key from an account entropy pool and ACI.
42
38
  *
@@ -54,7 +50,7 @@ class MessageBackupKey {
54
50
  else {
55
51
  const { backupId, forwardSecrecyToken } = input;
56
52
  let { backupKey } = input;
57
- if (backupKey instanceof AccountKeys_1.BackupKey) {
53
+ if (backupKey instanceof BackupKey) {
58
54
  backupKey = backupKey.contents;
59
55
  }
60
56
  this._nativeHandle = Native.MessageBackupKey_FromBackupKeyAndBackupId(backupKey, backupId, forwardSecrecyToken?.contents ?? null);
@@ -69,13 +65,12 @@ class MessageBackupKey {
69
65
  return Native.MessageBackupKey_GetAesKey(this);
70
66
  }
71
67
  }
72
- exports.MessageBackupKey = MessageBackupKey;
73
68
  // This must match the Rust version of the enum.
74
- var Purpose;
69
+ export var Purpose;
75
70
  (function (Purpose) {
76
71
  Purpose[Purpose["DeviceTransfer"] = 0] = "DeviceTransfer";
77
72
  Purpose[Purpose["RemoteBackup"] = 1] = "RemoteBackup";
78
- })(Purpose || (exports.Purpose = Purpose = {}));
73
+ })(Purpose || (Purpose = {}));
79
74
  /**
80
75
  * Validate a backup file
81
76
  *
@@ -88,7 +83,7 @@ var Purpose;
88
83
  *
89
84
  * @see OnlineBackupValidator
90
85
  */
91
- async function validate(backupKey, purpose, inputFactory, length) {
86
+ export async function validate(backupKey, purpose, inputFactory, length) {
92
87
  let firstStream;
93
88
  let secondStream;
94
89
  try {
@@ -101,7 +96,6 @@ async function validate(backupKey, purpose, inputFactory, length) {
101
96
  await secondStream?.close();
102
97
  }
103
98
  }
104
- exports.validate = validate;
105
99
  /**
106
100
  * An alternative to {@link validate()} that validates a backup frame-by-frame.
107
101
  *
@@ -124,7 +118,7 @@ exports.validate = validate;
124
118
  * validator.finalize() // don't forget this!
125
119
  * ```
126
120
  */
127
- class OnlineBackupValidator {
121
+ export class OnlineBackupValidator {
128
122
  /**
129
123
  * Initializes an OnlineBackupValidator from the given BackupInfo protobuf message.
130
124
  *
@@ -156,7 +150,6 @@ class OnlineBackupValidator {
156
150
  Native.OnlineBackupValidator_Finalize(this);
157
151
  }
158
152
  }
159
- exports.OnlineBackupValidator = OnlineBackupValidator;
160
153
  /**
161
154
  * An in-memory representation of a backup file used to compare contents.
162
155
  *
@@ -170,7 +163,7 @@ exports.OnlineBackupValidator = OnlineBackupValidator;
170
163
  * The diff of the canonical strings (which may be rather large) will show the
171
164
  * differences between the logical content of the input backup files.
172
165
  */
173
- class ComparableBackup {
166
+ export class ComparableBackup {
174
167
  constructor(handle) {
175
168
  this._nativeHandle = handle;
176
169
  }
@@ -209,5 +202,4 @@ class ComparableBackup {
209
202
  return Native.ComparableBackup_GetUnknownFields(this);
210
203
  }
211
204
  }
212
- exports.ComparableBackup = ComparableBackup;
213
205
  //# sourceMappingURL=MessageBackup.js.map
package/dist/Minidump.js CHANGED
@@ -1,13 +1,9 @@
1
- "use strict";
2
1
  //
3
2
  // Copyright 2024 Signal Messenger, LLC.
4
3
  // SPDX-License-Identifier: AGPL-3.0-only
5
4
  //
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.toJSONString = void 0;
8
- const Native = require("../Native");
9
- function toJSONString(buffer) {
5
+ import Native from '../Native.js';
6
+ export function toJSONString(buffer) {
10
7
  return Native.MinidumpToJSONString(buffer);
11
8
  }
12
- exports.toJSONString = toJSONString;
13
9
  //# sourceMappingURL=Minidump.js.map
@@ -25,8 +25,8 @@
25
25
  *
26
26
  * @module Mp4Sanitizer
27
27
  */
28
- import * as Native from '../Native';
29
- import { InputStream } from './io';
28
+ import Native from '../Native.js';
29
+ import { InputStream } from './io.js';
30
30
  export declare class SanitizedMetadata {
31
31
  readonly _nativeHandle: Native.SanitizedMetadata;
32
32
  private constructor();
@@ -1,10 +1,7 @@
1
- "use strict";
2
1
  //
3
2
  // Copyright 2023 Signal Messenger, LLC.
4
3
  // SPDX-License-Identifier: AGPL-3.0-only
5
4
  //
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.sanitize = exports.SanitizedMetadata = void 0;
8
5
  /**
9
6
  * An MP4 format “sanitizer”.
10
7
  *
@@ -32,8 +29,8 @@ exports.sanitize = exports.SanitizedMetadata = void 0;
32
29
  *
33
30
  * @module Mp4Sanitizer
34
31
  */
35
- const Native = require("../Native");
36
- class SanitizedMetadata {
32
+ import Native from '../Native.js';
33
+ export class SanitizedMetadata {
37
34
  constructor(handle) {
38
35
  this._nativeHandle = handle;
39
36
  }
@@ -66,7 +63,6 @@ class SanitizedMetadata {
66
63
  return Native.SanitizedMetadata_GetDataLen(this);
67
64
  }
68
65
  }
69
- exports.SanitizedMetadata = SanitizedMetadata;
70
66
  /**
71
67
  * Sanitize an MP4 input.
72
68
  *
@@ -77,9 +73,8 @@ exports.SanitizedMetadata = SanitizedMetadata;
77
73
  * @throws {InvalidMediaInputError} If the input could not be parsed because it was invalid.
78
74
  * @throws {UnsupportedMediaInputError} If the input could not be parsed because it's unsupported in some way.
79
75
  */
80
- async function sanitize(input, len) {
76
+ export async function sanitize(input, len) {
81
77
  const sanitizedMetadataNativeHandle = await Native.Mp4Sanitizer_Sanitize(input, len);
82
78
  return SanitizedMetadata._fromNativeHandle(sanitizedMetadataNativeHandle);
83
79
  }
84
- exports.sanitize = sanitize;
85
80
  //# sourceMappingURL=Mp4Sanitizer.js.map
@@ -1,4 +1,4 @@
1
- import * as Native from '../Native';
1
+ import Native from '../Native.js';
2
2
  /**
3
3
  * A single recipient parsed from a {@link SealedSenderMultiRecipientMessage}.
4
4
  *
@@ -1,17 +1,15 @@
1
- "use strict";
2
1
  //
3
2
  // Copyright 2024 Signal Messenger, LLC.
4
3
  // SPDX-License-Identifier: AGPL-3.0-only
5
4
  //
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const Native = require("../Native");
5
+ import Native from '../Native.js';
8
6
  /**
9
7
  * A parsed Sealed Sender v2 "SentMessage", ready to be fanned out to multiple recipients.
10
8
  *
11
9
  * The implementation assumes that every device for a particular recipient should use the same key
12
10
  * material.
13
11
  */
14
- class SealedSenderMultiRecipientMessage {
12
+ export default class SealedSenderMultiRecipientMessage {
15
13
  constructor(buffer) {
16
14
  const { recipientMap, excludedRecipients, offsetOfSharedData } = Native.SealedSenderMultiRecipientMessage_Parse(buffer);
17
15
  this._buffer = buffer;
@@ -55,5 +53,4 @@ class SealedSenderMultiRecipientMessage {
55
53
  ]));
56
54
  }
57
55
  }
58
- exports.default = SealedSenderMultiRecipientMessage;
59
56
  //# sourceMappingURL=SealedSenderMultiRecipientMessage.js.map
@@ -1,10 +1,7 @@
1
- "use strict";
2
1
  //
3
2
  // Copyright 2023 Signal Messenger, LLC.
4
3
  // SPDX-License-Identifier: AGPL-3.0-only
5
4
  //
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.sanitize = void 0;
8
5
  /**
9
6
  * A WebP format “sanitizer”.
10
7
  *
@@ -13,7 +10,7 @@ exports.sanitize = void 0;
13
10
  *
14
11
  * @module WebpSanitizer
15
12
  */
16
- const Native = require("../Native");
13
+ import Native from '../Native.js';
17
14
  /**
18
15
  * Sanitize a WebP input.
19
16
  *
@@ -22,8 +19,7 @@ const Native = require("../Native");
22
19
  * @throws {InvalidMediaInputError} If the input could not be parsed because it was invalid.
23
20
  * @throws {UnsupportedMediaInputError} If the input could not be parsed because it's unsupported in some way.
24
21
  */
25
- function sanitize(input) {
22
+ export function sanitize(input) {
26
23
  Native.WebpSanitizer_Sanitize(input);
27
24
  }
28
- exports.sanitize = sanitize;
29
25
  //# sourceMappingURL=WebpSanitizer.js.map