@signalapp/libsignal-client 0.30.2 → 0.32.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 +5 -5
- package/dist/incremental_mac.d.ts +2 -0
- package/dist/incremental_mac.js +10 -2
- package/dist/index.d.ts +8 -3
- package/dist/index.js +11 -6
- 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
|
@@ -313,16 +313,16 @@ export function ServiceId_ParseFromServiceIdString(input: string): Buffer;
|
|
|
313
313
|
export function ServiceId_ServiceIdBinary(value: Buffer): Buffer;
|
|
314
314
|
export function ServiceId_ServiceIdLog(value: Buffer): string;
|
|
315
315
|
export function ServiceId_ServiceIdString(value: Buffer): string;
|
|
316
|
-
export function SessionBuilder_ProcessPreKeyBundle(bundle: Wrapper<PreKeyBundle>, protocolAddress: Wrapper<ProtocolAddress>, sessionStore: SessionStore, identityKeyStore: IdentityKeyStore): Promise<void>;
|
|
316
|
+
export function SessionBuilder_ProcessPreKeyBundle(bundle: Wrapper<PreKeyBundle>, protocolAddress: Wrapper<ProtocolAddress>, sessionStore: SessionStore, identityKeyStore: IdentityKeyStore, now: Timestamp): Promise<void>;
|
|
317
317
|
export function SessionCipher_DecryptPreKeySignalMessage(message: Wrapper<PreKeySignalMessage>, protocolAddress: Wrapper<ProtocolAddress>, sessionStore: SessionStore, identityKeyStore: IdentityKeyStore, prekeyStore: PreKeyStore, signedPrekeyStore: SignedPreKeyStore, kyberPrekeyStore: KyberPreKeyStore): Promise<Buffer>;
|
|
318
318
|
export function SessionCipher_DecryptSignalMessage(message: Wrapper<SignalMessage>, protocolAddress: Wrapper<ProtocolAddress>, sessionStore: SessionStore, identityKeyStore: IdentityKeyStore): Promise<Buffer>;
|
|
319
|
-
export function SessionCipher_EncryptMessage(ptext: Buffer, protocolAddress: Wrapper<ProtocolAddress>, sessionStore: SessionStore, identityKeyStore: IdentityKeyStore): Promise<CiphertextMessage>;
|
|
319
|
+
export function SessionCipher_EncryptMessage(ptext: Buffer, protocolAddress: Wrapper<ProtocolAddress>, sessionStore: SessionStore, identityKeyStore: IdentityKeyStore, now: Timestamp): Promise<CiphertextMessage>;
|
|
320
320
|
export function SessionRecord_ArchiveCurrentState(sessionRecord: Wrapper<SessionRecord>): void;
|
|
321
321
|
export function SessionRecord_CurrentRatchetKeyMatches(s: Wrapper<SessionRecord>, key: Wrapper<PublicKey>): boolean;
|
|
322
322
|
export function SessionRecord_Deserialize(data: Buffer): SessionRecord;
|
|
323
323
|
export function SessionRecord_GetLocalRegistrationId(obj: Wrapper<SessionRecord>): number;
|
|
324
324
|
export function SessionRecord_GetRemoteRegistrationId(obj: Wrapper<SessionRecord>): number;
|
|
325
|
-
export function
|
|
325
|
+
export function SessionRecord_HasUsableSenderChain(s: Wrapper<SessionRecord>, now: Timestamp): boolean;
|
|
326
326
|
export function SessionRecord_Serialize(obj: Wrapper<SessionRecord>): Buffer;
|
|
327
327
|
export function SgxClientState_CompleteHandshake(cli: Wrapper<SgxClientState>, handshakeReceived: Buffer): void;
|
|
328
328
|
export function SgxClientState_EstablishedRecv(cli: Wrapper<SgxClientState>, receivedCiphertext: Buffer): Buffer;
|
|
@@ -359,9 +359,9 @@ export function Username_Hash(username: string): Buffer;
|
|
|
359
359
|
export function Username_Proof(username: string, randomness: Buffer): Buffer;
|
|
360
360
|
export function Username_Verify(proof: Buffer, hash: Buffer): void;
|
|
361
361
|
export function UuidCiphertext_CheckValidContents(buffer: Buffer): void;
|
|
362
|
-
export function ValidatingMac_Finalize(mac: Wrapper<ValidatingMac>):
|
|
362
|
+
export function ValidatingMac_Finalize(mac: Wrapper<ValidatingMac>): number;
|
|
363
363
|
export function ValidatingMac_Initialize(key: Buffer, chunkSize: number, digests: Buffer): ValidatingMac;
|
|
364
|
-
export function ValidatingMac_Update(mac: Wrapper<ValidatingMac>, bytes: Buffer, offset: number, length: number):
|
|
364
|
+
export function ValidatingMac_Update(mac: Wrapper<ValidatingMac>, bytes: Buffer, offset: number, length: number): number;
|
|
365
365
|
export function initLogger(maxLevel: LogLevel, callback: (level: LogLevel, target: string, file: string | null, line: number | null, message: string) => void): void
|
|
366
366
|
interface Aes256GcmSiv { readonly __type: unique symbol; }
|
|
367
367
|
interface AuthCredential { readonly __type: unique symbol; }
|
|
@@ -21,7 +21,9 @@ export declare class DigestingWritable extends stream.Writable {
|
|
|
21
21
|
}
|
|
22
22
|
export declare class ValidatingWritable extends stream.Writable {
|
|
23
23
|
_nativeHandle: Native.ValidatingMac;
|
|
24
|
+
_validatedBytes: number;
|
|
24
25
|
constructor(key: Buffer, sizeChoice: ChunkSizeChoice, digest: Buffer);
|
|
26
|
+
validatedSize(): number;
|
|
25
27
|
_write(chunk: any, _encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
|
|
26
28
|
_final(callback: (error?: Error | null) => void): void;
|
|
27
29
|
}
|
package/dist/incremental_mac.js
CHANGED
|
@@ -45,14 +45,20 @@ exports.DigestingWritable = DigestingWritable;
|
|
|
45
45
|
class ValidatingWritable extends stream.Writable {
|
|
46
46
|
constructor(key, sizeChoice, digest) {
|
|
47
47
|
super();
|
|
48
|
+
this._validatedBytes = 0;
|
|
48
49
|
this._nativeHandle = Native.ValidatingMac_Initialize(key, chunkSizeInBytes(sizeChoice), digest);
|
|
49
50
|
}
|
|
51
|
+
validatedSize() {
|
|
52
|
+
return this._validatedBytes;
|
|
53
|
+
}
|
|
50
54
|
_write(
|
|
51
55
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
52
56
|
chunk, _encoding, callback) {
|
|
53
57
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
54
58
|
const buffer = Buffer.from(chunk, 'binary');
|
|
55
|
-
|
|
59
|
+
const validBytes = Native.ValidatingMac_Update(this, buffer, 0, buffer.length);
|
|
60
|
+
if (validBytes >= 0) {
|
|
61
|
+
this._validatedBytes += validBytes;
|
|
56
62
|
callback();
|
|
57
63
|
}
|
|
58
64
|
else {
|
|
@@ -60,7 +66,9 @@ class ValidatingWritable extends stream.Writable {
|
|
|
60
66
|
}
|
|
61
67
|
}
|
|
62
68
|
_final(callback) {
|
|
63
|
-
|
|
69
|
+
const validBytes = Native.ValidatingMac_Finalize(this);
|
|
70
|
+
if (validBytes >= 0) {
|
|
71
|
+
this._validatedBytes += validBytes;
|
|
64
72
|
callback();
|
|
65
73
|
}
|
|
66
74
|
else {
|
package/dist/index.d.ts
CHANGED
|
@@ -195,7 +195,12 @@ export declare class SessionRecord {
|
|
|
195
195
|
archiveCurrentState(): void;
|
|
196
196
|
localRegistrationId(): number;
|
|
197
197
|
remoteRegistrationId(): number;
|
|
198
|
-
|
|
198
|
+
/**
|
|
199
|
+
* Returns whether the current session can be used to send messages.
|
|
200
|
+
*
|
|
201
|
+
* If there is no current session, returns false.
|
|
202
|
+
*/
|
|
203
|
+
hasCurrentState(now?: Date): boolean;
|
|
199
204
|
currentRatchetKeyMatches(key: PublicKey): boolean;
|
|
200
205
|
}
|
|
201
206
|
export declare class ServerCertificate {
|
|
@@ -374,8 +379,8 @@ export declare class DecryptionErrorMessage {
|
|
|
374
379
|
deviceId(): number;
|
|
375
380
|
ratchetKey(): PublicKey | undefined;
|
|
376
381
|
}
|
|
377
|
-
export declare function processPreKeyBundle(bundle: PreKeyBundle, address: ProtocolAddress, sessionStore: SessionStore, identityStore: IdentityKeyStore): Promise<void>;
|
|
378
|
-
export declare function signalEncrypt(message: Buffer, address: ProtocolAddress, sessionStore: SessionStore, identityStore: IdentityKeyStore): Promise<CiphertextMessage>;
|
|
382
|
+
export declare function processPreKeyBundle(bundle: PreKeyBundle, address: ProtocolAddress, sessionStore: SessionStore, identityStore: IdentityKeyStore, now?: Date): Promise<void>;
|
|
383
|
+
export declare function signalEncrypt(message: Buffer, address: ProtocolAddress, sessionStore: SessionStore, identityStore: IdentityKeyStore, now?: Date): Promise<CiphertextMessage>;
|
|
379
384
|
export declare function signalDecrypt(message: SignalMessage, address: ProtocolAddress, sessionStore: SessionStore, identityStore: IdentityKeyStore): Promise<Buffer>;
|
|
380
385
|
export declare function signalDecryptPreKey(message: PreKeySignalMessage, address: ProtocolAddress, sessionStore: SessionStore, identityStore: IdentityKeyStore, prekeyStore: PreKeyStore, signedPrekeyStore: SignedPreKeyStore, kyberPrekeyStore: KyberPreKeyStore): Promise<Buffer>;
|
|
381
386
|
export declare function sealedSenderEncryptMessage(message: Buffer, address: ProtocolAddress, senderCert: SenderCertificate, sessionStore: SessionStore, identityStore: IdentityKeyStore): Promise<Buffer>;
|
package/dist/index.js
CHANGED
|
@@ -483,8 +483,13 @@ class SessionRecord {
|
|
|
483
483
|
remoteRegistrationId() {
|
|
484
484
|
return Native.SessionRecord_GetRemoteRegistrationId(this);
|
|
485
485
|
}
|
|
486
|
-
|
|
487
|
-
|
|
486
|
+
/**
|
|
487
|
+
* Returns whether the current session can be used to send messages.
|
|
488
|
+
*
|
|
489
|
+
* If there is no current session, returns false.
|
|
490
|
+
*/
|
|
491
|
+
hasCurrentState(now = new Date()) {
|
|
492
|
+
return Native.SessionRecord_HasUsableSenderChain(this, now.getTime());
|
|
488
493
|
}
|
|
489
494
|
currentRatchetKeyMatches(key) {
|
|
490
495
|
return Native.SessionRecord_CurrentRatchetKeyMatches(this, key);
|
|
@@ -946,13 +951,13 @@ class DecryptionErrorMessage {
|
|
|
946
951
|
}
|
|
947
952
|
}
|
|
948
953
|
exports.DecryptionErrorMessage = DecryptionErrorMessage;
|
|
949
|
-
function processPreKeyBundle(bundle, address, sessionStore, identityStore) {
|
|
950
|
-
return Native.SessionBuilder_ProcessPreKeyBundle(bundle, address, sessionStore, identityStore);
|
|
954
|
+
function processPreKeyBundle(bundle, address, sessionStore, identityStore, now = new Date()) {
|
|
955
|
+
return Native.SessionBuilder_ProcessPreKeyBundle(bundle, address, sessionStore, identityStore, now.getTime());
|
|
951
956
|
}
|
|
952
957
|
exports.processPreKeyBundle = processPreKeyBundle;
|
|
953
|
-
function signalEncrypt(message, address, sessionStore, identityStore) {
|
|
958
|
+
function signalEncrypt(message, address, sessionStore, identityStore, now = new Date()) {
|
|
954
959
|
return __awaiter(this, void 0, void 0, function* () {
|
|
955
|
-
return CiphertextMessage._fromNativeHandle(yield Native.SessionCipher_EncryptMessage(message, address, sessionStore, identityStore));
|
|
960
|
+
return CiphertextMessage._fromNativeHandle(yield Native.SessionCipher_EncryptMessage(message, address, sessionStore, identityStore, now.getTime()));
|
|
956
961
|
});
|
|
957
962
|
}
|
|
958
963
|
exports.signalEncrypt = signalEncrypt;
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|