@signalapp/libsignal-client 0.69.1 → 0.70.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 +49 -8
- package/dist/MessageBackup.d.ts +0 -8
- package/dist/MessageBackup.js +15 -10
- package/dist/incremental_mac.d.ts +0 -23
- package/dist/incremental_mac.js +1 -9
- package/dist/index.d.ts +14 -9
- package/dist/index.js +2 -17
- package/dist/net/CDSI.d.ts +0 -4
- package/dist/net/Registration.d.ts +52 -2
- package/dist/net/Registration.js +75 -5
- package/dist/net.d.ts +2 -1
- package/dist/net.js +2 -2
- package/package.json +1 -1
- 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/pin.d.ts +0 -3
- package/dist/pin.js +0 -11
package/Native.d.ts
CHANGED
|
@@ -130,7 +130,29 @@ type ChatListener = {
|
|
|
130
130
|
): void;
|
|
131
131
|
};
|
|
132
132
|
|
|
133
|
-
type
|
|
133
|
+
type RegistrationSessionRequestedInformation = 'pushChallenge' | 'captcha';
|
|
134
|
+
|
|
135
|
+
type RegistrationPushTokenType = 'apn' | 'fcm';
|
|
136
|
+
|
|
137
|
+
type RegistrationCreateSessionRequest = {
|
|
138
|
+
number: string;
|
|
139
|
+
push_token?: string;
|
|
140
|
+
push_token_type?: RegistrationPushTokenType;
|
|
141
|
+
mcc?: string;
|
|
142
|
+
mnc?: string;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
type RegisterResponseBadge = {
|
|
146
|
+
id: string;
|
|
147
|
+
visible: boolean;
|
|
148
|
+
expirationSeconds: number;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
type SignedPublicPreKey = {
|
|
152
|
+
keyId: number;
|
|
153
|
+
publicKey: Buffer;
|
|
154
|
+
signature: Buffer;
|
|
155
|
+
};
|
|
134
156
|
|
|
135
157
|
type Wrapper<T> = Readonly<{
|
|
136
158
|
_nativeHandle: T;
|
|
@@ -336,7 +358,6 @@ export function LookupRequest_new(): LookupRequest;
|
|
|
336
358
|
export function LookupRequest_setToken(request: Wrapper<LookupRequest>, token: Buffer): void;
|
|
337
359
|
export function MessageBackupKey_FromAccountEntropyPool(accountEntropy: AccountEntropyPool, aci: Buffer): MessageBackupKey;
|
|
338
360
|
export function MessageBackupKey_FromBackupKeyAndBackupId(backupKey: Buffer, backupId: Buffer): MessageBackupKey;
|
|
339
|
-
export function MessageBackupKey_FromMasterKey(masterKey: Buffer, aci: Buffer): MessageBackupKey;
|
|
340
361
|
export function MessageBackupKey_GetAesKey(key: Wrapper<MessageBackupKey>): Buffer;
|
|
341
362
|
export function MessageBackupKey_GetHmacKey(key: Wrapper<MessageBackupKey>): Buffer;
|
|
342
363
|
export function MessageBackupValidator_Validate(key: Wrapper<MessageBackupKey>, firstStream: InputStream, secondStream: InputStream, len: bigint, purpose: number): Promise<MessageBackupValidationOutcome>;
|
|
@@ -412,11 +433,28 @@ export function ReceiptCredentialResponse_CheckValidContents(buffer: Buffer): vo
|
|
|
412
433
|
export function ReceiptCredential_CheckValidContents(buffer: Buffer): void;
|
|
413
434
|
export function ReceiptCredential_GetReceiptExpirationTime(receiptCredential: Serialized<ReceiptCredential>): Timestamp;
|
|
414
435
|
export function ReceiptCredential_GetReceiptLevel(receiptCredential: Serialized<ReceiptCredential>): bigint;
|
|
415
|
-
export function
|
|
436
|
+
export function RegisterAccountRequest_Create(): RegisterAccountRequest;
|
|
437
|
+
export function RegisterAccountRequest_SetAccountPassword(registerAccount: Wrapper<RegisterAccountRequest>, accountPassword: Buffer): void;
|
|
438
|
+
export function RegisterAccountRequest_SetIdentityPqLastResortPreKey(registerAccount: Wrapper<RegisterAccountRequest>, identityType: number, pqLastResortPreKey: SignedPublicPreKey): void;
|
|
439
|
+
export function RegisterAccountRequest_SetIdentityPublicKey(registerAccount: Wrapper<RegisterAccountRequest>, identityType: number, identityKey: Wrapper<PublicKey>): void;
|
|
440
|
+
export function RegisterAccountRequest_SetIdentitySignedPreKey(registerAccount: Wrapper<RegisterAccountRequest>, identityType: number, signedPreKey: SignedPublicPreKey): void;
|
|
441
|
+
export function RegisterAccountRequest_SetSkipDeviceTransfer(registerAccount: Wrapper<RegisterAccountRequest>): void;
|
|
442
|
+
export function RegisterAccountResponse_GetEntitlementBackupExpirationSeconds(response: Wrapper<RegisterAccountResponse>): bigint | null;
|
|
443
|
+
export function RegisterAccountResponse_GetEntitlementBackupLevel(response: Wrapper<RegisterAccountResponse>): bigint | null;
|
|
444
|
+
export function RegisterAccountResponse_GetEntitlementBadges(response: Wrapper<RegisterAccountResponse>): RegisterResponseBadge[];
|
|
445
|
+
export function RegisterAccountResponse_GetIdentity(response: Wrapper<RegisterAccountResponse>, identityType: number): Buffer;
|
|
446
|
+
export function RegisterAccountResponse_GetNumber(response: Wrapper<RegisterAccountResponse>): string;
|
|
447
|
+
export function RegisterAccountResponse_GetReregistration(response: Wrapper<RegisterAccountResponse>): boolean;
|
|
448
|
+
export function RegisterAccountResponse_GetStorageCapable(response: Wrapper<RegisterAccountResponse>): boolean;
|
|
449
|
+
export function RegisterAccountResponse_GetUsernameHash(response: Wrapper<RegisterAccountResponse>): Buffer | null;
|
|
450
|
+
export function RegisterAccountResponse_GetUsernameLinkHandle(response: Wrapper<RegisterAccountResponse>): Uuid | null;
|
|
451
|
+
export function RegistrationAccountAttributes_Create(recoveryPassword: Buffer, aciRegistrationId: number, pniRegistrationId: number, registrationLock: string | null, unidentifiedAccessKey: Buffer | null, unrestrictedUnidentifiedAccess: boolean, capabilities: string[], discoverableByPhoneNumber: boolean): RegistrationAccountAttributes;
|
|
452
|
+
export function RegistrationService_CreateSession(asyncRuntime: Wrapper<TokioAsyncContext>, createSession: RegistrationCreateSessionRequest, connectChat: ConnectChatBridge): CancellablePromise<RegistrationService>;
|
|
453
|
+
export function RegistrationService_RegisterAccount(asyncRuntime: Wrapper<TokioAsyncContext>, service: Wrapper<RegistrationService>, registerAccount: Wrapper<RegisterAccountRequest>, accountAttributes: Wrapper<RegistrationAccountAttributes>): CancellablePromise<RegisterAccountResponse>;
|
|
416
454
|
export function RegistrationService_RegistrationSession(service: Wrapper<RegistrationService>): RegistrationSession;
|
|
417
|
-
export function RegistrationService_RequestPushChallenge(asyncRuntime: Wrapper<TokioAsyncContext>, service: Wrapper<RegistrationService>, pushToken: string, pushTokenType:
|
|
418
|
-
export function RegistrationService_RequestVerificationCode(asyncRuntime: Wrapper<TokioAsyncContext>, service: Wrapper<RegistrationService>, transport: string, client: string): CancellablePromise<void>;
|
|
419
|
-
export function RegistrationService_ResumeSession(asyncRuntime: Wrapper<TokioAsyncContext>, sessionId: string, connectChat: ConnectChatBridge): CancellablePromise<RegistrationService>;
|
|
455
|
+
export function RegistrationService_RequestPushChallenge(asyncRuntime: Wrapper<TokioAsyncContext>, service: Wrapper<RegistrationService>, pushToken: string, pushTokenType: RegistrationPushTokenType): CancellablePromise<void>;
|
|
456
|
+
export function RegistrationService_RequestVerificationCode(asyncRuntime: Wrapper<TokioAsyncContext>, service: Wrapper<RegistrationService>, transport: string, client: string, languages: string[]): CancellablePromise<void>;
|
|
457
|
+
export function RegistrationService_ResumeSession(asyncRuntime: Wrapper<TokioAsyncContext>, sessionId: string, number: string, connectChat: ConnectChatBridge): CancellablePromise<RegistrationService>;
|
|
420
458
|
export function RegistrationService_SessionId(service: Wrapper<RegistrationService>): string;
|
|
421
459
|
export function RegistrationService_SubmitCaptcha(asyncRuntime: Wrapper<TokioAsyncContext>, service: Wrapper<RegistrationService>, captchaValue: string): CancellablePromise<void>;
|
|
422
460
|
export function RegistrationService_SubmitPushChallenge(asyncRuntime: Wrapper<TokioAsyncContext>, service: Wrapper<RegistrationService>, pushChallenge: string): CancellablePromise<void>;
|
|
@@ -425,7 +463,7 @@ export function RegistrationSession_GetAllowedToRequestCode(session: Wrapper<Reg
|
|
|
425
463
|
export function RegistrationSession_GetNextCallSeconds(session: Wrapper<RegistrationSession>): number | null;
|
|
426
464
|
export function RegistrationSession_GetNextSmsSeconds(session: Wrapper<RegistrationSession>): number | null;
|
|
427
465
|
export function RegistrationSession_GetNextVerificationAttemptSeconds(session: Wrapper<RegistrationSession>): number | null;
|
|
428
|
-
export function RegistrationSession_GetRequestedInformation(session: Wrapper<RegistrationSession>):
|
|
466
|
+
export function RegistrationSession_GetRequestedInformation(session: Wrapper<RegistrationSession>): RegistrationSessionRequestedInformation[];
|
|
429
467
|
export function RegistrationSession_GetVerified(session: Wrapper<RegistrationSession>): boolean;
|
|
430
468
|
export function SanitizedMetadata_GetDataLen(sanitized: Wrapper<SanitizedMetadata>): bigint;
|
|
431
469
|
export function SanitizedMetadata_GetDataOffset(sanitized: Wrapper<SanitizedMetadata>): bigint;
|
|
@@ -572,7 +610,7 @@ export function TESTING_FakeChatSentRequest_RequestId(request: Wrapper<FakeChatS
|
|
|
572
610
|
export function TESTING_FakeChatSentRequest_TakeHttpRequest(request: Wrapper<FakeChatSentRequest>): HttpRequest;
|
|
573
611
|
export function TESTING_FakeChatServer_Create(): FakeChatServer;
|
|
574
612
|
export function TESTING_FakeChatServer_GetNextRemote(asyncRuntime: Wrapper<TokioAsyncContext>, server: Wrapper<FakeChatServer>): CancellablePromise<FakeChatRemoteEnd>;
|
|
575
|
-
export function TESTING_FakeRegistrationSession_CreateSession(asyncRuntime: Wrapper<TokioAsyncContext>, createSession:
|
|
613
|
+
export function TESTING_FakeRegistrationSession_CreateSession(asyncRuntime: Wrapper<TokioAsyncContext>, createSession: RegistrationCreateSessionRequest, chat: Wrapper<FakeChatServer>): CancellablePromise<RegistrationService>;
|
|
576
614
|
export function TESTING_FutureFailure(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _input: number): CancellablePromise<number>;
|
|
577
615
|
export function TESTING_FutureProducesOtherPointerType(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, input: string): CancellablePromise<OtherTestingHandleType>;
|
|
578
616
|
export function TESTING_FutureProducesPointerType(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, input: number): CancellablePromise<TestingHandleType>;
|
|
@@ -689,6 +727,9 @@ interface ReceiptCredentialPresentation { readonly __type: unique symbol; }
|
|
|
689
727
|
interface ReceiptCredentialRequest { readonly __type: unique symbol; }
|
|
690
728
|
interface ReceiptCredentialRequestContext { readonly __type: unique symbol; }
|
|
691
729
|
interface ReceiptCredentialResponse { readonly __type: unique symbol; }
|
|
730
|
+
interface RegisterAccountRequest { readonly __type: unique symbol; }
|
|
731
|
+
interface RegisterAccountResponse { readonly __type: unique symbol; }
|
|
732
|
+
interface RegistrationAccountAttributes { readonly __type: unique symbol; }
|
|
692
733
|
interface RegistrationService { readonly __type: unique symbol; }
|
|
693
734
|
interface RegistrationSession { readonly __type: unique symbol; }
|
|
694
735
|
interface SanitizedMetadata { readonly __type: unique symbol; }
|
package/dist/MessageBackup.d.ts
CHANGED
|
@@ -44,14 +44,6 @@ export type MessageBackupKeyInput = Readonly<{
|
|
|
44
44
|
*/
|
|
45
45
|
export declare class MessageBackupKey {
|
|
46
46
|
readonly _nativeHandle: Native.MessageBackupKey;
|
|
47
|
-
/**
|
|
48
|
-
* Create a backup bundle key from the given master key and ACI.
|
|
49
|
-
*
|
|
50
|
-
* `masterKeyBytes` should contain exactly 32 bytes.
|
|
51
|
-
*
|
|
52
|
-
* @deprecated Use AccountEntropyPool instead.
|
|
53
|
-
*/
|
|
54
|
-
constructor(masterKeyBytes: Buffer, aci: Aci);
|
|
55
47
|
/**
|
|
56
48
|
* Create a backup bundle key from an account entropy pool and ACI.
|
|
57
49
|
*
|
package/dist/MessageBackup.js
CHANGED
|
@@ -37,19 +37,24 @@ exports.ValidationOutcome = ValidationOutcome;
|
|
|
37
37
|
* @see {@link BackupKey}
|
|
38
38
|
*/
|
|
39
39
|
class MessageBackupKey {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Create a backup bundle key from an account entropy pool and ACI.
|
|
42
|
+
*
|
|
43
|
+
* ...or from a backup key and ID, used when reading from a local backup, which may have been
|
|
44
|
+
* created with a different ACI. This still uses AccountEntropyPool-based key derivation rules; it
|
|
45
|
+
* cannot be used to read a backup created from a master key.
|
|
46
|
+
*
|
|
47
|
+
* The account entropy pool must be **validated**; passing an arbitrary string here is considered
|
|
48
|
+
* a programmer error. Similarly, passing a backup key or ID of the wrong length is also an error.
|
|
49
|
+
*/
|
|
50
|
+
constructor(input) {
|
|
51
|
+
if ('accountEntropy' in input) {
|
|
52
|
+
const { accountEntropy, aci } = input;
|
|
48
53
|
this._nativeHandle = Native.MessageBackupKey_FromAccountEntropyPool(accountEntropy, aci.getServiceIdFixedWidthBinary());
|
|
49
54
|
}
|
|
50
55
|
else {
|
|
51
|
-
const { backupId } =
|
|
52
|
-
let { backupKey } =
|
|
56
|
+
const { backupId } = input;
|
|
57
|
+
let { backupKey } = input;
|
|
53
58
|
if (backupKey instanceof AccountKeys_1.BackupKey) {
|
|
54
59
|
backupKey = backupKey.contents;
|
|
55
60
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
-
import * as Native from '../Native';
|
|
4
3
|
import * as stream from 'stream';
|
|
5
4
|
type CallbackType = (error?: Error | null) => void;
|
|
6
5
|
export type ChunkSizeChoice = {
|
|
@@ -12,17 +11,6 @@ export type ChunkSizeChoice = {
|
|
|
12
11
|
};
|
|
13
12
|
export declare function everyNthByte(n: number): ChunkSizeChoice;
|
|
14
13
|
export declare function inferChunkSize(dataSize: number): ChunkSizeChoice;
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated Use the DigestingPassThrough instead
|
|
17
|
-
*/
|
|
18
|
-
export declare class DigestingWritable extends stream.Writable {
|
|
19
|
-
_nativeHandle: Native.IncrementalMac;
|
|
20
|
-
_digests: Buffer[];
|
|
21
|
-
constructor(key: Buffer, sizeChoice: ChunkSizeChoice);
|
|
22
|
-
getFinalDigest(): Buffer;
|
|
23
|
-
_write(chunk: any, encoding: BufferEncoding, callback: CallbackType): void;
|
|
24
|
-
_final(callback: CallbackType): void;
|
|
25
|
-
}
|
|
26
14
|
export declare class DigestingPassThrough extends stream.Transform {
|
|
27
15
|
private digester;
|
|
28
16
|
constructor(key: Buffer, sizeChoice: ChunkSizeChoice);
|
|
@@ -30,17 +18,6 @@ export declare class DigestingPassThrough extends stream.Transform {
|
|
|
30
18
|
_transform(data: Buffer, enc: BufferEncoding, callback: CallbackType): void;
|
|
31
19
|
_final(callback: CallbackType): void;
|
|
32
20
|
}
|
|
33
|
-
/**
|
|
34
|
-
* @deprecated Use the ValidatingPassThrough instead
|
|
35
|
-
*/
|
|
36
|
-
export declare class ValidatingWritable extends stream.Writable {
|
|
37
|
-
_nativeHandle: Native.ValidatingMac;
|
|
38
|
-
_validatedBytes: number;
|
|
39
|
-
constructor(key: Buffer, sizeChoice: ChunkSizeChoice, digest: Buffer);
|
|
40
|
-
validatedSize(): number;
|
|
41
|
-
_write(chunk: any, encoding: BufferEncoding, callback: CallbackType): void;
|
|
42
|
-
_final(callback: CallbackType): void;
|
|
43
|
-
}
|
|
44
21
|
export declare class ValidatingPassThrough extends stream.Transform {
|
|
45
22
|
private validator;
|
|
46
23
|
private buffer;
|
package/dist/incremental_mac.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
5
5
|
//
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.chunkSizeInBytes = exports.ValidatingPassThrough = exports.
|
|
7
|
+
exports.chunkSizeInBytes = exports.ValidatingPassThrough = exports.DigestingPassThrough = exports.inferChunkSize = exports.everyNthByte = void 0;
|
|
8
8
|
const Native = require("../Native");
|
|
9
9
|
const stream = require("stream");
|
|
10
10
|
const Errors_1 = require("./Errors");
|
|
@@ -16,9 +16,6 @@ function inferChunkSize(dataSize) {
|
|
|
16
16
|
return { kind: 'chunksOf', dataSize: dataSize };
|
|
17
17
|
}
|
|
18
18
|
exports.inferChunkSize = inferChunkSize;
|
|
19
|
-
/**
|
|
20
|
-
* @deprecated Use the DigestingPassThrough instead
|
|
21
|
-
*/
|
|
22
19
|
class DigestingWritable extends stream.Writable {
|
|
23
20
|
constructor(key, sizeChoice) {
|
|
24
21
|
super();
|
|
@@ -44,7 +41,6 @@ class DigestingWritable extends stream.Writable {
|
|
|
44
41
|
callback();
|
|
45
42
|
}
|
|
46
43
|
}
|
|
47
|
-
exports.DigestingWritable = DigestingWritable;
|
|
48
44
|
class DigestingPassThrough extends stream.Transform {
|
|
49
45
|
constructor(key, sizeChoice) {
|
|
50
46
|
super();
|
|
@@ -76,9 +72,6 @@ class DigestingPassThrough extends stream.Transform {
|
|
|
76
72
|
}
|
|
77
73
|
}
|
|
78
74
|
exports.DigestingPassThrough = DigestingPassThrough;
|
|
79
|
-
/**
|
|
80
|
-
* @deprecated Use the ValidatingPassThrough instead
|
|
81
|
-
*/
|
|
82
75
|
class ValidatingWritable extends stream.Writable {
|
|
83
76
|
constructor(key, sizeChoice, digest) {
|
|
84
77
|
super();
|
|
@@ -113,7 +106,6 @@ class ValidatingWritable extends stream.Writable {
|
|
|
113
106
|
}
|
|
114
107
|
}
|
|
115
108
|
}
|
|
116
|
-
exports.ValidatingWritable = ValidatingWritable;
|
|
117
109
|
class ValidatingPassThrough extends stream.Transform {
|
|
118
110
|
constructor(key, sizeChoice, digest) {
|
|
119
111
|
super();
|
package/dist/index.d.ts
CHANGED
|
@@ -26,13 +26,6 @@ export declare enum ContentHint {
|
|
|
26
26
|
Implicit = 2
|
|
27
27
|
}
|
|
28
28
|
export type Uuid = string;
|
|
29
|
-
export declare class HKDF {
|
|
30
|
-
/**
|
|
31
|
-
* @deprecated Use the top-level 'hkdf' function for standard HKDF behavior
|
|
32
|
-
*/
|
|
33
|
-
static new(version: number): HKDF;
|
|
34
|
-
deriveSecrets(outputLength: number, keyMaterial: Buffer, label: Buffer, salt: Buffer | null): Buffer;
|
|
35
|
-
}
|
|
36
29
|
export declare function hkdf(outputLength: number, keyMaterial: Buffer, label: Buffer, salt: Buffer | null): Buffer;
|
|
37
30
|
export declare class ScannableFingerprint {
|
|
38
31
|
private readonly scannable;
|
|
@@ -83,6 +76,18 @@ export declare class KEMKeyPair {
|
|
|
83
76
|
getPublicKey(): KEMPublicKey;
|
|
84
77
|
getSecretKey(): KEMSecretKey;
|
|
85
78
|
}
|
|
79
|
+
/** The public information contained in a {@link SignedPreKeyRecord} */
|
|
80
|
+
export type SignedPublicPreKey = {
|
|
81
|
+
id(): number;
|
|
82
|
+
publicKey(): PublicKey;
|
|
83
|
+
signature(): Buffer;
|
|
84
|
+
};
|
|
85
|
+
/** The public information contained in a {@link KyberPreKeyRecord} */
|
|
86
|
+
export type SignedKyberPublicPreKey = {
|
|
87
|
+
id(): number;
|
|
88
|
+
publicKey(): KEMPublicKey;
|
|
89
|
+
signature(): Buffer;
|
|
90
|
+
};
|
|
86
91
|
export declare class PreKeyBundle {
|
|
87
92
|
readonly _nativeHandle: Native.PreKeyBundle;
|
|
88
93
|
private constructor();
|
|
@@ -110,7 +115,7 @@ export declare class PreKeyRecord {
|
|
|
110
115
|
publicKey(): PublicKey;
|
|
111
116
|
serialize(): Buffer;
|
|
112
117
|
}
|
|
113
|
-
export declare class SignedPreKeyRecord {
|
|
118
|
+
export declare class SignedPreKeyRecord implements SignedPublicPreKey {
|
|
114
119
|
readonly _nativeHandle: Native.SignedPreKeyRecord;
|
|
115
120
|
private constructor();
|
|
116
121
|
static _fromNativeHandle(nativeHandle: Native.SignedPreKeyRecord): SignedPreKeyRecord;
|
|
@@ -123,7 +128,7 @@ export declare class SignedPreKeyRecord {
|
|
|
123
128
|
signature(): Buffer;
|
|
124
129
|
timestamp(): number;
|
|
125
130
|
}
|
|
126
|
-
export declare class KyberPreKeyRecord {
|
|
131
|
+
export declare class KyberPreKeyRecord implements SignedKyberPublicPreKey {
|
|
127
132
|
readonly _nativeHandle: Native.KyberPreKeyRecord;
|
|
128
133
|
private constructor();
|
|
129
134
|
static _fromNativeHandle(nativeHandle: Native.KyberPreKeyRecord): KyberPreKeyRecord;
|
package/dist/index.js
CHANGED
|
@@ -18,8 +18,8 @@ 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
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.sealedSenderMultiRecipientEncrypt = exports.sealedSenderEncrypt = exports.sealedSenderEncryptMessage = 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.KEMKeyPair = exports.KEMSecretKey = exports.KEMPublicKey = exports.Aes256GcmSiv = exports.Fingerprint = exports.DisplayableFingerprint = exports.ScannableFingerprint = exports.hkdf = exports.
|
|
22
|
-
exports.initLogger = exports.LogLevel = exports.HsmEnclaveClient = exports.Cds2Client = exports.sealedSenderDecryptToUsmc = exports.sealedSenderDecryptMessage =
|
|
21
|
+
exports.sealedSenderMultiRecipientMessageForSingleRecipient = exports.sealedSenderMultiRecipientEncrypt = exports.sealedSenderEncrypt = exports.sealedSenderEncryptMessage = 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.KEMKeyPair = exports.KEMSecretKey = exports.KEMPublicKey = exports.Aes256GcmSiv = exports.Fingerprint = exports.DisplayableFingerprint = exports.ScannableFingerprint = exports.hkdf = exports.ContentHint = exports.Direction = exports.CiphertextMessageType = exports.WebpSanitizer = exports.Mp4Sanitizer = exports.Net = exports.io = exports.usernames = void 0;
|
|
22
|
+
exports.initLogger = exports.LogLevel = exports.HsmEnclaveClient = exports.Cds2Client = exports.sealedSenderDecryptToUsmc = exports.sealedSenderDecryptMessage = void 0;
|
|
23
23
|
const uuid = require("uuid");
|
|
24
24
|
const Errors = require("./Errors");
|
|
25
25
|
__exportStar(require("./Errors"), exports);
|
|
@@ -54,21 +54,6 @@ var ContentHint;
|
|
|
54
54
|
ContentHint[ContentHint["Resendable"] = 1] = "Resendable";
|
|
55
55
|
ContentHint[ContentHint["Implicit"] = 2] = "Implicit";
|
|
56
56
|
})(ContentHint || (exports.ContentHint = ContentHint = {}));
|
|
57
|
-
class HKDF {
|
|
58
|
-
/**
|
|
59
|
-
* @deprecated Use the top-level 'hkdf' function for standard HKDF behavior
|
|
60
|
-
*/
|
|
61
|
-
static new(version) {
|
|
62
|
-
if (version != 3) {
|
|
63
|
-
throw new Error('HKDF versions other than 3 are no longer supported');
|
|
64
|
-
}
|
|
65
|
-
return new HKDF();
|
|
66
|
-
}
|
|
67
|
-
deriveSecrets(outputLength, keyMaterial, label, salt) {
|
|
68
|
-
return hkdf(outputLength, keyMaterial, label, salt);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
exports.HKDF = HKDF;
|
|
72
57
|
function hkdf(outputLength, keyMaterial, label, salt) {
|
|
73
58
|
return Native.HKDF_DeriveSecrets(outputLength, keyMaterial, label, salt);
|
|
74
59
|
}
|
package/dist/net/CDSI.d.ts
CHANGED
|
@@ -7,10 +7,6 @@ export type CDSRequestOptionsType = {
|
|
|
7
7
|
aci: string;
|
|
8
8
|
accessKey: string;
|
|
9
9
|
}>;
|
|
10
|
-
/**
|
|
11
|
-
* @deprecated this option is ignored by the server.
|
|
12
|
-
*/
|
|
13
|
-
returnAcisWithoutUaks: boolean;
|
|
14
10
|
abortSignal?: AbortSignal;
|
|
15
11
|
};
|
|
16
12
|
export type CDSResponseEntryType<Aci, Pni> = {
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import type { ReadonlyDeep } from 'type-fest';
|
|
2
3
|
import * as Native from '../../Native';
|
|
3
4
|
import { type TokioAsyncContext } from '../net';
|
|
5
|
+
import { PublicKey } from '../EcKeys';
|
|
6
|
+
import { Aci, Pni } from '../Address';
|
|
7
|
+
import { SignedKyberPublicPreKey, SignedPublicPreKey } from '..';
|
|
4
8
|
type ConnectionManager = Native.Wrapper<Native.ConnectionManager>;
|
|
5
9
|
type RegistrationOptions = {
|
|
6
10
|
tokioAsyncContext: TokioAsyncContext;
|
|
@@ -20,6 +24,7 @@ type CreateSessionArgs = Readonly<{
|
|
|
20
24
|
}>;
|
|
21
25
|
type ResumeSessionArgs = Readonly<{
|
|
22
26
|
sessionId: string;
|
|
27
|
+
e164: string;
|
|
23
28
|
}>;
|
|
24
29
|
/**
|
|
25
30
|
* A client for the Signal registration service.
|
|
@@ -58,7 +63,7 @@ export declare class RegistrationService {
|
|
|
58
63
|
* @returns a `Promise` that resolves to the `RegistrationService` if
|
|
59
64
|
* resumption is successful, otherwise a {@link LibSignalError}.
|
|
60
65
|
*/
|
|
61
|
-
static resumeSession(options: ReadonlyDeep<RegistrationOptions>, { sessionId }: ResumeSessionArgs): Promise<RegistrationService>;
|
|
66
|
+
static resumeSession(options: ReadonlyDeep<RegistrationOptions>, { sessionId, e164 }: ResumeSessionArgs): Promise<RegistrationService>;
|
|
62
67
|
/**
|
|
63
68
|
* Starts a new registration session.
|
|
64
69
|
*
|
|
@@ -77,11 +82,23 @@ export declare class RegistrationService {
|
|
|
77
82
|
submitCaptcha(captcha: string): Promise<{
|
|
78
83
|
allowedToRequestCode: boolean;
|
|
79
84
|
}>;
|
|
80
|
-
requestVerification({ transport, client, }: {
|
|
85
|
+
requestVerification({ transport, client, languages, }: {
|
|
81
86
|
transport: 'sms' | 'voice';
|
|
82
87
|
client: string;
|
|
88
|
+
languages: string[];
|
|
83
89
|
}): Promise<void>;
|
|
84
90
|
verifySession(code: string): Promise<boolean>;
|
|
91
|
+
registerAccount(inputs: {
|
|
92
|
+
accountPassword: Uint8Array;
|
|
93
|
+
skipDeviceTransfer: boolean;
|
|
94
|
+
accountAttributes: AccountAttributes;
|
|
95
|
+
aciPublicKey: PublicKey;
|
|
96
|
+
pniPublicKey: PublicKey;
|
|
97
|
+
aciSignedPreKey: SignedPublicPreKey;
|
|
98
|
+
pniSignedPreKey: SignedPublicPreKey;
|
|
99
|
+
aciPqLastResortPreKey: SignedKyberPublicPreKey;
|
|
100
|
+
pniPqLastResortPreKey: SignedKyberPublicPreKey;
|
|
101
|
+
}): Promise<RegisterAccountResponse>;
|
|
85
102
|
/**
|
|
86
103
|
* Internal, only public for testing
|
|
87
104
|
*/
|
|
@@ -96,4 +113,37 @@ export declare class RegistrationService {
|
|
|
96
113
|
*/
|
|
97
114
|
static fakeCreateSession(tokio: TokioAsyncContext, { e164 }: CreateSessionArgs): [Promise<RegistrationService>, Native.Wrapper<Native.FakeChatServer>];
|
|
98
115
|
}
|
|
116
|
+
export declare class AccountAttributes {
|
|
117
|
+
readonly _nativeHandle: Native.RegistrationAccountAttributes;
|
|
118
|
+
constructor({ recoveryPassword, aciRegistrationId, pniRegistrationId, registrationLock, unidentifiedAccessKey, unrestrictedUnidentifiedAccess, capabilities, discoverableByPhoneNumber, }: {
|
|
119
|
+
recoveryPassword: Uint8Array;
|
|
120
|
+
aciRegistrationId: number;
|
|
121
|
+
pniRegistrationId: number;
|
|
122
|
+
registrationLock: string | null;
|
|
123
|
+
unidentifiedAccessKey: Uint8Array;
|
|
124
|
+
unrestrictedUnidentifiedAccess: boolean;
|
|
125
|
+
capabilities: Set<string>;
|
|
126
|
+
discoverableByPhoneNumber: boolean;
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
export declare class RegisterAccountResponse {
|
|
130
|
+
readonly _nativeHandle: Native.RegisterAccountResponse;
|
|
131
|
+
constructor(_nativeHandle: Native.RegisterAccountResponse);
|
|
132
|
+
get aci(): Aci;
|
|
133
|
+
get pni(): Pni;
|
|
134
|
+
get number(): string;
|
|
135
|
+
get usernameHash(): Buffer | null;
|
|
136
|
+
get usernameLinkHandle(): Buffer | null;
|
|
137
|
+
get backupEntitlement(): {
|
|
138
|
+
backupLevel: bigint;
|
|
139
|
+
expirationSeconds: bigint;
|
|
140
|
+
} | null;
|
|
141
|
+
get entitlementBadges(): Array<{
|
|
142
|
+
id: string;
|
|
143
|
+
expirationSeconds: number;
|
|
144
|
+
visible: boolean;
|
|
145
|
+
}>;
|
|
146
|
+
get reregistration(): boolean;
|
|
147
|
+
get storageCapable(): boolean;
|
|
148
|
+
}
|
|
99
149
|
export {};
|
package/dist/net/Registration.js
CHANGED
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
5
5
|
//
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.RegistrationService = void 0;
|
|
7
|
+
exports.RegisterAccountResponse = exports.AccountAttributes = exports.RegistrationService = void 0;
|
|
8
8
|
const Native = require("../../Native");
|
|
9
9
|
const net_1 = require("../net");
|
|
10
|
+
const Address_1 = require("../Address");
|
|
10
11
|
/**
|
|
11
12
|
* A client for the Signal registration service.
|
|
12
13
|
*
|
|
@@ -49,8 +50,8 @@ class RegistrationService {
|
|
|
49
50
|
* @returns a `Promise` that resolves to the `RegistrationService` if
|
|
50
51
|
* resumption is successful, otherwise a {@link LibSignalError}.
|
|
51
52
|
*/
|
|
52
|
-
static async resumeSession(options, { sessionId }) {
|
|
53
|
-
const session = await Native.RegistrationService_ResumeSession(options.tokioAsyncContext, sessionId, options.connectionManager);
|
|
53
|
+
static async resumeSession(options, { sessionId, e164 }) {
|
|
54
|
+
const session = await Native.RegistrationService_ResumeSession(options.tokioAsyncContext, sessionId, e164, options.connectionManager);
|
|
54
55
|
return new RegistrationService(session, options.tokioAsyncContext);
|
|
55
56
|
}
|
|
56
57
|
/**
|
|
@@ -75,13 +76,28 @@ class RegistrationService {
|
|
|
75
76
|
await Native.RegistrationService_SubmitCaptcha(this.tokioAsyncContext, this, captcha);
|
|
76
77
|
return this.sessionState;
|
|
77
78
|
}
|
|
78
|
-
async requestVerification({ transport, client, }) {
|
|
79
|
-
await Native.RegistrationService_RequestVerificationCode(this.tokioAsyncContext, this, transport, client);
|
|
79
|
+
async requestVerification({ transport, client, languages = [], }) {
|
|
80
|
+
await Native.RegistrationService_RequestVerificationCode(this.tokioAsyncContext, this, transport, client, languages);
|
|
80
81
|
}
|
|
81
82
|
async verifySession(code) {
|
|
82
83
|
await Native.RegistrationService_SubmitVerificationCode(this.tokioAsyncContext, this, code);
|
|
83
84
|
return this.sessionState.verified;
|
|
84
85
|
}
|
|
86
|
+
async registerAccount(inputs) {
|
|
87
|
+
const { accountPassword, skipDeviceTransfer = false, accountAttributes, aciPublicKey, pniPublicKey, aciSignedPreKey, pniSignedPreKey, aciPqLastResortPreKey, pniPqLastResortPreKey, } = inputs;
|
|
88
|
+
const args = (0, net_1.newNativeHandle)(Native.RegisterAccountRequest_Create());
|
|
89
|
+
Native.RegisterAccountRequest_SetAccountPassword(args, Buffer.from(accountPassword));
|
|
90
|
+
if (skipDeviceTransfer) {
|
|
91
|
+
Native.RegisterAccountRequest_SetSkipDeviceTransfer(args);
|
|
92
|
+
}
|
|
93
|
+
Native.RegisterAccountRequest_SetIdentityPublicKey(args, Address_1.ServiceIdKind.Aci, aciPublicKey);
|
|
94
|
+
Native.RegisterAccountRequest_SetIdentityPublicKey(args, Address_1.ServiceIdKind.Pni, pniPublicKey);
|
|
95
|
+
Native.RegisterAccountRequest_SetIdentitySignedPreKey(args, Address_1.ServiceIdKind.Aci, toBridgedPublicPreKey(aciSignedPreKey));
|
|
96
|
+
Native.RegisterAccountRequest_SetIdentitySignedPreKey(args, Address_1.ServiceIdKind.Pni, toBridgedPublicPreKey(pniSignedPreKey));
|
|
97
|
+
Native.RegisterAccountRequest_SetIdentityPqLastResortPreKey(args, Address_1.ServiceIdKind.Aci, toBridgedPublicPreKey(aciPqLastResortPreKey));
|
|
98
|
+
Native.RegisterAccountRequest_SetIdentityPqLastResortPreKey(args, Address_1.ServiceIdKind.Pni, toBridgedPublicPreKey(pniPqLastResortPreKey));
|
|
99
|
+
return new RegisterAccountResponse(await Native.RegistrationService_RegisterAccount(this.tokioAsyncContext, this, args, accountAttributes));
|
|
100
|
+
}
|
|
85
101
|
/**
|
|
86
102
|
* Internal, only public for testing
|
|
87
103
|
*/
|
|
@@ -118,4 +134,58 @@ class RegistrationService {
|
|
|
118
134
|
}
|
|
119
135
|
}
|
|
120
136
|
exports.RegistrationService = RegistrationService;
|
|
137
|
+
function toBridgedPublicPreKey(key) {
|
|
138
|
+
return {
|
|
139
|
+
keyId: key.id(),
|
|
140
|
+
signature: key.signature(),
|
|
141
|
+
publicKey: key.publicKey().serialize(),
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
class AccountAttributes {
|
|
145
|
+
constructor({ recoveryPassword, aciRegistrationId, pniRegistrationId, registrationLock, unidentifiedAccessKey, unrestrictedUnidentifiedAccess, capabilities, discoverableByPhoneNumber, }) {
|
|
146
|
+
const capabilitiesArray = Array.from(capabilities);
|
|
147
|
+
this._nativeHandle = Native.RegistrationAccountAttributes_Create(Buffer.from(recoveryPassword), aciRegistrationId, pniRegistrationId, registrationLock, Buffer.from(unidentifiedAccessKey), unrestrictedUnidentifiedAccess, capabilitiesArray, discoverableByPhoneNumber);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
exports.AccountAttributes = AccountAttributes;
|
|
151
|
+
class RegisterAccountResponse {
|
|
152
|
+
constructor(_nativeHandle) {
|
|
153
|
+
this._nativeHandle = _nativeHandle;
|
|
154
|
+
}
|
|
155
|
+
get aci() {
|
|
156
|
+
return new Address_1.Aci(Native.RegisterAccountResponse_GetIdentity(this, Address_1.ServiceIdKind.Aci));
|
|
157
|
+
}
|
|
158
|
+
get pni() {
|
|
159
|
+
return new Address_1.Pni(Native.RegisterAccountResponse_GetIdentity(this, Address_1.ServiceIdKind.Pni));
|
|
160
|
+
}
|
|
161
|
+
get number() {
|
|
162
|
+
return Native.RegisterAccountResponse_GetNumber(this);
|
|
163
|
+
}
|
|
164
|
+
get usernameHash() {
|
|
165
|
+
return Native.RegisterAccountResponse_GetUsernameHash(this);
|
|
166
|
+
}
|
|
167
|
+
get usernameLinkHandle() {
|
|
168
|
+
return Native.RegisterAccountResponse_GetUsernameLinkHandle(this);
|
|
169
|
+
}
|
|
170
|
+
get backupEntitlement() {
|
|
171
|
+
const backupLevel = Native.RegisterAccountResponse_GetEntitlementBackupLevel(this);
|
|
172
|
+
const expirationSeconds = Native.RegisterAccountResponse_GetEntitlementBackupExpirationSeconds(this);
|
|
173
|
+
if (backupLevel == null || expirationSeconds == null)
|
|
174
|
+
return null;
|
|
175
|
+
return {
|
|
176
|
+
backupLevel,
|
|
177
|
+
expirationSeconds,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
get entitlementBadges() {
|
|
181
|
+
return Native.RegisterAccountResponse_GetEntitlementBadges(this);
|
|
182
|
+
}
|
|
183
|
+
get reregistration() {
|
|
184
|
+
return Native.RegisterAccountResponse_GetReregistration(this);
|
|
185
|
+
}
|
|
186
|
+
get storageCapable() {
|
|
187
|
+
return Native.RegisterAccountResponse_GetStorageCapable(this);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
exports.RegisterAccountResponse = RegisterAccountResponse;
|
|
121
191
|
//# sourceMappingURL=Registration.js.map
|
package/dist/net.d.ts
CHANGED
|
@@ -90,8 +90,9 @@ export declare class Net {
|
|
|
90
90
|
connectAuthenticatedChat(username: string, password: string, receiveStories: boolean, listener: ChatServiceListener, options?: {
|
|
91
91
|
abortSignal?: AbortSignal;
|
|
92
92
|
}): Promise<AuthenticatedChatConnection>;
|
|
93
|
-
resumeRegistrationSession({ sessionId, connectionTimeoutMillis, }: {
|
|
93
|
+
resumeRegistrationSession({ sessionId, e164, connectionTimeoutMillis, }: {
|
|
94
94
|
sessionId: string;
|
|
95
|
+
e164: string;
|
|
95
96
|
connectionTimeoutMillis?: number;
|
|
96
97
|
}): Promise<RegistrationService>;
|
|
97
98
|
createRegistrationSession({ e164, connectionTimeoutMillis, }: {
|
package/dist/net.js
CHANGED
|
@@ -104,12 +104,12 @@ class Net {
|
|
|
104
104
|
connectAuthenticatedChat(username, password, receiveStories, listener, options) {
|
|
105
105
|
return Chat_1.AuthenticatedChatConnection.connect(this.asyncContext, this._connectionManager, username, password, receiveStories, listener, options);
|
|
106
106
|
}
|
|
107
|
-
async resumeRegistrationSession({ sessionId, connectionTimeoutMillis, }) {
|
|
107
|
+
async resumeRegistrationSession({ sessionId, e164, connectionTimeoutMillis, }) {
|
|
108
108
|
return Registration_1.RegistrationService.resumeSession({
|
|
109
109
|
connectionManager: this._connectionManager,
|
|
110
110
|
tokioAsyncContext: this.asyncContext,
|
|
111
111
|
connectionTimeoutMillis: connectionTimeoutMillis,
|
|
112
|
-
}, { sessionId });
|
|
112
|
+
}, { sessionId, e164 });
|
|
113
113
|
}
|
|
114
114
|
async createRegistrationSession({ e164, connectionTimeoutMillis, }) {
|
|
115
115
|
return Registration_1.RegistrationService.createSession({
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/pin.d.ts
DELETED
package/dist/pin.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
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.AccountEntropyPool = void 0;
|
|
8
|
-
var AccountKeys_1 = require("./AccountKeys");
|
|
9
|
-
/** @deprecated AccountEntropyPool was moved to 'AccountKeys' */
|
|
10
|
-
Object.defineProperty(exports, "AccountEntropyPool", { enumerable: true, get: function () { return AccountKeys_1.AccountEntropyPool; } });
|
|
11
|
-
//# sourceMappingURL=pin.js.map
|