@signalapp/libsignal-client 0.34.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Native.d.ts +12 -1
- package/dist/Address.js +1 -1
- package/dist/Mp4Sanitizer.js +3 -14
- package/dist/index.js +84 -145
- package/dist/net.js +10 -20
- package/dist/usernames.js +1 -1
- package/dist/zkgroup/internal/BigIntUtil.js +1 -1
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/node.napi.node +0 -0
- package/prebuilds/darwin-x64/node.napi.node +0 -0
- package/prebuilds/linux-arm64/node.napi.node +0 -0
- package/prebuilds/linux-x64/node.napi.node +0 -0
- package/prebuilds/win32-arm64/node.napi.node +0 -0
- package/prebuilds/win32-x64/node.napi.node +0 -0
package/Native.d.ts
CHANGED
|
@@ -108,7 +108,9 @@ export function CallLinkSecretParams_DecryptUserId(paramsBytes: Buffer, userId:
|
|
|
108
108
|
export function CallLinkSecretParams_DeriveFromRootKey(rootKey: Buffer): Buffer;
|
|
109
109
|
export function CallLinkSecretParams_GetPublicParams(paramsBytes: Buffer): Buffer;
|
|
110
110
|
export function Cds2ClientState_New(mrenclave: Buffer, attestationMsg: Buffer, currentTimestamp: Timestamp): SgxClientState;
|
|
111
|
-
export function
|
|
111
|
+
export function CdsiLookup_complete(asyncRuntime: Wrapper<TokioAsyncContext>, lookup: Wrapper<CdsiLookup>): Promise<LookupResponse>;
|
|
112
|
+
export function CdsiLookup_new(asyncRuntime: Wrapper<TokioAsyncContext>, connectionManager: Wrapper<ConnectionManager>, username: string, password: string, request: Wrapper<LookupRequest>, timeoutMillis: number): Promise<CdsiLookup>;
|
|
113
|
+
export function CdsiLookup_token(lookup: Wrapper<CdsiLookup>): Buffer;
|
|
112
114
|
export function CiphertextMessage_FromPlaintextContent(m: Wrapper<PlaintextContent>): CiphertextMessage;
|
|
113
115
|
export function CiphertextMessage_Serialize(obj: Wrapper<CiphertextMessage>): Buffer;
|
|
114
116
|
export function CiphertextMessage_Type(msg: Wrapper<CiphertextMessage>): number;
|
|
@@ -190,8 +192,10 @@ export function KyberSecretKey_Deserialize(data: Buffer): KyberSecretKey;
|
|
|
190
192
|
export function KyberSecretKey_Serialize(obj: Wrapper<KyberSecretKey>): Buffer;
|
|
191
193
|
export function LookupRequest_addAciAndAccessKey(request: Wrapper<LookupRequest>, aci: Buffer, accessKey: Buffer): void;
|
|
192
194
|
export function LookupRequest_addE164(request: Wrapper<LookupRequest>, e164: string): void;
|
|
195
|
+
export function LookupRequest_addPreviousE164(request: Wrapper<LookupRequest>, e164: string): void;
|
|
193
196
|
export function LookupRequest_new(): LookupRequest;
|
|
194
197
|
export function LookupRequest_setReturnAcisWithoutUaks(request: Wrapper<LookupRequest>, returnAcisWithoutUaks: boolean): void;
|
|
198
|
+
export function LookupRequest_setToken(request: Wrapper<LookupRequest>, token: Buffer): void;
|
|
195
199
|
export function Mp4Sanitizer_Sanitize(input: InputStream, len: Buffer): Promise<SanitizedMetadata>;
|
|
196
200
|
export function PlaintextContent_Deserialize(data: Buffer): PlaintextContent;
|
|
197
201
|
export function PlaintextContent_FromDecryptionErrorMessage(m: Wrapper<DecryptionErrorMessage>): PlaintextContent;
|
|
@@ -380,8 +384,11 @@ export function TESTING_ErrorOnReturnAsync(_needsCleanup: null): Promise<null>;
|
|
|
380
384
|
export function TESTING_ErrorOnReturnIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _needsCleanup: null): Promise<null>;
|
|
381
385
|
export function TESTING_ErrorOnReturnSync(_needsCleanup: null): null;
|
|
382
386
|
export function TESTING_FutureFailure(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _input: number): Promise<number>;
|
|
387
|
+
export function TESTING_FutureProducesOtherPointerType(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, input: string): Promise<OtherTestingHandleType>;
|
|
388
|
+
export function TESTING_FutureProducesPointerType(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, input: number): Promise<TestingHandleType>;
|
|
383
389
|
export function TESTING_FutureSuccess(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, input: number): Promise<number>;
|
|
384
390
|
export function TESTING_NonSuspendingBackgroundThreadRuntime_New(): NonSuspendingBackgroundThreadRuntime;
|
|
391
|
+
export function TESTING_OtherTestingHandleType_getValue(handle: Wrapper<OtherTestingHandleType>): string;
|
|
385
392
|
export function TESTING_PanicInBodyAsync(_input: null): Promise<void>;
|
|
386
393
|
export function TESTING_PanicInBodyIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _input: null): Promise<void>;
|
|
387
394
|
export function TESTING_PanicInBodySync(_input: null): void;
|
|
@@ -394,6 +401,7 @@ export function TESTING_PanicOnLoadSync(_needsCleanup: null, _input: null): void
|
|
|
394
401
|
export function TESTING_PanicOnReturnAsync(_needsCleanup: null): Promise<null>;
|
|
395
402
|
export function TESTING_PanicOnReturnIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _needsCleanup: null): Promise<null>;
|
|
396
403
|
export function TESTING_PanicOnReturnSync(_needsCleanup: null): null;
|
|
404
|
+
export function TESTING_TestingHandleType_getValue(handle: Wrapper<TestingHandleType>): number;
|
|
397
405
|
export function TokioAsyncContext_new(): TokioAsyncContext;
|
|
398
406
|
export function UnidentifiedSenderMessageContent_Deserialize(data: Buffer): UnidentifiedSenderMessageContent;
|
|
399
407
|
export function UnidentifiedSenderMessageContent_GetContentHint(m: Wrapper<UnidentifiedSenderMessageContent>): number;
|
|
@@ -420,6 +428,7 @@ interface AuthCredential { readonly __type: unique symbol; }
|
|
|
420
428
|
interface AuthCredentialResponse { readonly __type: unique symbol; }
|
|
421
429
|
interface AuthCredentialWithPni { readonly __type: unique symbol; }
|
|
422
430
|
interface AuthCredentialWithPniResponse { readonly __type: unique symbol; }
|
|
431
|
+
interface CdsiLookup { readonly __type: unique symbol; }
|
|
423
432
|
interface CiphertextMessage { readonly __type: unique symbol; }
|
|
424
433
|
interface ConnectionManager { readonly __type: unique symbol; }
|
|
425
434
|
interface DecryptionErrorMessage { readonly __type: unique symbol; }
|
|
@@ -437,6 +446,7 @@ interface KyberPublicKey { readonly __type: unique symbol; }
|
|
|
437
446
|
interface KyberSecretKey { readonly __type: unique symbol; }
|
|
438
447
|
interface LookupRequest { readonly __type: unique symbol; }
|
|
439
448
|
interface NonSuspendingBackgroundThreadRuntime { readonly __type: unique symbol; }
|
|
449
|
+
interface OtherTestingHandleType { readonly __type: unique symbol; }
|
|
440
450
|
interface PlaintextContent { readonly __type: unique symbol; }
|
|
441
451
|
interface PreKeyBundle { readonly __type: unique symbol; }
|
|
442
452
|
interface PreKeyRecord { readonly __type: unique symbol; }
|
|
@@ -467,6 +477,7 @@ interface SessionRecord { readonly __type: unique symbol; }
|
|
|
467
477
|
interface SgxClientState { readonly __type: unique symbol; }
|
|
468
478
|
interface SignalMessage { readonly __type: unique symbol; }
|
|
469
479
|
interface SignedPreKeyRecord { readonly __type: unique symbol; }
|
|
480
|
+
interface TestingHandleType { readonly __type: unique symbol; }
|
|
470
481
|
interface TokioAsyncContext { readonly __type: unique symbol; }
|
|
471
482
|
interface UnidentifiedSenderMessageContent { readonly __type: unique symbol; }
|
|
472
483
|
interface UuidCiphertext { readonly __type: unique symbol; }
|
package/dist/Address.js
CHANGED
package/dist/Mp4Sanitizer.js
CHANGED
|
@@ -3,15 +3,6 @@
|
|
|
3
3
|
// Copyright 2023 Signal Messenger, LLC.
|
|
4
4
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
5
5
|
//
|
|
6
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
7
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
8
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
10
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
11
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
12
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
7
|
exports.sanitize = exports.SanitizedMetadata = void 0;
|
|
17
8
|
/**
|
|
@@ -89,11 +80,9 @@ exports.SanitizedMetadata = SanitizedMetadata;
|
|
|
89
80
|
* @throws InvalidMediaInputError If the input could not be parsed because it was invalid.
|
|
90
81
|
* @throws UnsupportedMediaInputError If the input could not be parsed because it's unsupported in some way.
|
|
91
82
|
*/
|
|
92
|
-
function sanitize(input, len) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
return SanitizedMetadata._fromNativeHandle(sanitizedMetadataNativeHandle);
|
|
96
|
-
});
|
|
83
|
+
async function sanitize(input, len) {
|
|
84
|
+
const sanitizedMetadataNativeHandle = await Native.Mp4Sanitizer_Sanitize(input, (0, BigIntUtil_1.bufferFromBigUInt64BE)(len));
|
|
85
|
+
return SanitizedMetadata._fromNativeHandle(sanitizedMetadataNativeHandle);
|
|
97
86
|
}
|
|
98
87
|
exports.sanitize = sanitize;
|
|
99
88
|
//# sourceMappingURL=Mp4Sanitizer.js.map
|
package/dist/index.js
CHANGED
|
@@ -17,15 +17,6 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
17
17
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
18
18
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
19
19
|
};
|
|
20
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
21
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
22
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
23
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
24
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
25
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
26
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
21
|
exports.signalDecryptPreKey = exports.signalDecrypt = exports.signalEncrypt = exports.processPreKeyBundle = exports.DecryptionErrorMessage = exports.PlaintextContent = exports.CiphertextMessage = exports.SealedSenderDecryptionResult = exports.groupDecrypt = exports.groupEncrypt = exports.SenderKeyStore = exports.KyberPreKeyStore = exports.SignedPreKeyStore = exports.PreKeyStore = exports.IdentityKeyStore = exports.SessionStore = exports.UnidentifiedSenderMessageContent = exports.SenderKeyMessage = exports.processSenderKeyDistributionMessage = exports.SenderKeyDistributionMessage = exports.SenderCertificate = exports.SenderKeyRecord = exports.ServerCertificate = exports.SessionRecord = exports.PreKeySignalMessage = exports.SignalMessage = exports.KyberPreKeyRecord = exports.SignedPreKeyRecord = exports.PreKeyRecord = exports.PreKeyBundle = exports.IdentityKeyPair = exports.KEMKeyPair = exports.KEMSecretKey = exports.KEMPublicKey = exports.PrivateKey = exports.PublicKey = exports.Aes256GcmSiv = exports.Fingerprint = exports.DisplayableFingerprint = exports.ScannableFingerprint = exports.hkdf = exports.HKDF = exports.ContentHint = exports.Direction = exports.CiphertextMessageType = exports.WebpSanitizer = exports.Mp4Sanitizer = exports.Net = exports.io = exports.usernames = void 0;
|
|
31
22
|
exports.initLogger = exports.LogLevel = exports.HsmEnclaveClient = exports.Cds2Client = exports.sealedSenderDecryptToUsmc = exports.sealedSenderDecryptMessage = exports.sealedSenderMultiRecipientMessageForSingleRecipient = exports.sealedSenderMultiRecipientEncrypt = exports.sealedSenderEncrypt = exports.sealedSenderEncryptMessage = void 0;
|
|
@@ -268,7 +259,7 @@ class PreKeyBundle {
|
|
|
268
259
|
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) {
|
|
269
260
|
return new PreKeyBundle(Native.PreKeyBundle_New(registration_id, device_id, prekey_id, prekey != null ? prekey : null,
|
|
270
261
|
//prekey?,
|
|
271
|
-
signed_prekey_id, signed_prekey, signed_prekey_signature, identity_key, kyber_prekey_id
|
|
262
|
+
signed_prekey_id, signed_prekey, signed_prekey_signature, identity_key, kyber_prekey_id ?? null, kyber_prekey ?? null, kyber_prekey_signature ?? Buffer.alloc(0)));
|
|
272
263
|
}
|
|
273
264
|
deviceId() {
|
|
274
265
|
return Native.PreKeyBundle_GetDeviceId(this);
|
|
@@ -586,7 +577,7 @@ class SenderCertificate {
|
|
|
586
577
|
try {
|
|
587
578
|
return Address_1.Aci.parseFromServiceIdString(this.senderUuid());
|
|
588
579
|
}
|
|
589
|
-
catch
|
|
580
|
+
catch {
|
|
590
581
|
return null;
|
|
591
582
|
}
|
|
592
583
|
}
|
|
@@ -608,11 +599,9 @@ class SenderKeyDistributionMessage {
|
|
|
608
599
|
constructor(nativeHandle) {
|
|
609
600
|
this._nativeHandle = nativeHandle;
|
|
610
601
|
}
|
|
611
|
-
static create(sender, distributionId, store) {
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
return new SenderKeyDistributionMessage(handle);
|
|
615
|
-
});
|
|
602
|
+
static async create(sender, distributionId, store) {
|
|
603
|
+
const handle = await Native.SenderKeyDistributionMessage_Create(sender, Buffer.from(uuid.parse(distributionId)), store);
|
|
604
|
+
return new SenderKeyDistributionMessage(handle);
|
|
616
605
|
}
|
|
617
606
|
static _new(messageVersion, distributionId, chainId, iteration, chainKey, pk) {
|
|
618
607
|
return new SenderKeyDistributionMessage(Native.SenderKeyDistributionMessage_New(messageVersion, Buffer.from(uuid.parse(distributionId)), chainId, iteration, chainKey, pk));
|
|
@@ -637,10 +626,8 @@ class SenderKeyDistributionMessage {
|
|
|
637
626
|
}
|
|
638
627
|
}
|
|
639
628
|
exports.SenderKeyDistributionMessage = SenderKeyDistributionMessage;
|
|
640
|
-
function processSenderKeyDistributionMessage(sender, message, store) {
|
|
641
|
-
|
|
642
|
-
yield Native.SenderKeyDistributionMessage_Process(sender, message, store);
|
|
643
|
-
});
|
|
629
|
+
async function processSenderKeyDistributionMessage(sender, message, store) {
|
|
630
|
+
await Native.SenderKeyDistributionMessage_Process(sender, message, store);
|
|
644
631
|
}
|
|
645
632
|
exports.processSenderKeyDistributionMessage = processSenderKeyDistributionMessage;
|
|
646
633
|
class SenderKeyMessage {
|
|
@@ -707,141 +694,103 @@ class UnidentifiedSenderMessageContent {
|
|
|
707
694
|
}
|
|
708
695
|
exports.UnidentifiedSenderMessageContent = UnidentifiedSenderMessageContent;
|
|
709
696
|
class SessionStore {
|
|
710
|
-
_saveSession(name, record) {
|
|
711
|
-
return
|
|
712
|
-
return this.saveSession(Address_1.ProtocolAddress._fromNativeHandle(name), SessionRecord._fromNativeHandle(record));
|
|
713
|
-
});
|
|
697
|
+
async _saveSession(name, record) {
|
|
698
|
+
return this.saveSession(Address_1.ProtocolAddress._fromNativeHandle(name), SessionRecord._fromNativeHandle(record));
|
|
714
699
|
}
|
|
715
|
-
_getSession(name) {
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
}
|
|
724
|
-
});
|
|
700
|
+
async _getSession(name) {
|
|
701
|
+
const sess = await this.getSession(Address_1.ProtocolAddress._fromNativeHandle(name));
|
|
702
|
+
if (sess == null) {
|
|
703
|
+
return null;
|
|
704
|
+
}
|
|
705
|
+
else {
|
|
706
|
+
return sess._nativeHandle;
|
|
707
|
+
}
|
|
725
708
|
}
|
|
726
709
|
}
|
|
727
710
|
exports.SessionStore = SessionStore;
|
|
728
711
|
class IdentityKeyStore {
|
|
729
|
-
_getIdentityKey() {
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
return key._nativeHandle;
|
|
733
|
-
});
|
|
712
|
+
async _getIdentityKey() {
|
|
713
|
+
const key = await this.getIdentityKey();
|
|
714
|
+
return key._nativeHandle;
|
|
734
715
|
}
|
|
735
|
-
_getLocalRegistrationId() {
|
|
736
|
-
return
|
|
737
|
-
return this.getLocalRegistrationId();
|
|
738
|
-
});
|
|
716
|
+
async _getLocalRegistrationId() {
|
|
717
|
+
return this.getLocalRegistrationId();
|
|
739
718
|
}
|
|
740
|
-
_saveIdentity(name, key) {
|
|
741
|
-
return
|
|
742
|
-
return this.saveIdentity(Address_1.ProtocolAddress._fromNativeHandle(name), PublicKey._fromNativeHandle(key));
|
|
743
|
-
});
|
|
719
|
+
async _saveIdentity(name, key) {
|
|
720
|
+
return this.saveIdentity(Address_1.ProtocolAddress._fromNativeHandle(name), PublicKey._fromNativeHandle(key));
|
|
744
721
|
}
|
|
745
|
-
_isTrustedIdentity(name, key, sending) {
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
return this.isTrustedIdentity(Address_1.ProtocolAddress._fromNativeHandle(name), PublicKey._fromNativeHandle(key), direction);
|
|
749
|
-
});
|
|
722
|
+
async _isTrustedIdentity(name, key, sending) {
|
|
723
|
+
const direction = sending ? Direction.Sending : Direction.Receiving;
|
|
724
|
+
return this.isTrustedIdentity(Address_1.ProtocolAddress._fromNativeHandle(name), PublicKey._fromNativeHandle(key), direction);
|
|
750
725
|
}
|
|
751
|
-
_getIdentity(name) {
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
}
|
|
760
|
-
});
|
|
726
|
+
async _getIdentity(name) {
|
|
727
|
+
const key = await this.getIdentity(Address_1.ProtocolAddress._fromNativeHandle(name));
|
|
728
|
+
if (key == null) {
|
|
729
|
+
return Promise.resolve(null);
|
|
730
|
+
}
|
|
731
|
+
else {
|
|
732
|
+
return key._nativeHandle;
|
|
733
|
+
}
|
|
761
734
|
}
|
|
762
735
|
}
|
|
763
736
|
exports.IdentityKeyStore = IdentityKeyStore;
|
|
764
737
|
class PreKeyStore {
|
|
765
|
-
_savePreKey(id, record) {
|
|
766
|
-
return
|
|
767
|
-
return this.savePreKey(id, PreKeyRecord._fromNativeHandle(record));
|
|
768
|
-
});
|
|
738
|
+
async _savePreKey(id, record) {
|
|
739
|
+
return this.savePreKey(id, PreKeyRecord._fromNativeHandle(record));
|
|
769
740
|
}
|
|
770
|
-
_getPreKey(id) {
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
return pk._nativeHandle;
|
|
774
|
-
});
|
|
741
|
+
async _getPreKey(id) {
|
|
742
|
+
const pk = await this.getPreKey(id);
|
|
743
|
+
return pk._nativeHandle;
|
|
775
744
|
}
|
|
776
|
-
_removePreKey(id) {
|
|
777
|
-
return
|
|
778
|
-
return this.removePreKey(id);
|
|
779
|
-
});
|
|
745
|
+
async _removePreKey(id) {
|
|
746
|
+
return this.removePreKey(id);
|
|
780
747
|
}
|
|
781
748
|
}
|
|
782
749
|
exports.PreKeyStore = PreKeyStore;
|
|
783
750
|
class SignedPreKeyStore {
|
|
784
|
-
_saveSignedPreKey(id, record) {
|
|
785
|
-
return
|
|
786
|
-
return this.saveSignedPreKey(id, SignedPreKeyRecord._fromNativeHandle(record));
|
|
787
|
-
});
|
|
751
|
+
async _saveSignedPreKey(id, record) {
|
|
752
|
+
return this.saveSignedPreKey(id, SignedPreKeyRecord._fromNativeHandle(record));
|
|
788
753
|
}
|
|
789
|
-
_getSignedPreKey(id) {
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
return pk._nativeHandle;
|
|
793
|
-
});
|
|
754
|
+
async _getSignedPreKey(id) {
|
|
755
|
+
const pk = await this.getSignedPreKey(id);
|
|
756
|
+
return pk._nativeHandle;
|
|
794
757
|
}
|
|
795
758
|
}
|
|
796
759
|
exports.SignedPreKeyStore = SignedPreKeyStore;
|
|
797
760
|
class KyberPreKeyStore {
|
|
798
|
-
_saveKyberPreKey(kyberPreKeyId, record) {
|
|
799
|
-
return
|
|
800
|
-
return this.saveKyberPreKey(kyberPreKeyId, KyberPreKeyRecord._fromNativeHandle(record));
|
|
801
|
-
});
|
|
761
|
+
async _saveKyberPreKey(kyberPreKeyId, record) {
|
|
762
|
+
return this.saveKyberPreKey(kyberPreKeyId, KyberPreKeyRecord._fromNativeHandle(record));
|
|
802
763
|
}
|
|
803
|
-
_getKyberPreKey(kyberPreKeyId) {
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
return prekey._nativeHandle;
|
|
807
|
-
});
|
|
764
|
+
async _getKyberPreKey(kyberPreKeyId) {
|
|
765
|
+
const prekey = await this.getKyberPreKey(kyberPreKeyId);
|
|
766
|
+
return prekey._nativeHandle;
|
|
808
767
|
}
|
|
809
|
-
_markKyberPreKeyUsed(kyberPreKeyId) {
|
|
810
|
-
return
|
|
811
|
-
return this.markKyberPreKeyUsed(kyberPreKeyId);
|
|
812
|
-
});
|
|
768
|
+
async _markKyberPreKeyUsed(kyberPreKeyId) {
|
|
769
|
+
return this.markKyberPreKeyUsed(kyberPreKeyId);
|
|
813
770
|
}
|
|
814
771
|
}
|
|
815
772
|
exports.KyberPreKeyStore = KyberPreKeyStore;
|
|
816
773
|
class SenderKeyStore {
|
|
817
|
-
_saveSenderKey(sender, distributionId, record) {
|
|
818
|
-
return
|
|
819
|
-
return this.saveSenderKey(Address_1.ProtocolAddress._fromNativeHandle(sender), uuid.stringify(distributionId), SenderKeyRecord._fromNativeHandle(record));
|
|
820
|
-
});
|
|
774
|
+
async _saveSenderKey(sender, distributionId, record) {
|
|
775
|
+
return this.saveSenderKey(Address_1.ProtocolAddress._fromNativeHandle(sender), uuid.stringify(distributionId), SenderKeyRecord._fromNativeHandle(record));
|
|
821
776
|
}
|
|
822
|
-
_getSenderKey(sender, distributionId) {
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
}
|
|
831
|
-
});
|
|
777
|
+
async _getSenderKey(sender, distributionId) {
|
|
778
|
+
const skr = await this.getSenderKey(Address_1.ProtocolAddress._fromNativeHandle(sender), uuid.stringify(distributionId));
|
|
779
|
+
if (skr == null) {
|
|
780
|
+
return null;
|
|
781
|
+
}
|
|
782
|
+
else {
|
|
783
|
+
return skr._nativeHandle;
|
|
784
|
+
}
|
|
832
785
|
}
|
|
833
786
|
}
|
|
834
787
|
exports.SenderKeyStore = SenderKeyStore;
|
|
835
|
-
function groupEncrypt(sender, distributionId, store, message) {
|
|
836
|
-
return
|
|
837
|
-
return CiphertextMessage._fromNativeHandle(yield Native.GroupCipher_EncryptMessage(sender, Buffer.from(uuid.parse(distributionId)), message, store));
|
|
838
|
-
});
|
|
788
|
+
async function groupEncrypt(sender, distributionId, store, message) {
|
|
789
|
+
return CiphertextMessage._fromNativeHandle(await Native.GroupCipher_EncryptMessage(sender, Buffer.from(uuid.parse(distributionId)), message, store));
|
|
839
790
|
}
|
|
840
791
|
exports.groupEncrypt = groupEncrypt;
|
|
841
|
-
function groupDecrypt(sender, store, message) {
|
|
842
|
-
return
|
|
843
|
-
return Native.GroupCipher_DecryptMessage(sender, message, store);
|
|
844
|
-
});
|
|
792
|
+
async function groupDecrypt(sender, store, message) {
|
|
793
|
+
return Native.GroupCipher_DecryptMessage(sender, message, store);
|
|
845
794
|
}
|
|
846
795
|
exports.groupDecrypt = groupDecrypt;
|
|
847
796
|
class SealedSenderDecryptionResult {
|
|
@@ -869,7 +818,7 @@ class SealedSenderDecryptionResult {
|
|
|
869
818
|
try {
|
|
870
819
|
return Address_1.Aci.parseFromServiceIdString(this.senderUuid());
|
|
871
820
|
}
|
|
872
|
-
catch
|
|
821
|
+
catch {
|
|
873
822
|
return null;
|
|
874
823
|
}
|
|
875
824
|
}
|
|
@@ -957,10 +906,8 @@ function processPreKeyBundle(bundle, address, sessionStore, identityStore, now =
|
|
|
957
906
|
return Native.SessionBuilder_ProcessPreKeyBundle(bundle, address, sessionStore, identityStore, now.getTime());
|
|
958
907
|
}
|
|
959
908
|
exports.processPreKeyBundle = processPreKeyBundle;
|
|
960
|
-
function signalEncrypt(message, address, sessionStore, identityStore, now = new Date()) {
|
|
961
|
-
return
|
|
962
|
-
return CiphertextMessage._fromNativeHandle(yield Native.SessionCipher_EncryptMessage(message, address, sessionStore, identityStore, now.getTime()));
|
|
963
|
-
});
|
|
909
|
+
async function signalEncrypt(message, address, sessionStore, identityStore, now = new Date()) {
|
|
910
|
+
return CiphertextMessage._fromNativeHandle(await Native.SessionCipher_EncryptMessage(message, address, sessionStore, identityStore, now.getTime()));
|
|
964
911
|
}
|
|
965
912
|
exports.signalEncrypt = signalEncrypt;
|
|
966
913
|
function signalDecrypt(message, address, sessionStore, identityStore) {
|
|
@@ -971,23 +918,19 @@ function signalDecryptPreKey(message, address, sessionStore, identityStore, prek
|
|
|
971
918
|
return Native.SessionCipher_DecryptPreKeySignalMessage(message, address, sessionStore, identityStore, prekeyStore, signedPrekeyStore, kyberPrekeyStore);
|
|
972
919
|
}
|
|
973
920
|
exports.signalDecryptPreKey = signalDecryptPreKey;
|
|
974
|
-
function sealedSenderEncryptMessage(message, address, senderCert, sessionStore, identityStore) {
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
return yield sealedSenderEncrypt(usmc, address, identityStore);
|
|
979
|
-
});
|
|
921
|
+
async function sealedSenderEncryptMessage(message, address, senderCert, sessionStore, identityStore) {
|
|
922
|
+
const ciphertext = await signalEncrypt(message, address, sessionStore, identityStore);
|
|
923
|
+
const usmc = UnidentifiedSenderMessageContent.new(ciphertext, senderCert, ContentHint.Default, null);
|
|
924
|
+
return await sealedSenderEncrypt(usmc, address, identityStore);
|
|
980
925
|
}
|
|
981
926
|
exports.sealedSenderEncryptMessage = sealedSenderEncryptMessage;
|
|
982
927
|
function sealedSenderEncrypt(content, address, identityStore) {
|
|
983
928
|
return Native.SealedSender_Encrypt(address, content, identityStore);
|
|
984
929
|
}
|
|
985
930
|
exports.sealedSenderEncrypt = sealedSenderEncrypt;
|
|
986
|
-
function sealedSenderMultiRecipientEncrypt(content, recipients, identityStore, sessionStore) {
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
return yield Native.SealedSender_MultiRecipientEncrypt(recipients, recipientSessions, content, identityStore);
|
|
990
|
-
});
|
|
931
|
+
async function sealedSenderMultiRecipientEncrypt(content, recipients, identityStore, sessionStore) {
|
|
932
|
+
const recipientSessions = await sessionStore.getExistingSessions(recipients);
|
|
933
|
+
return await Native.SealedSender_MultiRecipientEncrypt(recipients, recipientSessions, content, identityStore);
|
|
991
934
|
}
|
|
992
935
|
exports.sealedSenderMultiRecipientEncrypt = sealedSenderMultiRecipientEncrypt;
|
|
993
936
|
// For testing only
|
|
@@ -995,18 +938,14 @@ function sealedSenderMultiRecipientMessageForSingleRecipient(message) {
|
|
|
995
938
|
return Native.SealedSender_MultiRecipientMessageForSingleRecipient(message);
|
|
996
939
|
}
|
|
997
940
|
exports.sealedSenderMultiRecipientMessageForSingleRecipient = sealedSenderMultiRecipientMessageForSingleRecipient;
|
|
998
|
-
function sealedSenderDecryptMessage(message, trustRoot, timestamp, localE164, localUuid, localDeviceId, sessionStore, identityStore, prekeyStore, signedPrekeyStore, kyberPrekeyStore) {
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
return SealedSenderDecryptionResult._fromNativeHandle(ssdr);
|
|
1002
|
-
});
|
|
941
|
+
async function sealedSenderDecryptMessage(message, trustRoot, timestamp, localE164, localUuid, localDeviceId, sessionStore, identityStore, prekeyStore, signedPrekeyStore, kyberPrekeyStore) {
|
|
942
|
+
const ssdr = await Native.SealedSender_DecryptMessage(message, trustRoot, timestamp, localE164, localUuid, localDeviceId, sessionStore, identityStore, prekeyStore, signedPrekeyStore, kyberPrekeyStore);
|
|
943
|
+
return SealedSenderDecryptionResult._fromNativeHandle(ssdr);
|
|
1003
944
|
}
|
|
1004
945
|
exports.sealedSenderDecryptMessage = sealedSenderDecryptMessage;
|
|
1005
|
-
function sealedSenderDecryptToUsmc(message, identityStore) {
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
return UnidentifiedSenderMessageContent._fromNativeHandle(usmc);
|
|
1009
|
-
});
|
|
946
|
+
async function sealedSenderDecryptToUsmc(message, identityStore) {
|
|
947
|
+
const usmc = await Native.SealedSender_DecryptToUsmc(message, identityStore);
|
|
948
|
+
return UnidentifiedSenderMessageContent._fromNativeHandle(usmc);
|
|
1010
949
|
}
|
|
1011
950
|
exports.sealedSenderDecryptToUsmc = sealedSenderDecryptToUsmc;
|
|
1012
951
|
class Cds2Client {
|
package/dist/net.js
CHANGED
|
@@ -3,15 +3,6 @@
|
|
|
3
3
|
// Copyright 2023 Signal Messenger, LLC.
|
|
4
4
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
5
5
|
//
|
|
6
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
7
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
8
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
10
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
11
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
12
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
7
|
exports.Net = exports.Environment = void 0;
|
|
17
8
|
const Native = require("../Native");
|
|
@@ -27,18 +18,17 @@ class Net {
|
|
|
27
18
|
this._asyncContext = Native.TokioAsyncContext_new();
|
|
28
19
|
this._connectionManager = Native.ConnectionManager_new(env);
|
|
29
20
|
}
|
|
30
|
-
cdsiLookup({ username, password }, { e164s, acisAndAccessKeys, timeout, returnAcisWithoutUaks, }) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
Native.LookupRequest_addE164(request, e164);
|
|
35
|
-
});
|
|
36
|
-
acisAndAccessKeys.forEach(({ aci: aciStr, accessKey: accessKeyStr }) => {
|
|
37
|
-
Native.LookupRequest_addAciAndAccessKey(request, Address_1.Aci.parseFromServiceIdString(aciStr).getServiceIdFixedWidthBinary(), Buffer.from(accessKeyStr, 'base64'));
|
|
38
|
-
});
|
|
39
|
-
Native.LookupRequest_setReturnAcisWithoutUaks(request, returnAcisWithoutUaks);
|
|
40
|
-
return yield Native.CdsiLookup({ _nativeHandle: this._asyncContext }, { _nativeHandle: this._connectionManager }, username, password, request, timeout);
|
|
21
|
+
async cdsiLookup({ username, password }, { e164s, acisAndAccessKeys, timeout, returnAcisWithoutUaks, }) {
|
|
22
|
+
const request = { _nativeHandle: Native.LookupRequest_new() };
|
|
23
|
+
e164s.forEach((e164) => {
|
|
24
|
+
Native.LookupRequest_addE164(request, e164);
|
|
41
25
|
});
|
|
26
|
+
acisAndAccessKeys.forEach(({ aci: aciStr, accessKey: accessKeyStr }) => {
|
|
27
|
+
Native.LookupRequest_addAciAndAccessKey(request, Address_1.Aci.parseFromServiceIdString(aciStr).getServiceIdFixedWidthBinary(), Buffer.from(accessKeyStr, 'base64'));
|
|
28
|
+
});
|
|
29
|
+
Native.LookupRequest_setReturnAcisWithoutUaks(request, returnAcisWithoutUaks);
|
|
30
|
+
const lookup = await Native.CdsiLookup_new({ _nativeHandle: this._asyncContext }, { _nativeHandle: this._connectionManager }, username, password, request, timeout);
|
|
31
|
+
return await Native.CdsiLookup_complete({ _nativeHandle: this._asyncContext }, { _nativeHandle: lookup });
|
|
42
32
|
}
|
|
43
33
|
}
|
|
44
34
|
exports.Net = Net;
|
package/dist/usernames.js
CHANGED
|
@@ -31,7 +31,7 @@ function decryptUsernameLink(usernameLink) {
|
|
|
31
31
|
}
|
|
32
32
|
exports.decryptUsernameLink = decryptUsernameLink;
|
|
33
33
|
function createUsernameLink(username, previousEntropy) {
|
|
34
|
-
const usernameLinkData = Native.UsernameLink_Create(username, previousEntropy
|
|
34
|
+
const usernameLinkData = Native.UsernameLink_Create(username, previousEntropy ?? null);
|
|
35
35
|
const entropy = usernameLinkData.slice(0, 32);
|
|
36
36
|
const encryptedUsername = usernameLinkData.slice(32);
|
|
37
37
|
return { entropy, encryptedUsername };
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
//
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.bufferFromBigUInt64BE = void 0;
|
|
8
|
-
const UINT64_MAX =
|
|
8
|
+
const UINT64_MAX = 0xffffffffffffffffn;
|
|
9
9
|
function bufferFromBigUInt64BE(value) {
|
|
10
10
|
if (value < 0 || value > UINT64_MAX) {
|
|
11
11
|
throw new RangeError(`value ${value} isn't representable as a u64`);
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|