@signalapp/libsignal-client 0.88.3 → 0.89.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.
- package/dist/AccountKeys.d.ts +8 -8
- package/dist/AccountKeys.js +4 -2
- package/dist/Address.d.ts +8 -8
- package/dist/Address.js +7 -2
- package/dist/EcKeys.d.ts +14 -14
- package/dist/EcKeys.js +4 -0
- package/dist/Errors.d.ts +7 -3
- package/dist/Errors.js +8 -0
- package/dist/MessageBackup.d.ts +8 -8
- package/dist/MessageBackup.js +13 -0
- package/dist/Minidump.d.ts +1 -1
- package/dist/Mp4Sanitizer.d.ts +1 -1
- package/dist/Mp4Sanitizer.js +1 -0
- package/dist/Native.d.ts +24 -19
- package/dist/Native.js +3 -3
- package/dist/ProtocolTypes.d.ts +45 -0
- package/dist/ProtocolTypes.js +106 -0
- package/dist/SealedSenderMultiRecipientMessage.d.ts +3 -3
- package/dist/SealedSenderMultiRecipientMessage.js +4 -0
- package/dist/WebpSanitizer.d.ts +1 -1
- package/dist/acknowledgments.md +1 -1
- package/dist/incremental_mac.d.ts +5 -7
- package/dist/incremental_mac.js +7 -5
- package/dist/index.d.ts +85 -129
- package/dist/index.js +66 -128
- package/dist/internal.js +1 -0
- package/dist/io.d.ts +2 -2
- package/dist/net/Chat.d.ts +3 -3
- package/dist/net/Chat.js +14 -0
- package/dist/net/FakeChat.d.ts +4 -4
- package/dist/net/FakeChat.js +4 -0
- package/dist/net/KeyTransparency.d.ts +7 -7
- package/dist/net/KeyTransparency.js +3 -0
- package/dist/net/Registration.d.ts +4 -4
- package/dist/net/Registration.js +5 -0
- package/dist/net/SvrB.d.ts +6 -6
- package/dist/net/SvrB.js +6 -0
- package/dist/net/chat/UnauthKeysService.d.ts +30 -0
- package/dist/net/chat/UnauthKeysService.js +20 -0
- package/dist/net/chat/UnauthMessagesService.d.ts +1 -1
- package/dist/net/chat/UnauthMessagesService.js +1 -0
- package/dist/net/chat/UnauthUsernamesService.d.ts +3 -3
- package/dist/net/chat/UnauthUsernamesService.js +2 -2
- package/dist/net.d.ts +4 -3
- package/dist/net.js +7 -1
- package/dist/usernames.d.ts +8 -8
- package/dist/uuid.d.ts +1 -0
- package/dist/uuid.js +5 -1
- package/dist/zkgroup/GenericServerPublicParams.d.ts +1 -1
- package/dist/zkgroup/GenericServerPublicParams.js +1 -0
- package/dist/zkgroup/GenericServerSecretParams.d.ts +2 -2
- package/dist/zkgroup/GenericServerSecretParams.js +1 -0
- package/dist/zkgroup/NotarySignature.d.ts +1 -1
- package/dist/zkgroup/NotarySignature.js +3 -3
- package/dist/zkgroup/ServerPublicParams.d.ts +4 -4
- package/dist/zkgroup/ServerPublicParams.js +1 -0
- package/dist/zkgroup/ServerSecretParams.d.ts +5 -5
- package/dist/zkgroup/ServerSecretParams.js +1 -0
- package/dist/zkgroup/auth/AuthCredentialPresentation.d.ts +1 -1
- package/dist/zkgroup/auth/AuthCredentialPresentation.js +1 -0
- package/dist/zkgroup/auth/AuthCredentialWithPni.d.ts +1 -1
- package/dist/zkgroup/auth/AuthCredentialWithPni.js +1 -0
- package/dist/zkgroup/auth/AuthCredentialWithPniResponse.d.ts +1 -1
- package/dist/zkgroup/auth/AuthCredentialWithPniResponse.js +1 -0
- package/dist/zkgroup/auth/ClientZkAuthOperations.d.ts +1 -1
- package/dist/zkgroup/auth/ClientZkAuthOperations.js +1 -0
- package/dist/zkgroup/auth/ServerZkAuthOperations.d.ts +1 -1
- package/dist/zkgroup/auth/ServerZkAuthOperations.js +1 -0
- package/dist/zkgroup/backups/BackupAuthCredential.d.ts +3 -3
- package/dist/zkgroup/backups/BackupAuthCredential.js +1 -0
- package/dist/zkgroup/backups/BackupAuthCredentialPresentation.d.ts +2 -2
- package/dist/zkgroup/backups/BackupAuthCredentialPresentation.js +1 -0
- package/dist/zkgroup/backups/BackupAuthCredentialRequest.d.ts +2 -2
- package/dist/zkgroup/backups/BackupAuthCredentialRequest.js +1 -0
- package/dist/zkgroup/backups/BackupAuthCredentialRequestContext.d.ts +3 -3
- package/dist/zkgroup/backups/BackupAuthCredentialRequestContext.js +3 -2
- package/dist/zkgroup/backups/BackupAuthCredentialResponse.d.ts +1 -1
- package/dist/zkgroup/backups/BackupAuthCredentialResponse.js +1 -0
- package/dist/zkgroup/calllinks/CallLinkAuthCredential.d.ts +2 -2
- package/dist/zkgroup/calllinks/CallLinkAuthCredential.js +1 -0
- package/dist/zkgroup/calllinks/CallLinkAuthCredentialPresentation.d.ts +1 -1
- package/dist/zkgroup/calllinks/CallLinkAuthCredentialPresentation.js +1 -0
- package/dist/zkgroup/calllinks/CallLinkAuthCredentialResponse.d.ts +2 -2
- package/dist/zkgroup/calllinks/CallLinkAuthCredentialResponse.js +1 -0
- package/dist/zkgroup/calllinks/CallLinkPublicParams.d.ts +1 -1
- package/dist/zkgroup/calllinks/CallLinkPublicParams.js +1 -0
- package/dist/zkgroup/calllinks/CallLinkSecretParams.d.ts +2 -2
- package/dist/zkgroup/calllinks/CallLinkSecretParams.js +1 -0
- package/dist/zkgroup/calllinks/CreateCallLinkCredential.d.ts +3 -3
- package/dist/zkgroup/calllinks/CreateCallLinkCredential.js +1 -0
- package/dist/zkgroup/calllinks/CreateCallLinkCredentialPresentation.d.ts +2 -2
- package/dist/zkgroup/calllinks/CreateCallLinkCredentialPresentation.js +1 -0
- package/dist/zkgroup/calllinks/CreateCallLinkCredentialRequest.d.ts +2 -2
- package/dist/zkgroup/calllinks/CreateCallLinkCredentialRequest.js +1 -0
- package/dist/zkgroup/calllinks/CreateCallLinkCredentialRequestContext.d.ts +3 -3
- package/dist/zkgroup/calllinks/CreateCallLinkCredentialRequestContext.js +1 -0
- package/dist/zkgroup/calllinks/CreateCallLinkCredentialResponse.d.ts +1 -1
- package/dist/zkgroup/calllinks/CreateCallLinkCredentialResponse.js +1 -0
- package/dist/zkgroup/groups/ClientZkGroupCipher.d.ts +3 -3
- package/dist/zkgroup/groups/ClientZkGroupCipher.js +1 -0
- package/dist/zkgroup/groups/GroupIdentifier.d.ts +1 -1
- package/dist/zkgroup/groups/GroupIdentifier.js +3 -3
- package/dist/zkgroup/groups/GroupMasterKey.d.ts +1 -1
- package/dist/zkgroup/groups/GroupMasterKey.js +3 -3
- package/dist/zkgroup/groups/GroupPublicParams.d.ts +1 -1
- package/dist/zkgroup/groups/GroupPublicParams.js +1 -0
- package/dist/zkgroup/groups/GroupSecretParams.d.ts +2 -2
- package/dist/zkgroup/groups/GroupSecretParams.js +1 -0
- package/dist/zkgroup/groups/ProfileKeyCiphertext.d.ts +1 -1
- package/dist/zkgroup/groups/ProfileKeyCiphertext.js +1 -0
- package/dist/zkgroup/groups/UuidCiphertext.d.ts +2 -2
- package/dist/zkgroup/groups/UuidCiphertext.js +1 -0
- package/dist/zkgroup/groupsend/GroupSendDerivedKeyPair.d.ts +1 -1
- package/dist/zkgroup/groupsend/GroupSendEndorsement.d.ts +1 -1
- package/dist/zkgroup/groupsend/GroupSendEndorsementsResponse.d.ts +2 -2
- package/dist/zkgroup/groupsend/GroupSendFullToken.d.ts +1 -1
- package/dist/zkgroup/groupsend/GroupSendToken.d.ts +1 -1
- package/dist/zkgroup/internal/ByteArray.d.ts +5 -5
- package/dist/zkgroup/internal/ByteArray.js +1 -0
- package/dist/zkgroup/profiles/ClientZkProfileOperations.d.ts +2 -2
- package/dist/zkgroup/profiles/ClientZkProfileOperations.js +1 -0
- package/dist/zkgroup/profiles/ExpiringProfileKeyCredential.d.ts +1 -1
- package/dist/zkgroup/profiles/ExpiringProfileKeyCredential.js +1 -0
- package/dist/zkgroup/profiles/ExpiringProfileKeyCredentialResponse.d.ts +1 -1
- package/dist/zkgroup/profiles/ExpiringProfileKeyCredentialResponse.js +1 -0
- package/dist/zkgroup/profiles/ProfileKey.d.ts +2 -2
- package/dist/zkgroup/profiles/ProfileKey.js +3 -3
- package/dist/zkgroup/profiles/ProfileKeyCommitment.d.ts +1 -1
- package/dist/zkgroup/profiles/ProfileKeyCommitment.js +1 -0
- package/dist/zkgroup/profiles/ProfileKeyCredentialPresentation.d.ts +1 -1
- package/dist/zkgroup/profiles/ProfileKeyCredentialPresentation.js +1 -0
- package/dist/zkgroup/profiles/ProfileKeyCredentialRequest.d.ts +1 -1
- package/dist/zkgroup/profiles/ProfileKeyCredentialRequest.js +1 -0
- package/dist/zkgroup/profiles/ProfileKeyCredentialRequestContext.d.ts +1 -1
- package/dist/zkgroup/profiles/ProfileKeyCredentialRequestContext.js +1 -0
- package/dist/zkgroup/profiles/ProfileKeyVersion.d.ts +1 -1
- package/dist/zkgroup/profiles/ProfileKeyVersion.js +3 -3
- package/dist/zkgroup/profiles/ServerZkProfileOperations.d.ts +1 -1
- package/dist/zkgroup/profiles/ServerZkProfileOperations.js +1 -0
- package/dist/zkgroup/receipts/ClientZkReceiptOperations.d.ts +2 -2
- package/dist/zkgroup/receipts/ClientZkReceiptOperations.js +1 -0
- package/dist/zkgroup/receipts/ReceiptCredential.d.ts +1 -1
- package/dist/zkgroup/receipts/ReceiptCredential.js +1 -0
- package/dist/zkgroup/receipts/ReceiptCredentialPresentation.d.ts +1 -1
- package/dist/zkgroup/receipts/ReceiptCredentialPresentation.js +3 -3
- package/dist/zkgroup/receipts/ReceiptCredentialRequest.d.ts +1 -1
- package/dist/zkgroup/receipts/ReceiptCredentialRequest.js +1 -0
- package/dist/zkgroup/receipts/ReceiptCredentialRequestContext.d.ts +1 -1
- package/dist/zkgroup/receipts/ReceiptCredentialRequestContext.js +3 -3
- package/dist/zkgroup/receipts/ReceiptCredentialResponse.d.ts +1 -1
- package/dist/zkgroup/receipts/ReceiptCredentialResponse.js +1 -0
- package/dist/zkgroup/receipts/ReceiptSerial.d.ts +1 -1
- package/dist/zkgroup/receipts/ReceiptSerial.js +3 -3
- package/dist/zkgroup/receipts/ServerZkReceiptOperations.d.ts +1 -1
- package/dist/zkgroup/receipts/ServerZkReceiptOperations.js +1 -0
- package/package.json +3 -3
- package/prebuilds/darwin-arm64/@signalapp+libsignal-client.node +0 -0
- package/prebuilds/darwin-x64/@signalapp+libsignal-client.node +0 -0
- package/prebuilds/linux-arm64/@signalapp+libsignal-client.node +0 -0
- package/prebuilds/linux-x64/@signalapp+libsignal-client.node +0 -0
- package/prebuilds/win32-arm64/@signalapp+libsignal-client.node +0 -0
- package/prebuilds/win32-x64/@signalapp+libsignal-client.node +0 -0
package/dist/index.js
CHANGED
|
@@ -8,8 +8,11 @@ import * as Errors from './Errors.js';
|
|
|
8
8
|
export * from './Errors.js';
|
|
9
9
|
import { Aci, ProtocolAddress, ServiceId } from './Address.js';
|
|
10
10
|
export * from './Address.js';
|
|
11
|
-
import { PrivateKey, PublicKey } from './EcKeys.js';
|
|
11
|
+
import { IdentityKeyPair, PrivateKey, PublicKey } from './EcKeys.js';
|
|
12
12
|
export * from './EcKeys.js';
|
|
13
|
+
import { KEMPublicKey, SignedPreKeyRecord, } from './ProtocolTypes.js';
|
|
14
|
+
export * from './ProtocolTypes.js';
|
|
15
|
+
import { parseUuid } from './uuid.js';
|
|
13
16
|
export * from './uuid.js';
|
|
14
17
|
export * as usernames from './usernames.js';
|
|
15
18
|
export * as io from './io.js';
|
|
@@ -42,6 +45,7 @@ export function hkdf(outputLength, keyMaterial, label, salt) {
|
|
|
42
45
|
return Native.HKDF_DeriveSecrets(outputLength, keyMaterial, label, salt);
|
|
43
46
|
}
|
|
44
47
|
export class ScannableFingerprint {
|
|
48
|
+
scannable;
|
|
45
49
|
constructor(scannable) {
|
|
46
50
|
this.scannable = scannable;
|
|
47
51
|
}
|
|
@@ -56,6 +60,7 @@ export class ScannableFingerprint {
|
|
|
56
60
|
}
|
|
57
61
|
}
|
|
58
62
|
export class DisplayableFingerprint {
|
|
63
|
+
display;
|
|
59
64
|
constructor(display) {
|
|
60
65
|
this.display = display;
|
|
61
66
|
}
|
|
@@ -67,6 +72,7 @@ export class DisplayableFingerprint {
|
|
|
67
72
|
}
|
|
68
73
|
}
|
|
69
74
|
export class Fingerprint {
|
|
75
|
+
_nativeHandle;
|
|
70
76
|
constructor(nativeHandle) {
|
|
71
77
|
this._nativeHandle = nativeHandle;
|
|
72
78
|
}
|
|
@@ -88,6 +94,7 @@ export class Fingerprint {
|
|
|
88
94
|
* this API does not expose a streaming form.
|
|
89
95
|
*/
|
|
90
96
|
export class Aes256GcmSiv {
|
|
97
|
+
_nativeHandle;
|
|
91
98
|
constructor(key) {
|
|
92
99
|
this._nativeHandle = Native.Aes256GcmSiv_New(key);
|
|
93
100
|
}
|
|
@@ -119,21 +126,8 @@ export class Aes256GcmSiv {
|
|
|
119
126
|
return Native.Aes256GcmSiv_Decrypt(this, message, nonce, associatedData);
|
|
120
127
|
}
|
|
121
128
|
}
|
|
122
|
-
export class KEMPublicKey {
|
|
123
|
-
constructor(handle) {
|
|
124
|
-
this._nativeHandle = handle;
|
|
125
|
-
}
|
|
126
|
-
static _fromNativeHandle(handle) {
|
|
127
|
-
return new KEMPublicKey(handle);
|
|
128
|
-
}
|
|
129
|
-
static deserialize(buf) {
|
|
130
|
-
return new KEMPublicKey(Native.KyberPublicKey_Deserialize(buf));
|
|
131
|
-
}
|
|
132
|
-
serialize() {
|
|
133
|
-
return Native.KyberPublicKey_Serialize(this);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
129
|
export class KEMSecretKey {
|
|
130
|
+
_nativeHandle;
|
|
137
131
|
constructor(handle) {
|
|
138
132
|
this._nativeHandle = handle;
|
|
139
133
|
}
|
|
@@ -148,6 +142,7 @@ export class KEMSecretKey {
|
|
|
148
142
|
}
|
|
149
143
|
}
|
|
150
144
|
export class KEMKeyPair {
|
|
145
|
+
_nativeHandle;
|
|
151
146
|
constructor(handle) {
|
|
152
147
|
this._nativeHandle = handle;
|
|
153
148
|
}
|
|
@@ -164,54 +159,8 @@ export class KEMKeyPair {
|
|
|
164
159
|
return KEMSecretKey._fromNativeHandle(Native.KyberKeyPair_GetSecretKey(this));
|
|
165
160
|
}
|
|
166
161
|
}
|
|
167
|
-
export class PreKeyBundle {
|
|
168
|
-
constructor(handle) {
|
|
169
|
-
this._nativeHandle = handle;
|
|
170
|
-
}
|
|
171
|
-
static new(registration_id, device_id, prekey_id, prekey, signed_prekey_id, signed_prekey, signed_prekey_signature, identity_key, kyber_prekey_id, kyber_prekey, kyber_prekey_signature) {
|
|
172
|
-
return new PreKeyBundle(Native.PreKeyBundle_New(registration_id, device_id, prekey_id, prekey, signed_prekey_id, signed_prekey, signed_prekey_signature, identity_key, kyber_prekey_id, kyber_prekey, kyber_prekey_signature));
|
|
173
|
-
}
|
|
174
|
-
deviceId() {
|
|
175
|
-
return Native.PreKeyBundle_GetDeviceId(this);
|
|
176
|
-
}
|
|
177
|
-
identityKey() {
|
|
178
|
-
return PublicKey._fromNativeHandle(Native.PreKeyBundle_GetIdentityKey(this));
|
|
179
|
-
}
|
|
180
|
-
preKeyId() {
|
|
181
|
-
return Native.PreKeyBundle_GetPreKeyId(this);
|
|
182
|
-
}
|
|
183
|
-
preKeyPublic() {
|
|
184
|
-
const handle = Native.PreKeyBundle_GetPreKeyPublic(this);
|
|
185
|
-
if (handle == null) {
|
|
186
|
-
return null;
|
|
187
|
-
}
|
|
188
|
-
else {
|
|
189
|
-
return PublicKey._fromNativeHandle(handle);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
registrationId() {
|
|
193
|
-
return Native.PreKeyBundle_GetRegistrationId(this);
|
|
194
|
-
}
|
|
195
|
-
signedPreKeyId() {
|
|
196
|
-
return Native.PreKeyBundle_GetSignedPreKeyId(this);
|
|
197
|
-
}
|
|
198
|
-
signedPreKeyPublic() {
|
|
199
|
-
return PublicKey._fromNativeHandle(Native.PreKeyBundle_GetSignedPreKeyPublic(this));
|
|
200
|
-
}
|
|
201
|
-
signedPreKeySignature() {
|
|
202
|
-
return Native.PreKeyBundle_GetSignedPreKeySignature(this);
|
|
203
|
-
}
|
|
204
|
-
kyberPreKeyId() {
|
|
205
|
-
return Native.PreKeyBundle_GetKyberPreKeyId(this);
|
|
206
|
-
}
|
|
207
|
-
kyberPreKeyPublic() {
|
|
208
|
-
return KEMPublicKey._fromNativeHandle(Native.PreKeyBundle_GetKyberPreKeyPublic(this));
|
|
209
|
-
}
|
|
210
|
-
kyberPreKeySignature() {
|
|
211
|
-
return Native.PreKeyBundle_GetKyberPreKeySignature(this);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
162
|
export class PreKeyRecord {
|
|
163
|
+
_nativeHandle;
|
|
215
164
|
constructor(handle) {
|
|
216
165
|
this._nativeHandle = handle;
|
|
217
166
|
}
|
|
@@ -237,39 +186,8 @@ export class PreKeyRecord {
|
|
|
237
186
|
return Native.PreKeyRecord_Serialize(this);
|
|
238
187
|
}
|
|
239
188
|
}
|
|
240
|
-
export class SignedPreKeyRecord {
|
|
241
|
-
constructor(handle) {
|
|
242
|
-
this._nativeHandle = handle;
|
|
243
|
-
}
|
|
244
|
-
static _fromNativeHandle(nativeHandle) {
|
|
245
|
-
return new SignedPreKeyRecord(nativeHandle);
|
|
246
|
-
}
|
|
247
|
-
static new(id, timestamp, pubKey, privKey, signature) {
|
|
248
|
-
return new SignedPreKeyRecord(Native.SignedPreKeyRecord_New(id, timestamp, pubKey, privKey, signature));
|
|
249
|
-
}
|
|
250
|
-
static deserialize(buffer) {
|
|
251
|
-
return new SignedPreKeyRecord(Native.SignedPreKeyRecord_Deserialize(buffer));
|
|
252
|
-
}
|
|
253
|
-
id() {
|
|
254
|
-
return Native.SignedPreKeyRecord_GetId(this);
|
|
255
|
-
}
|
|
256
|
-
privateKey() {
|
|
257
|
-
return PrivateKey._fromNativeHandle(Native.SignedPreKeyRecord_GetPrivateKey(this));
|
|
258
|
-
}
|
|
259
|
-
publicKey() {
|
|
260
|
-
return PublicKey._fromNativeHandle(Native.SignedPreKeyRecord_GetPublicKey(this));
|
|
261
|
-
}
|
|
262
|
-
serialize() {
|
|
263
|
-
return Native.SignedPreKeyRecord_Serialize(this);
|
|
264
|
-
}
|
|
265
|
-
signature() {
|
|
266
|
-
return Native.SignedPreKeyRecord_GetSignature(this);
|
|
267
|
-
}
|
|
268
|
-
timestamp() {
|
|
269
|
-
return Native.SignedPreKeyRecord_GetTimestamp(this);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
189
|
export class KyberPreKeyRecord {
|
|
190
|
+
_nativeHandle;
|
|
273
191
|
constructor(handle) {
|
|
274
192
|
this._nativeHandle = handle;
|
|
275
193
|
}
|
|
@@ -305,6 +223,7 @@ export class KyberPreKeyRecord {
|
|
|
305
223
|
}
|
|
306
224
|
}
|
|
307
225
|
export class SignalMessage {
|
|
226
|
+
_nativeHandle;
|
|
308
227
|
constructor(handle) {
|
|
309
228
|
this._nativeHandle = handle;
|
|
310
229
|
}
|
|
@@ -334,6 +253,7 @@ export class SignalMessage {
|
|
|
334
253
|
}
|
|
335
254
|
}
|
|
336
255
|
export class PreKeySignalMessage {
|
|
256
|
+
_nativeHandle;
|
|
337
257
|
constructor(handle) {
|
|
338
258
|
this._nativeHandle = handle;
|
|
339
259
|
}
|
|
@@ -360,6 +280,7 @@ export class PreKeySignalMessage {
|
|
|
360
280
|
}
|
|
361
281
|
}
|
|
362
282
|
export class SessionRecord {
|
|
283
|
+
_nativeHandle;
|
|
363
284
|
constructor(nativeHandle) {
|
|
364
285
|
this._nativeHandle = nativeHandle;
|
|
365
286
|
}
|
|
@@ -394,6 +315,7 @@ export class SessionRecord {
|
|
|
394
315
|
}
|
|
395
316
|
}
|
|
396
317
|
export class ServerCertificate {
|
|
318
|
+
_nativeHandle;
|
|
397
319
|
static _fromNativeHandle(nativeHandle) {
|
|
398
320
|
return new ServerCertificate(nativeHandle);
|
|
399
321
|
}
|
|
@@ -423,6 +345,7 @@ export class ServerCertificate {
|
|
|
423
345
|
}
|
|
424
346
|
}
|
|
425
347
|
export class SenderKeyRecord {
|
|
348
|
+
_nativeHandle;
|
|
426
349
|
static _fromNativeHandle(nativeHandle) {
|
|
427
350
|
return new SenderKeyRecord(nativeHandle);
|
|
428
351
|
}
|
|
@@ -437,6 +360,7 @@ export class SenderKeyRecord {
|
|
|
437
360
|
}
|
|
438
361
|
}
|
|
439
362
|
export class SenderCertificate {
|
|
363
|
+
_nativeHandle;
|
|
440
364
|
constructor(nativeHandle) {
|
|
441
365
|
this._nativeHandle = nativeHandle;
|
|
442
366
|
}
|
|
@@ -524,15 +448,16 @@ function bridgeSenderKeyStore(store) {
|
|
|
524
448
|
};
|
|
525
449
|
}
|
|
526
450
|
export class SenderKeyDistributionMessage {
|
|
451
|
+
_nativeHandle;
|
|
527
452
|
constructor(nativeHandle) {
|
|
528
453
|
this._nativeHandle = nativeHandle;
|
|
529
454
|
}
|
|
530
455
|
static async create(sender, distributionId, store) {
|
|
531
|
-
const handle = await Native.SenderKeyDistributionMessage_Create(sender,
|
|
456
|
+
const handle = await Native.SenderKeyDistributionMessage_Create(sender, parseUuid(distributionId), bridgeSenderKeyStore(store));
|
|
532
457
|
return new SenderKeyDistributionMessage(handle);
|
|
533
458
|
}
|
|
534
459
|
static _new(messageVersion, distributionId, chainId, iteration, chainKey, pk) {
|
|
535
|
-
return new SenderKeyDistributionMessage(Native.SenderKeyDistributionMessage_New(messageVersion,
|
|
460
|
+
return new SenderKeyDistributionMessage(Native.SenderKeyDistributionMessage_New(messageVersion, parseUuid(distributionId), chainId, iteration, chainKey, pk));
|
|
536
461
|
}
|
|
537
462
|
static deserialize(buffer) {
|
|
538
463
|
return new SenderKeyDistributionMessage(Native.SenderKeyDistributionMessage_Deserialize(buffer));
|
|
@@ -557,11 +482,12 @@ export async function processSenderKeyDistributionMessage(sender, message, store
|
|
|
557
482
|
await Native.SenderKeyDistributionMessage_Process(sender, message, bridgeSenderKeyStore(store));
|
|
558
483
|
}
|
|
559
484
|
export class SenderKeyMessage {
|
|
485
|
+
_nativeHandle;
|
|
560
486
|
constructor(nativeHandle) {
|
|
561
487
|
this._nativeHandle = nativeHandle;
|
|
562
488
|
}
|
|
563
489
|
static _new(messageVersion, distributionId, chainId, iteration, ciphertext, pk) {
|
|
564
|
-
return new SenderKeyMessage(Native.SenderKeyMessage_New(messageVersion,
|
|
490
|
+
return new SenderKeyMessage(Native.SenderKeyMessage_New(messageVersion, parseUuid(distributionId), chainId, iteration, ciphertext, pk));
|
|
565
491
|
}
|
|
566
492
|
static deserialize(buffer) {
|
|
567
493
|
return new SenderKeyMessage(Native.SenderKeyMessage_Deserialize(buffer));
|
|
@@ -586,6 +512,7 @@ export class SenderKeyMessage {
|
|
|
586
512
|
}
|
|
587
513
|
}
|
|
588
514
|
export class UnidentifiedSenderMessageContent {
|
|
515
|
+
_nativeHandle;
|
|
589
516
|
constructor(nativeHandle) {
|
|
590
517
|
this._nativeHandle = nativeHandle;
|
|
591
518
|
}
|
|
@@ -626,28 +553,9 @@ export var IdentityChange;
|
|
|
626
553
|
IdentityChange[IdentityChange["ReplacedExisting"] = 1] = "ReplacedExisting";
|
|
627
554
|
})(IdentityChange || (IdentityChange = {}));
|
|
628
555
|
export class IdentityKeyStore {
|
|
629
|
-
async
|
|
630
|
-
const
|
|
631
|
-
return
|
|
632
|
-
}
|
|
633
|
-
async _getLocalRegistrationId() {
|
|
634
|
-
return this.getLocalRegistrationId();
|
|
635
|
-
}
|
|
636
|
-
async _saveIdentity(name, key) {
|
|
637
|
-
return this.saveIdentity(ProtocolAddress._fromNativeHandle(name), PublicKey._fromNativeHandle(key));
|
|
638
|
-
}
|
|
639
|
-
async _isTrustedIdentity(name, key, sending) {
|
|
640
|
-
const direction = sending ? Direction.Sending : Direction.Receiving;
|
|
641
|
-
return this.isTrustedIdentity(ProtocolAddress._fromNativeHandle(name), PublicKey._fromNativeHandle(key), direction);
|
|
642
|
-
}
|
|
643
|
-
async _getIdentity(name) {
|
|
644
|
-
const key = await this.getIdentity(ProtocolAddress._fromNativeHandle(name));
|
|
645
|
-
if (key == null) {
|
|
646
|
-
return Promise.resolve(null);
|
|
647
|
-
}
|
|
648
|
-
else {
|
|
649
|
-
return key._nativeHandle;
|
|
650
|
-
}
|
|
556
|
+
async getIdentityKeyPair() {
|
|
557
|
+
const privKey = await this.getIdentityKey();
|
|
558
|
+
return new IdentityKeyPair(privKey.getPublicKey(), privKey);
|
|
651
559
|
}
|
|
652
560
|
}
|
|
653
561
|
export class PreKeyStore {
|
|
@@ -659,12 +567,13 @@ export class KyberPreKeyStore {
|
|
|
659
567
|
export class SenderKeyStore {
|
|
660
568
|
}
|
|
661
569
|
export async function groupEncrypt(sender, distributionId, store, message) {
|
|
662
|
-
return CiphertextMessage._fromNativeHandle(await Native.GroupCipher_EncryptMessage(sender,
|
|
570
|
+
return CiphertextMessage._fromNativeHandle(await Native.GroupCipher_EncryptMessage(sender, parseUuid(distributionId), message, bridgeSenderKeyStore(store)));
|
|
663
571
|
}
|
|
664
572
|
export async function groupDecrypt(sender, store, message) {
|
|
665
573
|
return Native.GroupCipher_DecryptMessage(sender, message, bridgeSenderKeyStore(store));
|
|
666
574
|
}
|
|
667
575
|
export class SealedSenderDecryptionResult {
|
|
576
|
+
_nativeHandle;
|
|
668
577
|
constructor(nativeHandle) {
|
|
669
578
|
this._nativeHandle = nativeHandle;
|
|
670
579
|
}
|
|
@@ -698,6 +607,7 @@ export class SealedSenderDecryptionResult {
|
|
|
698
607
|
}
|
|
699
608
|
}
|
|
700
609
|
export class CiphertextMessage {
|
|
610
|
+
_nativeHandle;
|
|
701
611
|
constructor(nativeHandle) {
|
|
702
612
|
this._nativeHandle = nativeHandle;
|
|
703
613
|
}
|
|
@@ -715,6 +625,7 @@ export class CiphertextMessage {
|
|
|
715
625
|
}
|
|
716
626
|
}
|
|
717
627
|
export class PlaintextContent {
|
|
628
|
+
_nativeHandle;
|
|
718
629
|
constructor(nativeHandle) {
|
|
719
630
|
this._nativeHandle = nativeHandle;
|
|
720
631
|
}
|
|
@@ -735,6 +646,7 @@ export class PlaintextContent {
|
|
|
735
646
|
}
|
|
736
647
|
}
|
|
737
648
|
export class DecryptionErrorMessage {
|
|
649
|
+
_nativeHandle;
|
|
738
650
|
constructor(nativeHandle) {
|
|
739
651
|
this._nativeHandle = nativeHandle;
|
|
740
652
|
}
|
|
@@ -780,14 +692,38 @@ function bridgeSessionStore(store) {
|
|
|
780
692
|
},
|
|
781
693
|
};
|
|
782
694
|
}
|
|
695
|
+
function bridgeIdentityKeyStore(store) {
|
|
696
|
+
return {
|
|
697
|
+
async getLocalIdentityKeyPair() {
|
|
698
|
+
const keyPair = await store.getIdentityKeyPair();
|
|
699
|
+
return [
|
|
700
|
+
keyPair.privateKey._nativeHandle,
|
|
701
|
+
keyPair.publicKey._nativeHandle,
|
|
702
|
+
];
|
|
703
|
+
},
|
|
704
|
+
async getLocalRegistrationId() {
|
|
705
|
+
return store.getLocalRegistrationId();
|
|
706
|
+
},
|
|
707
|
+
async saveIdentityKey(name, key) {
|
|
708
|
+
return store.saveIdentity(ProtocolAddress._fromNativeHandle(name), PublicKey._fromNativeHandle(key));
|
|
709
|
+
},
|
|
710
|
+
async isTrustedIdentity(name, key, direction) {
|
|
711
|
+
return store.isTrustedIdentity(ProtocolAddress._fromNativeHandle(name), PublicKey._fromNativeHandle(key), direction);
|
|
712
|
+
},
|
|
713
|
+
async getIdentityKey(name) {
|
|
714
|
+
const key = await store.getIdentity(ProtocolAddress._fromNativeHandle(name));
|
|
715
|
+
return key ? key._nativeHandle : null;
|
|
716
|
+
},
|
|
717
|
+
};
|
|
718
|
+
}
|
|
783
719
|
export function processPreKeyBundle(bundle, address, sessionStore, identityStore, now = new Date()) {
|
|
784
|
-
return Native.SessionBuilder_ProcessPreKeyBundle(bundle, address, bridgeSessionStore(sessionStore), identityStore, now.getTime());
|
|
720
|
+
return Native.SessionBuilder_ProcessPreKeyBundle(bundle, address, bridgeSessionStore(sessionStore), bridgeIdentityKeyStore(identityStore), now.getTime());
|
|
785
721
|
}
|
|
786
722
|
export async function signalEncrypt(message, address, sessionStore, identityStore, now = new Date()) {
|
|
787
|
-
return CiphertextMessage._fromNativeHandle(await Native.SessionCipher_EncryptMessage(message, address, bridgeSessionStore(sessionStore), identityStore, now.getTime()));
|
|
723
|
+
return CiphertextMessage._fromNativeHandle(await Native.SessionCipher_EncryptMessage(message, address, bridgeSessionStore(sessionStore), bridgeIdentityKeyStore(identityStore), now.getTime()));
|
|
788
724
|
}
|
|
789
725
|
export function signalDecrypt(message, address, sessionStore, identityStore) {
|
|
790
|
-
return Native.SessionCipher_DecryptSignalMessage(message, address, bridgeSessionStore(sessionStore), identityStore);
|
|
726
|
+
return Native.SessionCipher_DecryptSignalMessage(message, address, bridgeSessionStore(sessionStore), bridgeIdentityKeyStore(identityStore));
|
|
791
727
|
}
|
|
792
728
|
function bridgePreKeyStore(store) {
|
|
793
729
|
return {
|
|
@@ -829,7 +765,7 @@ function bridgeKyberPreKeyStore(store) {
|
|
|
829
765
|
};
|
|
830
766
|
}
|
|
831
767
|
export function signalDecryptPreKey(message, address, sessionStore, identityStore, prekeyStore, signedPrekeyStore, kyberPrekeyStore) {
|
|
832
|
-
return Native.SessionCipher_DecryptPreKeySignalMessage(message, address, bridgeSessionStore(sessionStore), identityStore, bridgePreKeyStore(prekeyStore), bridgeSignedPreKeyStore(signedPrekeyStore), bridgeKyberPreKeyStore(kyberPrekeyStore));
|
|
768
|
+
return Native.SessionCipher_DecryptPreKeySignalMessage(message, address, bridgeSessionStore(sessionStore), bridgeIdentityKeyStore(identityStore), bridgePreKeyStore(prekeyStore), bridgeSignedPreKeyStore(signedPrekeyStore), bridgeKyberPreKeyStore(kyberPrekeyStore));
|
|
833
769
|
}
|
|
834
770
|
export async function sealedSenderEncryptMessage(message, address, senderCert, sessionStore, identityStore) {
|
|
835
771
|
const ciphertext = await signalEncrypt(message, address, sessionStore, identityStore);
|
|
@@ -837,7 +773,7 @@ export async function sealedSenderEncryptMessage(message, address, senderCert, s
|
|
|
837
773
|
return await sealedSenderEncrypt(usmc, address, identityStore);
|
|
838
774
|
}
|
|
839
775
|
export function sealedSenderEncrypt(content, address, identityStore) {
|
|
840
|
-
return Native.SealedSender_Encrypt(address, content, identityStore);
|
|
776
|
+
return Native.SealedSender_Encrypt(address, content, bridgeIdentityKeyStore(identityStore));
|
|
841
777
|
}
|
|
842
778
|
export async function sealedSenderMultiRecipientEncrypt(contentOrOptions, recipients, identityStore, sessionStore) {
|
|
843
779
|
let excludedRecipients = undefined;
|
|
@@ -856,21 +792,22 @@ export async function sealedSenderMultiRecipientEncrypt(contentOrOptions, recipi
|
|
|
856
792
|
} = contentOrOptions);
|
|
857
793
|
}
|
|
858
794
|
const recipientSessions = await sessionStore.getExistingSessions(recipients);
|
|
859
|
-
return await Native.SealedSender_MultiRecipientEncrypt(recipients, recipientSessions, ServiceId.toConcatenatedFixedWidthBinary(excludedRecipients ?? []), contentOrOptions, identityStore);
|
|
795
|
+
return await Native.SealedSender_MultiRecipientEncrypt(recipients, recipientSessions, ServiceId.toConcatenatedFixedWidthBinary(excludedRecipients ?? []), contentOrOptions, bridgeIdentityKeyStore(identityStore));
|
|
860
796
|
}
|
|
861
797
|
// For testing only
|
|
862
798
|
export function sealedSenderMultiRecipientMessageForSingleRecipient(message) {
|
|
863
799
|
return Native.SealedSender_MultiRecipientMessageForSingleRecipient(message);
|
|
864
800
|
}
|
|
865
801
|
export async function sealedSenderDecryptMessage(message, trustRoot, timestamp, localE164, localUuid, localDeviceId, sessionStore, identityStore, prekeyStore, signedPrekeyStore, kyberPrekeyStore) {
|
|
866
|
-
const ssdr = await Native.SealedSender_DecryptMessage(message, trustRoot, timestamp, localE164, localUuid, localDeviceId, bridgeSessionStore(sessionStore), identityStore, bridgePreKeyStore(prekeyStore), bridgeSignedPreKeyStore(signedPrekeyStore), bridgeKyberPreKeyStore(kyberPrekeyStore));
|
|
802
|
+
const ssdr = await Native.SealedSender_DecryptMessage(message, trustRoot, timestamp, localE164, localUuid, localDeviceId, bridgeSessionStore(sessionStore), bridgeIdentityKeyStore(identityStore), bridgePreKeyStore(prekeyStore), bridgeSignedPreKeyStore(signedPrekeyStore), bridgeKyberPreKeyStore(kyberPrekeyStore));
|
|
867
803
|
return SealedSenderDecryptionResult._fromNativeHandle(ssdr);
|
|
868
804
|
}
|
|
869
805
|
export async function sealedSenderDecryptToUsmc(message, identityStore) {
|
|
870
|
-
const usmc = await Native.SealedSender_DecryptToUsmc(message, identityStore);
|
|
806
|
+
const usmc = await Native.SealedSender_DecryptToUsmc(message, bridgeIdentityKeyStore(identityStore));
|
|
871
807
|
return UnidentifiedSenderMessageContent._fromNativeHandle(usmc);
|
|
872
808
|
}
|
|
873
809
|
export class Cds2Client {
|
|
810
|
+
_nativeHandle;
|
|
874
811
|
constructor(nativeHandle) {
|
|
875
812
|
this._nativeHandle = nativeHandle;
|
|
876
813
|
}
|
|
@@ -891,6 +828,7 @@ export class Cds2Client {
|
|
|
891
828
|
}
|
|
892
829
|
}
|
|
893
830
|
export class HsmEnclaveClient {
|
|
831
|
+
_nativeHandle;
|
|
894
832
|
constructor(nativeHandle) {
|
|
895
833
|
this._nativeHandle = nativeHandle;
|
|
896
834
|
}
|
package/dist/internal.js
CHANGED
package/dist/io.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as Native from './Native.js';
|
|
|
3
3
|
* An abstract class representing an input stream of bytes.
|
|
4
4
|
*/
|
|
5
5
|
export declare abstract class InputStream implements Native.InputStream {
|
|
6
|
-
_read(amount: number): Promise<Uint8Array
|
|
6
|
+
_read(amount: number): Promise<Uint8Array<ArrayBuffer>>;
|
|
7
7
|
_skip(amount: number): Promise<void>;
|
|
8
8
|
/**
|
|
9
9
|
* Called to indicate the stream's resources should be released.
|
|
@@ -21,7 +21,7 @@ export declare abstract class InputStream implements Native.InputStream {
|
|
|
21
21
|
* @returns A promise yielding a {@link Uint8Array} containing the read bytes.
|
|
22
22
|
* @throws {IoError} If an I/O error occurred while reading from the input.
|
|
23
23
|
*/
|
|
24
|
-
abstract read(amount: number): Promise<Uint8Array
|
|
24
|
+
abstract read(amount: number): Promise<Uint8Array<ArrayBuffer>>;
|
|
25
25
|
/**
|
|
26
26
|
* Skip an amount of bytes in the input stream.
|
|
27
27
|
*
|
package/dist/net/Chat.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type ChatRequest = Readonly<{
|
|
|
7
7
|
verb: string;
|
|
8
8
|
path: string;
|
|
9
9
|
headers: ReadonlyArray<[string, string]>;
|
|
10
|
-
body?: Uint8Array
|
|
10
|
+
body?: Uint8Array<ArrayBuffer>;
|
|
11
11
|
timeoutMillis?: number;
|
|
12
12
|
}>;
|
|
13
13
|
export type RequestOptions = {
|
|
@@ -38,7 +38,7 @@ export interface ChatServiceListener extends ConnectionEventsListener {
|
|
|
38
38
|
* If `ack`'s `send` method is not called, the server will leave this message in the message
|
|
39
39
|
* queue and attempt to deliver it again in the future.
|
|
40
40
|
*/
|
|
41
|
-
onIncomingMessage: (envelope: Uint8Array
|
|
41
|
+
onIncomingMessage: (envelope: Uint8Array<ArrayBuffer>, timestamp: number, ack: ChatServerMessageAck) => void;
|
|
42
42
|
/**
|
|
43
43
|
* Called when the server indicates that there are no further messages in the message queue.
|
|
44
44
|
*
|
|
@@ -69,7 +69,7 @@ export interface ProvisioningConnectionListener extends ConnectionEventsListener
|
|
|
69
69
|
*
|
|
70
70
|
* Once the server receives the `ack` for this message, it will close this connection.
|
|
71
71
|
*/
|
|
72
|
-
onReceivedEnvelope: (envelope: Uint8Array
|
|
72
|
+
onReceivedEnvelope: (envelope: Uint8Array<ArrayBuffer>, ack: ChatServerMessageAck) => void;
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
75
|
* A connection to the Chat Service.
|
package/dist/net/Chat.js
CHANGED
|
@@ -8,6 +8,7 @@ import { newNativeHandle } from '../internal.js';
|
|
|
8
8
|
import { FakeChatRemote } from './FakeChat.js';
|
|
9
9
|
const DEFAULT_CHAT_REQUEST_TIMEOUT_MILLIS = 5000;
|
|
10
10
|
export class ChatServerMessageAck {
|
|
11
|
+
_nativeHandle;
|
|
11
12
|
constructor(_nativeHandle) {
|
|
12
13
|
this._nativeHandle = _nativeHandle;
|
|
13
14
|
}
|
|
@@ -16,6 +17,7 @@ export class ChatServerMessageAck {
|
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
class ConnectionInfoImpl {
|
|
20
|
+
_nativeHandle;
|
|
19
21
|
constructor(_nativeHandle) {
|
|
20
22
|
this._nativeHandle = _nativeHandle;
|
|
21
23
|
}
|
|
@@ -38,6 +40,10 @@ class ConnectionInfoImpl {
|
|
|
38
40
|
}
|
|
39
41
|
}
|
|
40
42
|
export class UnauthenticatedChatConnection {
|
|
43
|
+
_asyncContext;
|
|
44
|
+
_chatService;
|
|
45
|
+
chatListener;
|
|
46
|
+
env;
|
|
41
47
|
static async connect(asyncContext, connectionManager, listener, env, options) {
|
|
42
48
|
const nativeChatListener = makeNativeChatListener(asyncContext, listener);
|
|
43
49
|
const connect = Native.UnauthenticatedChatConnection_connect(asyncContext, connectionManager, options?.languages ?? []);
|
|
@@ -91,6 +97,9 @@ export class UnauthenticatedChatConnection {
|
|
|
91
97
|
}
|
|
92
98
|
}
|
|
93
99
|
export class AuthenticatedChatConnection {
|
|
100
|
+
asyncContext;
|
|
101
|
+
chatService;
|
|
102
|
+
chatListener;
|
|
94
103
|
static async connect(asyncContext, connectionManager, username, password, receiveStories, listener, options) {
|
|
95
104
|
const nativeChatListener = makeNativeChatListener(asyncContext, listener);
|
|
96
105
|
const connect = Native.AuthenticatedChatConnection_connect(asyncContext, connectionManager, username, password, receiveStories, options?.languages ?? []);
|
|
@@ -142,6 +151,9 @@ export class AuthenticatedChatConnection {
|
|
|
142
151
|
* interesting functionality is in the events delivered to the {@link ProvisioningConnectionListener}.
|
|
143
152
|
*/
|
|
144
153
|
export class ProvisioningConnection {
|
|
154
|
+
asyncContext;
|
|
155
|
+
chatService;
|
|
156
|
+
chatListener;
|
|
145
157
|
static async connect(asyncContext, connectionManager, listener, options) {
|
|
146
158
|
const nativeListener = this.makeNativeProvisioningListener(listener);
|
|
147
159
|
const connect = Native.ProvisioningChatConnection_connect(asyncContext, connectionManager);
|
|
@@ -213,6 +225,7 @@ export class ProvisioningConnection {
|
|
|
213
225
|
* stays alive as long as the connection does.
|
|
214
226
|
*/
|
|
215
227
|
class WeakListenerWrapper {
|
|
228
|
+
listener;
|
|
216
229
|
constructor(listener) {
|
|
217
230
|
this.listener = new WeakRef(listener);
|
|
218
231
|
}
|
|
@@ -231,6 +244,7 @@ class WeakListenerWrapper {
|
|
|
231
244
|
}
|
|
232
245
|
/** Like {@link WeakListenerWrapper}, but for {@link ProvisioningConnection}. */
|
|
233
246
|
class WeakProvisioningListenerWrapper {
|
|
247
|
+
listener;
|
|
234
248
|
constructor(listener) {
|
|
235
249
|
this.listener = new WeakRef(listener);
|
|
236
250
|
}
|
package/dist/net/FakeChat.d.ts
CHANGED
|
@@ -8,14 +8,14 @@ export declare class InternalRequest implements Native.Wrapper<Native.HttpReques
|
|
|
8
8
|
get verb(): string;
|
|
9
9
|
get path(): string;
|
|
10
10
|
get headers(): Map<string, string>;
|
|
11
|
-
get body(): Uint8Array
|
|
11
|
+
get body(): Uint8Array<ArrayBuffer>;
|
|
12
12
|
}
|
|
13
13
|
export type ServerResponse = {
|
|
14
14
|
id: bigint;
|
|
15
15
|
status: number;
|
|
16
16
|
message?: string;
|
|
17
17
|
headers?: string[];
|
|
18
|
-
body?: Uint8Array
|
|
18
|
+
body?: Uint8Array<ArrayBuffer>;
|
|
19
19
|
};
|
|
20
20
|
export declare class FakeChatRemote {
|
|
21
21
|
private asyncContext;
|
|
@@ -25,7 +25,7 @@ export declare class FakeChatRemote {
|
|
|
25
25
|
assertReceiveIncomingRequest(): Promise<InternalRequest>;
|
|
26
26
|
sendReplyTo(request: InternalRequest, response: Omit<ServerResponse, 'id'>): void;
|
|
27
27
|
sendServerResponse(response: ServerResponse): void;
|
|
28
|
-
sendRawServerResponse(bytes: Uint8Array): void;
|
|
29
|
-
sendRawServerRequest(bytes: Uint8Array): void;
|
|
28
|
+
sendRawServerResponse(bytes: Uint8Array<ArrayBuffer>): void;
|
|
29
|
+
sendRawServerRequest(bytes: Uint8Array<ArrayBuffer>): void;
|
|
30
30
|
injectConnectionInterrupted(): void;
|
|
31
31
|
}
|
package/dist/net/FakeChat.js
CHANGED
|
@@ -6,6 +6,8 @@ import * as Native from '../Native.js';
|
|
|
6
6
|
import { newNativeHandle } from '../internal.js';
|
|
7
7
|
import assert from 'node:assert';
|
|
8
8
|
export class InternalRequest {
|
|
9
|
+
_nativeHandle;
|
|
10
|
+
requestId;
|
|
9
11
|
constructor([nativeHandle, requestId]) {
|
|
10
12
|
this._nativeHandle = nativeHandle;
|
|
11
13
|
this.requestId = requestId;
|
|
@@ -27,6 +29,8 @@ export class InternalRequest {
|
|
|
27
29
|
}
|
|
28
30
|
}
|
|
29
31
|
export class FakeChatRemote {
|
|
32
|
+
asyncContext;
|
|
33
|
+
_nativeHandle;
|
|
30
34
|
constructor(asyncContext, _nativeHandle) {
|
|
31
35
|
this.asyncContext = asyncContext;
|
|
32
36
|
this._nativeHandle = _nativeHandle;
|
|
@@ -9,10 +9,10 @@ import { Environment, type TokioAsyncContext } from '../net.js';
|
|
|
9
9
|
* used by the {@link Client}.
|
|
10
10
|
*/
|
|
11
11
|
export interface Store {
|
|
12
|
-
getLastDistinguishedTreeHead: () => Promise<Uint8Array | null>;
|
|
13
|
-
setLastDistinguishedTreeHead: (bytes: Readonly<Uint8Array
|
|
14
|
-
getAccountData: (aci: Aci) => Promise<Uint8Array | null>;
|
|
15
|
-
setAccountData: (aci: Aci, bytes: Readonly<Uint8Array
|
|
12
|
+
getLastDistinguishedTreeHead: () => Promise<Uint8Array<ArrayBuffer> | null>;
|
|
13
|
+
setLastDistinguishedTreeHead: (bytes: Readonly<Uint8Array<ArrayBuffer>> | null) => Promise<void>;
|
|
14
|
+
getAccountData: (aci: Aci) => Promise<Uint8Array<ArrayBuffer> | null>;
|
|
15
|
+
setAccountData: (aci: Aci, bytes: Readonly<Uint8Array<ArrayBuffer>>) => Promise<void>;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* Options that are accepted by all {@link Client} APIs.
|
|
@@ -34,7 +34,7 @@ export type AciInfo = {
|
|
|
34
34
|
*/
|
|
35
35
|
export type E164Info = {
|
|
36
36
|
e164: string;
|
|
37
|
-
unidentifiedAccessKey: Readonly<Uint8Array
|
|
37
|
+
unidentifiedAccessKey: Readonly<Uint8Array<ArrayBuffer>>;
|
|
38
38
|
};
|
|
39
39
|
/**
|
|
40
40
|
* Key transparency client request
|
|
@@ -45,7 +45,7 @@ export type Request = {
|
|
|
45
45
|
aciInfo: AciInfo;
|
|
46
46
|
/** Unidentified access key associated with the account. Optional. */
|
|
47
47
|
e164Info?: E164Info;
|
|
48
|
-
usernameHash?: Readonly<Uint8Array
|
|
48
|
+
usernameHash?: Readonly<Uint8Array<ArrayBuffer>>;
|
|
49
49
|
};
|
|
50
50
|
/**
|
|
51
51
|
* Mode of the monitor operation.
|
|
@@ -170,5 +170,5 @@ export declare class ClientImpl implements Client {
|
|
|
170
170
|
search(request: Request, store: Store, options?: Readonly<Options>): Promise<void>;
|
|
171
171
|
monitor(request: MonitorRequest, store: Store, options?: Readonly<Options>): Promise<void>;
|
|
172
172
|
private updateDistinguished;
|
|
173
|
-
_getLatestDistinguished(store: Store, options: Readonly<Options>): Promise<Uint8Array
|
|
173
|
+
_getLatestDistinguished(store: Store, options: Readonly<Options>): Promise<Uint8Array<ArrayBuffer>>;
|
|
174
174
|
}
|
|
@@ -17,6 +17,9 @@ export var MonitorMode;
|
|
|
17
17
|
MonitorMode[MonitorMode["Other"] = 1] = "Other";
|
|
18
18
|
})(MonitorMode || (MonitorMode = {}));
|
|
19
19
|
export class ClientImpl {
|
|
20
|
+
asyncContext;
|
|
21
|
+
chatService;
|
|
22
|
+
env;
|
|
20
23
|
constructor(asyncContext, chatService, env) {
|
|
21
24
|
this.asyncContext = asyncContext;
|
|
22
25
|
this.chatService = chatService;
|
|
@@ -139,11 +139,11 @@ export declare class RegistrationService {
|
|
|
139
139
|
export declare class AccountAttributes {
|
|
140
140
|
readonly _nativeHandle: Native.RegistrationAccountAttributes;
|
|
141
141
|
constructor({ recoveryPassword, aciRegistrationId, pniRegistrationId, registrationLock, unidentifiedAccessKey, unrestrictedUnidentifiedAccess, capabilities, discoverableByPhoneNumber, }: {
|
|
142
|
-
recoveryPassword: Uint8Array
|
|
142
|
+
recoveryPassword: Uint8Array<ArrayBuffer>;
|
|
143
143
|
aciRegistrationId: number;
|
|
144
144
|
pniRegistrationId: number;
|
|
145
145
|
registrationLock: string | null;
|
|
146
|
-
unidentifiedAccessKey: Uint8Array
|
|
146
|
+
unidentifiedAccessKey: Uint8Array<ArrayBuffer>;
|
|
147
147
|
unrestrictedUnidentifiedAccess: boolean;
|
|
148
148
|
capabilities: Set<string>;
|
|
149
149
|
discoverableByPhoneNumber: boolean;
|
|
@@ -155,8 +155,8 @@ export declare class RegisterAccountResponse {
|
|
|
155
155
|
get aci(): Aci;
|
|
156
156
|
get pni(): Pni;
|
|
157
157
|
get number(): string;
|
|
158
|
-
get usernameHash(): Uint8Array | null;
|
|
159
|
-
get usernameLinkHandle(): Uint8Array | null;
|
|
158
|
+
get usernameHash(): Uint8Array<ArrayBuffer> | null;
|
|
159
|
+
get usernameLinkHandle(): Uint8Array<ArrayBuffer> | null;
|
|
160
160
|
get backupEntitlement(): {
|
|
161
161
|
backupLevel: bigint;
|
|
162
162
|
expirationSeconds: bigint;
|