@signalapp/libsignal-client 0.39.2 → 0.40.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 +17 -2
- package/dist/MessageBackup.d.ts +53 -0
- package/dist/MessageBackup.js +63 -0
- package/dist/Minidump.d.ts +2 -0
- package/dist/Minidump.js +13 -0
- package/dist/Mp4Sanitizer.d.ts +4 -4
- package/dist/Mp4Sanitizer.js +4 -4
- package/dist/SealedSenderMultiRecipientMessage.d.ts +2 -2
- package/dist/SealedSenderMultiRecipientMessage.js +2 -2
- package/dist/acknowledgments.md +415 -20
- package/dist/io.d.ts +5 -4
- package/dist/net.d.ts +5 -1
- package/dist/usernames.js +1 -1
- package/dist/zkgroup/groups/UuidCiphertext.d.ts +1 -0
- package/dist/zkgroup/groups/UuidCiphertext.js +16 -0
- package/dist/zkgroup/groupsend/GroupSendCredential.d.ts +20 -0
- package/dist/zkgroup/groupsend/GroupSendCredential.js +20 -0
- package/dist/zkgroup/groupsend/GroupSendCredentialPresentation.d.ts +15 -0
- package/dist/zkgroup/groupsend/GroupSendCredentialPresentation.js +15 -0
- package/dist/zkgroup/groupsend/GroupSendCredentialResponse.d.ts +51 -0
- package/dist/zkgroup/groupsend/GroupSendCredentialResponse.js +55 -11
- package/package.json +2 -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
|
@@ -11,7 +11,10 @@ type Uuid = Buffer;
|
|
|
11
11
|
/// what's important is that it's an integer less than Number.MAX_SAFE_INTEGER.
|
|
12
12
|
type Timestamp = number;
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
interface LookupResponse {
|
|
15
|
+
entries: Map<string, LookupResponseEntry>;
|
|
16
|
+
debugPermitsUsed: number;
|
|
17
|
+
}
|
|
15
18
|
|
|
16
19
|
interface LookupResponseEntry {
|
|
17
20
|
readonly aci: string | undefined;
|
|
@@ -96,6 +99,11 @@ interface Wrapper<T> {
|
|
|
96
99
|
readonly _nativeHandle: T;
|
|
97
100
|
}
|
|
98
101
|
|
|
102
|
+
interface MessageBackupValidationOutcome {
|
|
103
|
+
errorMessage: string | null;
|
|
104
|
+
unknownFieldMessages: Array<string>;
|
|
105
|
+
}
|
|
106
|
+
|
|
99
107
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
100
108
|
type Serialized<T> = Buffer;
|
|
101
109
|
|
|
@@ -196,6 +204,7 @@ export function GroupSendCredentialResponse_CheckValidContents(responseBytes: Bu
|
|
|
196
204
|
export function GroupSendCredentialResponse_DefaultExpirationBasedOnCurrentTime(): Timestamp;
|
|
197
205
|
export function GroupSendCredentialResponse_IssueDeterministic(concatenatedGroupMemberCiphertexts: Buffer, requester: Serialized<UuidCiphertext>, expiration: Timestamp, serverParams: Serialized<ServerSecretParams>, randomness: Buffer): Buffer;
|
|
198
206
|
export function GroupSendCredentialResponse_Receive(responseBytes: Buffer, groupMembers: Buffer, localAci: Buffer, now: Timestamp, serverParams: Serialized<ServerPublicParams>, groupParams: Serialized<GroupSecretParams>): Buffer;
|
|
207
|
+
export function GroupSendCredentialResponse_ReceiveWithCiphertexts(responseBytes: Buffer, concatenatedGroupMemberCiphertexts: Buffer, requester: Serialized<UuidCiphertext>, now: Timestamp, serverParams: Serialized<ServerPublicParams>, groupParams: Serialized<GroupSecretParams>): Buffer;
|
|
199
208
|
export function GroupSendCredential_CheckValidContents(paramsBytes: Buffer): void;
|
|
200
209
|
export function GroupSendCredential_PresentDeterministic(credentialBytes: Buffer, serverParams: Serialized<ServerPublicParams>, randomness: Buffer): Buffer;
|
|
201
210
|
export function HKDF_DeriveSecrets(outputLength: number, ikm: Buffer, label: Buffer | null, salt: Buffer | null): Buffer;
|
|
@@ -235,6 +244,9 @@ export function LookupRequest_addPreviousE164(request: Wrapper<LookupRequest>, e
|
|
|
235
244
|
export function LookupRequest_new(): LookupRequest;
|
|
236
245
|
export function LookupRequest_setReturnAcisWithoutUaks(request: Wrapper<LookupRequest>, returnAcisWithoutUaks: boolean): void;
|
|
237
246
|
export function LookupRequest_setToken(request: Wrapper<LookupRequest>, token: Buffer): void;
|
|
247
|
+
export function MessageBackupKey_New(masterKey: Buffer, aci: Buffer): MessageBackupKey;
|
|
248
|
+
export function MessageBackupValidator_Validate(key: Wrapper<MessageBackupKey>, firstStream: InputStream, secondStream: InputStream, len: Buffer): Promise<MessageBackupValidationOutcome>;
|
|
249
|
+
export function MinidumpToJSONString(buffer: Buffer): string;
|
|
238
250
|
export function Mp4Sanitizer_Sanitize(input: InputStream, len: Buffer): Promise<SanitizedMetadata>;
|
|
239
251
|
export function PlaintextContent_Deserialize(data: Buffer): PlaintextContent;
|
|
240
252
|
export function PlaintextContent_FromDecryptionErrorMessage(m: Wrapper<DecryptionErrorMessage>): PlaintextContent;
|
|
@@ -416,6 +428,7 @@ export function SignedPreKeyRecord_GetSignature(obj: Wrapper<SignedPreKeyRecord>
|
|
|
416
428
|
export function SignedPreKeyRecord_GetTimestamp(obj: Wrapper<SignedPreKeyRecord>): Timestamp;
|
|
417
429
|
export function SignedPreKeyRecord_New(id: number, timestamp: Timestamp, pubKey: Wrapper<PublicKey>, privKey: Wrapper<PrivateKey>, signature: Buffer): SignedPreKeyRecord;
|
|
418
430
|
export function SignedPreKeyRecord_Serialize(obj: Wrapper<SignedPreKeyRecord>): Buffer;
|
|
431
|
+
export function TESTING_CdsiLookupErrorConvert(): void;
|
|
419
432
|
export function TESTING_CdsiLookupResponseConvert(): LookupResponse;
|
|
420
433
|
export function TESTING_ErrorOnBorrowAsync(_input: null): Promise<void>;
|
|
421
434
|
export function TESTING_ErrorOnBorrowIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _input: null): Promise<void>;
|
|
@@ -441,6 +454,7 @@ export function TESTING_PanicOnLoadSync(_needsCleanup: null, _input: null): void
|
|
|
441
454
|
export function TESTING_PanicOnReturnAsync(_needsCleanup: null): Promise<null>;
|
|
442
455
|
export function TESTING_PanicOnReturnIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _needsCleanup: null): Promise<null>;
|
|
443
456
|
export function TESTING_PanicOnReturnSync(_needsCleanup: null): null;
|
|
457
|
+
export function TESTING_ReturnStringArray(): string[];
|
|
444
458
|
export function TESTING_TestingHandleType_getValue(handle: Wrapper<TestingHandleType>): number;
|
|
445
459
|
export function TokioAsyncContext_new(): TokioAsyncContext;
|
|
446
460
|
export function UnidentifiedSenderMessageContent_Deserialize(data: Buffer): UnidentifiedSenderMessageContent;
|
|
@@ -453,7 +467,7 @@ export function UnidentifiedSenderMessageContent_New(message: Wrapper<Ciphertext
|
|
|
453
467
|
export function UnidentifiedSenderMessageContent_Serialize(obj: Wrapper<UnidentifiedSenderMessageContent>): Buffer;
|
|
454
468
|
export function UsernameLink_Create(username: string, entropy: Buffer | null): Buffer;
|
|
455
469
|
export function UsernameLink_DecryptUsername(entropy: Buffer, encryptedUsername: Buffer): string;
|
|
456
|
-
export function Username_CandidatesFrom(nickname: string, minLen: number, maxLen: number): string;
|
|
470
|
+
export function Username_CandidatesFrom(nickname: string, minLen: number, maxLen: number): string[];
|
|
457
471
|
export function Username_Hash(username: string): Buffer;
|
|
458
472
|
export function Username_HashFromParts(nickname: string, discriminator: string, minLen: number, maxLen: number): Buffer;
|
|
459
473
|
export function Username_Proof(username: string, randomness: Buffer): Buffer;
|
|
@@ -486,6 +500,7 @@ interface KyberPreKeyRecord { readonly __type: unique symbol; }
|
|
|
486
500
|
interface KyberPublicKey { readonly __type: unique symbol; }
|
|
487
501
|
interface KyberSecretKey { readonly __type: unique symbol; }
|
|
488
502
|
interface LookupRequest { readonly __type: unique symbol; }
|
|
503
|
+
interface MessageBackupKey { readonly __type: unique symbol; }
|
|
489
504
|
interface NonSuspendingBackgroundThreadRuntime { readonly __type: unique symbol; }
|
|
490
505
|
interface OtherTestingHandleType { readonly __type: unique symbol; }
|
|
491
506
|
interface PlaintextContent { readonly __type: unique symbol; }
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/**
|
|
3
|
+
* Message backup validation routines.
|
|
4
|
+
*
|
|
5
|
+
* @module MessageBackup
|
|
6
|
+
*/
|
|
7
|
+
import * as Native from '../Native';
|
|
8
|
+
import { Aci } from './Address';
|
|
9
|
+
import { InputStream } from './io';
|
|
10
|
+
export type InputStreamFactory = () => InputStream;
|
|
11
|
+
/**
|
|
12
|
+
* Result of validating a message backup bundle.
|
|
13
|
+
*/
|
|
14
|
+
export declare class ValidationOutcome {
|
|
15
|
+
/**
|
|
16
|
+
* A developer-facing message about the error encountered during validation,
|
|
17
|
+
* if any.
|
|
18
|
+
*/
|
|
19
|
+
errorMessage: string | null;
|
|
20
|
+
/**
|
|
21
|
+
* Information about unknown fields encountered during validation.
|
|
22
|
+
*/
|
|
23
|
+
unknownFieldMessages: string[];
|
|
24
|
+
/**
|
|
25
|
+
* `true` if the backup is valid, `false` otherwise.
|
|
26
|
+
*
|
|
27
|
+
* If this is `true`, there might still be messages about unknown fields.
|
|
28
|
+
*/
|
|
29
|
+
get ok(): boolean;
|
|
30
|
+
constructor(outcome: Native.MessageBackupValidationOutcome);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Key used to encrypt and decrypt a message backup bundle.
|
|
34
|
+
*/
|
|
35
|
+
export declare class MessageBackupKey {
|
|
36
|
+
readonly _nativeHandle: Native.MessageBackupKey;
|
|
37
|
+
/**
|
|
38
|
+
* Create a public key from the given master key and ACI.
|
|
39
|
+
*
|
|
40
|
+
* `masterKeyBytes` should contain exactly 32 bytes.
|
|
41
|
+
*/
|
|
42
|
+
constructor(masterKeyBytes: Buffer, aci: Aci);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Validate a backup file
|
|
46
|
+
*
|
|
47
|
+
* @param backupKey The key to use to decrypt the backup contents.
|
|
48
|
+
* @param inputFactory A function that returns new input streams that read the backup contents.
|
|
49
|
+
* @param length The exact length of the input stream.
|
|
50
|
+
* @returns The outcome of validation, including any errors and warnings.
|
|
51
|
+
* @throws IoError If an IO error on the input occurs.
|
|
52
|
+
*/
|
|
53
|
+
export declare function validate(backupKey: MessageBackupKey, inputFactory: InputStreamFactory, length: bigint): Promise<ValidationOutcome>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// Copyright 2024 Signal Messenger, LLC.
|
|
4
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
5
|
+
//
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.validate = exports.MessageBackupKey = exports.ValidationOutcome = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* Message backup validation routines.
|
|
10
|
+
*
|
|
11
|
+
* @module MessageBackup
|
|
12
|
+
*/
|
|
13
|
+
const Native = require("../Native");
|
|
14
|
+
const BigIntUtil_1 = require("./zkgroup/internal/BigIntUtil");
|
|
15
|
+
/**
|
|
16
|
+
* Result of validating a message backup bundle.
|
|
17
|
+
*/
|
|
18
|
+
class ValidationOutcome {
|
|
19
|
+
/**
|
|
20
|
+
* `true` if the backup is valid, `false` otherwise.
|
|
21
|
+
*
|
|
22
|
+
* If this is `true`, there might still be messages about unknown fields.
|
|
23
|
+
*/
|
|
24
|
+
get ok() {
|
|
25
|
+
return this.errorMessage == null;
|
|
26
|
+
}
|
|
27
|
+
constructor(outcome) {
|
|
28
|
+
const { errorMessage, unknownFieldMessages } = outcome;
|
|
29
|
+
this.errorMessage = errorMessage;
|
|
30
|
+
this.unknownFieldMessages = unknownFieldMessages;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.ValidationOutcome = ValidationOutcome;
|
|
34
|
+
/**
|
|
35
|
+
* Key used to encrypt and decrypt a message backup bundle.
|
|
36
|
+
*/
|
|
37
|
+
class MessageBackupKey {
|
|
38
|
+
/**
|
|
39
|
+
* Create a public key from the given master key and ACI.
|
|
40
|
+
*
|
|
41
|
+
* `masterKeyBytes` should contain exactly 32 bytes.
|
|
42
|
+
*/
|
|
43
|
+
constructor(masterKeyBytes, aci) {
|
|
44
|
+
this._nativeHandle = Native.MessageBackupKey_New(masterKeyBytes, aci.getServiceIdFixedWidthBinary());
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.MessageBackupKey = MessageBackupKey;
|
|
48
|
+
/**
|
|
49
|
+
* Validate a backup file
|
|
50
|
+
*
|
|
51
|
+
* @param backupKey The key to use to decrypt the backup contents.
|
|
52
|
+
* @param inputFactory A function that returns new input streams that read the backup contents.
|
|
53
|
+
* @param length The exact length of the input stream.
|
|
54
|
+
* @returns The outcome of validation, including any errors and warnings.
|
|
55
|
+
* @throws IoError If an IO error on the input occurs.
|
|
56
|
+
*/
|
|
57
|
+
async function validate(backupKey, inputFactory, length) {
|
|
58
|
+
const firstStream = inputFactory();
|
|
59
|
+
const secondStream = inputFactory();
|
|
60
|
+
return new ValidationOutcome(await Native.MessageBackupValidator_Validate(backupKey, firstStream, secondStream, (0, BigIntUtil_1.bufferFromBigUInt64BE)(length)));
|
|
61
|
+
}
|
|
62
|
+
exports.validate = validate;
|
|
63
|
+
//# sourceMappingURL=MessageBackup.js.map
|
package/dist/Minidump.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// Copyright 2024 Signal Messenger, LLC.
|
|
4
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
5
|
+
//
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.toJSONString = void 0;
|
|
8
|
+
const Native = require("../Native");
|
|
9
|
+
function toJSONString(buffer) {
|
|
10
|
+
return Native.MinidumpToJSONString(buffer);
|
|
11
|
+
}
|
|
12
|
+
exports.toJSONString = toJSONString;
|
|
13
|
+
//# sourceMappingURL=Minidump.js.map
|
package/dist/Mp4Sanitizer.d.ts
CHANGED
|
@@ -34,17 +34,17 @@ export declare class SanitizedMetadata {
|
|
|
34
34
|
static _fromNativeHandle(handle: Native.SanitizedMetadata): SanitizedMetadata;
|
|
35
35
|
/**
|
|
36
36
|
* Get the sanitized metadata, if any.
|
|
37
|
-
* @
|
|
37
|
+
* @returns The sanitized metadata, or {@code null} if it didn't need to be sanitized.
|
|
38
38
|
*/
|
|
39
39
|
getMetadata(): Buffer | null;
|
|
40
40
|
/**
|
|
41
41
|
* Get the offset of the media data in the processed input.
|
|
42
|
-
* @
|
|
42
|
+
* @returns The offset of the media data in the processed input.
|
|
43
43
|
*/
|
|
44
44
|
getDataOffset(): bigint;
|
|
45
45
|
/**
|
|
46
46
|
* Get the length of the media data in the processed input.
|
|
47
|
-
* @
|
|
47
|
+
* @returns The length of the media data in the processed input.
|
|
48
48
|
*/
|
|
49
49
|
getDataLen(): bigint;
|
|
50
50
|
}
|
|
@@ -53,7 +53,7 @@ export declare class SanitizedMetadata {
|
|
|
53
53
|
*
|
|
54
54
|
* @param input An MP4 format input stream.
|
|
55
55
|
* @param length The exact length of the input stream.
|
|
56
|
-
* @
|
|
56
|
+
* @returns The sanitized metadata.
|
|
57
57
|
* @throws IoError If an IO error on the input occurs.
|
|
58
58
|
* @throws InvalidMediaInputError If the input could not be parsed because it was invalid.
|
|
59
59
|
* @throws UnsupportedMediaInputError If the input could not be parsed because it's unsupported in some way.
|
package/dist/Mp4Sanitizer.js
CHANGED
|
@@ -43,7 +43,7 @@ class SanitizedMetadata {
|
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
45
|
* Get the sanitized metadata, if any.
|
|
46
|
-
* @
|
|
46
|
+
* @returns The sanitized metadata, or {@code null} if it didn't need to be sanitized.
|
|
47
47
|
*/
|
|
48
48
|
getMetadata() {
|
|
49
49
|
const metadata = Native.SanitizedMetadata_GetMetadata(this);
|
|
@@ -54,7 +54,7 @@ class SanitizedMetadata {
|
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
56
|
* Get the offset of the media data in the processed input.
|
|
57
|
-
* @
|
|
57
|
+
* @returns The offset of the media data in the processed input.
|
|
58
58
|
*/
|
|
59
59
|
getDataOffset() {
|
|
60
60
|
const buffer = Native.SanitizedMetadata_GetDataOffset(this);
|
|
@@ -62,7 +62,7 @@ class SanitizedMetadata {
|
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
64
|
* Get the length of the media data in the processed input.
|
|
65
|
-
* @
|
|
65
|
+
* @returns The length of the media data in the processed input.
|
|
66
66
|
*/
|
|
67
67
|
getDataLen() {
|
|
68
68
|
const buffer = Native.SanitizedMetadata_GetDataLen(this);
|
|
@@ -75,7 +75,7 @@ exports.SanitizedMetadata = SanitizedMetadata;
|
|
|
75
75
|
*
|
|
76
76
|
* @param input An MP4 format input stream.
|
|
77
77
|
* @param length The exact length of the input stream.
|
|
78
|
-
* @
|
|
78
|
+
* @returns The sanitized metadata.
|
|
79
79
|
* @throws IoError If an IO error on the input occurs.
|
|
80
80
|
* @throws InvalidMediaInputError If the input could not be parsed because it was invalid.
|
|
81
81
|
* @throws UnsupportedMediaInputError If the input could not be parsed because it's unsupported in some way.
|
|
@@ -35,7 +35,7 @@ export default class SealedSenderMultiRecipientMessage {
|
|
|
35
35
|
/**
|
|
36
36
|
* Returns the service IDs of recipients excluded from receiving the message.
|
|
37
37
|
*
|
|
38
|
-
* This is enforced to be disjoint from the recipients in {@link recipientsByServiceIdString}; it
|
|
38
|
+
* This is enforced to be disjoint from the recipients in {@link #recipientsByServiceIdString}; it
|
|
39
39
|
* may be used for authorization purposes or just to check that certain recipients were
|
|
40
40
|
* deliberately excluded rather than accidentally.
|
|
41
41
|
*/
|
|
@@ -44,7 +44,7 @@ export default class SealedSenderMultiRecipientMessage {
|
|
|
44
44
|
* Returns the Sealed Sender V2 "ReceivedMessage" payload for delivery to a particular recipient.
|
|
45
45
|
*
|
|
46
46
|
* `recipient` must be one of the recipients in the map returned by
|
|
47
|
-
* {@link recipientsByServiceIdString}. The same payload should be sent to all of the recipient's
|
|
47
|
+
* {@link #recipientsByServiceIdString}. The same payload should be sent to all of the recipient's
|
|
48
48
|
* devices.
|
|
49
49
|
*/
|
|
50
50
|
messageForRecipient(recipient: Recipient): Buffer;
|
|
@@ -30,7 +30,7 @@ class SealedSenderMultiRecipientMessage {
|
|
|
30
30
|
/**
|
|
31
31
|
* Returns the service IDs of recipients excluded from receiving the message.
|
|
32
32
|
*
|
|
33
|
-
* This is enforced to be disjoint from the recipients in {@link recipientsByServiceIdString}; it
|
|
33
|
+
* This is enforced to be disjoint from the recipients in {@link #recipientsByServiceIdString}; it
|
|
34
34
|
* may be used for authorization purposes or just to check that certain recipients were
|
|
35
35
|
* deliberately excluded rather than accidentally.
|
|
36
36
|
*/
|
|
@@ -41,7 +41,7 @@ class SealedSenderMultiRecipientMessage {
|
|
|
41
41
|
* Returns the Sealed Sender V2 "ReceivedMessage" payload for delivery to a particular recipient.
|
|
42
42
|
*
|
|
43
43
|
* `recipient` must be one of the recipients in the map returned by
|
|
44
|
-
* {@link recipientsByServiceIdString}. The same payload should be sent to all of the recipient's
|
|
44
|
+
* {@link #recipientsByServiceIdString}. The same payload should be sent to all of the recipient's
|
|
45
45
|
* devices.
|
|
46
46
|
*/
|
|
47
47
|
messageForRecipient(recipient) {
|