@signalapp/libsignal-client 0.68.1 → 0.69.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Native.d.ts +21 -2
- package/dist/Errors.d.ts +11 -3
- package/dist/Errors.js +4 -2
- package/dist/acknowledgments.md +481 -119
- package/dist/internal.d.ts +6 -0
- package/dist/internal.js +21 -0
- package/dist/net/CDSI.d.ts +1 -2
- package/dist/net/CDSI.js +2 -5
- package/dist/net/Registration.d.ts +17 -6
- package/dist/net/Registration.js +16 -0
- package/dist/net.d.ts +3 -0
- package/dist/net.js +6 -1
- package/dist/zkgroup/calllinks/CallLinkSecretParams.d.ts +1 -0
- package/dist/zkgroup/calllinks/CallLinkSecretParams.js +4 -0
- package/dist/zkgroup/groups/GroupIdentifier.d.ts +2 -0
- package/dist/zkgroup/groups/GroupIdentifier.js +4 -0
- package/dist/zkgroup/groupsend/GroupSendEndorsement.d.ts +3 -2
- package/dist/zkgroup/groupsend/GroupSendEndorsement.js +12 -4
- package/package.json +4 -6
- 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/internal.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// Copyright 2025 Signal Messenger, LLC.
|
|
4
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
5
|
+
//
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.BridgedStringMap = void 0;
|
|
8
|
+
const Native = require("../Native");
|
|
9
|
+
class BridgedStringMap {
|
|
10
|
+
constructor(input) {
|
|
11
|
+
this._nativeHandle = Native.BridgedStringMap_new(input.size);
|
|
12
|
+
for (const [key, value] of input) {
|
|
13
|
+
Native.BridgedStringMap_insert(this, key, value);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
dump() {
|
|
17
|
+
return Native.TESTING_BridgedStringMap_dump_to_json(this);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.BridgedStringMap = BridgedStringMap;
|
|
21
|
+
//# sourceMappingURL=internal.js.map
|
package/dist/net/CDSI.d.ts
CHANGED
|
@@ -12,7 +12,6 @@ export type CDSRequestOptionsType = {
|
|
|
12
12
|
*/
|
|
13
13
|
returnAcisWithoutUaks: boolean;
|
|
14
14
|
abortSignal?: AbortSignal;
|
|
15
|
-
useNewConnectLogic?: boolean;
|
|
16
15
|
};
|
|
17
16
|
export type CDSResponseEntryType<Aci, Pni> = {
|
|
18
17
|
aci: Aci | undefined;
|
|
@@ -26,4 +25,4 @@ export interface CDSResponseType<Aci, Pni> {
|
|
|
26
25
|
export declare function cdsiLookup({ asyncContext, connectionManager, }: Readonly<{
|
|
27
26
|
asyncContext: TokioAsyncContext;
|
|
28
27
|
connectionManager: Native.Wrapper<Native.ConnectionManager>;
|
|
29
|
-
}>, { username, password }: Readonly<ServiceAuth>, { e164s, acisAndAccessKeys, abortSignal
|
|
28
|
+
}>, { username, password }: Readonly<ServiceAuth>, { e164s, acisAndAccessKeys, abortSignal }: ReadonlyDeep<CDSRequestOptionsType>): Promise<CDSResponseType<string, string>>;
|
package/dist/net/CDSI.js
CHANGED
|
@@ -9,7 +9,7 @@ const Native = require("../../Native");
|
|
|
9
9
|
const Address_1 = require("../Address");
|
|
10
10
|
const node_buffer_1 = require("node:buffer");
|
|
11
11
|
const net_1 = require("../net");
|
|
12
|
-
async function cdsiLookup({ asyncContext, connectionManager, }, { username, password }, { e164s, acisAndAccessKeys, abortSignal
|
|
12
|
+
async function cdsiLookup({ asyncContext, connectionManager, }, { username, password }, { e164s, acisAndAccessKeys, abortSignal }) {
|
|
13
13
|
const request = (0, net_1.newNativeHandle)(Native.LookupRequest_new());
|
|
14
14
|
e164s.forEach((e164) => {
|
|
15
15
|
Native.LookupRequest_addE164(request, e164);
|
|
@@ -17,10 +17,7 @@ async function cdsiLookup({ asyncContext, connectionManager, }, { username, pass
|
|
|
17
17
|
acisAndAccessKeys.forEach(({ aci: aciStr, accessKey: accessKeyStr }) => {
|
|
18
18
|
Native.LookupRequest_addAciAndAccessKey(request, Address_1.Aci.parseFromServiceIdString(aciStr).getServiceIdFixedWidthBinary(), node_buffer_1.Buffer.from(accessKeyStr, 'base64'));
|
|
19
19
|
});
|
|
20
|
-
const
|
|
21
|
-
? Native.CdsiLookup_new_routes
|
|
22
|
-
: Native.CdsiLookup_new;
|
|
23
|
-
const lookup = await asyncContext.makeCancellable(abortSignal, startLookup(asyncContext, connectionManager, username, password, request));
|
|
20
|
+
const lookup = await asyncContext.makeCancellable(abortSignal, Native.CdsiLookup_new(asyncContext, connectionManager, username, password, request));
|
|
24
21
|
return await asyncContext.makeCancellable(abortSignal, Native.CdsiLookup_complete(asyncContext, (0, net_1.newNativeHandle)(lookup)));
|
|
25
22
|
}
|
|
26
23
|
exports.cdsiLookup = cdsiLookup;
|
|
@@ -15,6 +15,12 @@ export type RegistrationSessionState = {
|
|
|
15
15
|
nextVerificationAttemptSecs?: number;
|
|
16
16
|
requestedInformation: Set<'pushChallenge' | 'captcha'>;
|
|
17
17
|
};
|
|
18
|
+
type CreateSessionArgs = Readonly<{
|
|
19
|
+
e164: string;
|
|
20
|
+
}>;
|
|
21
|
+
type ResumeSessionArgs = Readonly<{
|
|
22
|
+
sessionId: string;
|
|
23
|
+
}>;
|
|
18
24
|
/**
|
|
19
25
|
* A client for the Signal registration service.
|
|
20
26
|
*
|
|
@@ -52,9 +58,7 @@ export declare class RegistrationService {
|
|
|
52
58
|
* @returns a `Promise` that resolves to the `RegistrationService` if
|
|
53
59
|
* resumption is successful, otherwise a {@link LibSignalError}.
|
|
54
60
|
*/
|
|
55
|
-
static resumeSession(options: ReadonlyDeep<RegistrationOptions>, { sessionId }:
|
|
56
|
-
sessionId: string;
|
|
57
|
-
}): Promise<RegistrationService>;
|
|
61
|
+
static resumeSession(options: ReadonlyDeep<RegistrationOptions>, { sessionId }: ResumeSessionArgs): Promise<RegistrationService>;
|
|
58
62
|
/**
|
|
59
63
|
* Starts a new registration session.
|
|
60
64
|
*
|
|
@@ -69,9 +73,7 @@ export declare class RegistrationService {
|
|
|
69
73
|
* creation is successful, otherwise a {@link RateLimitedError} or other
|
|
70
74
|
* {@link LibSignalError}.
|
|
71
75
|
*/
|
|
72
|
-
static createSession(options: ReadonlyDeep<RegistrationOptions>, { e164 }:
|
|
73
|
-
e164: string;
|
|
74
|
-
}): Promise<RegistrationService>;
|
|
76
|
+
static createSession(options: ReadonlyDeep<RegistrationOptions>, { e164 }: CreateSessionArgs): Promise<RegistrationService>;
|
|
75
77
|
submitCaptcha(captcha: string): Promise<{
|
|
76
78
|
allowedToRequestCode: boolean;
|
|
77
79
|
}>;
|
|
@@ -84,5 +86,14 @@ export declare class RegistrationService {
|
|
|
84
86
|
* Internal, only public for testing
|
|
85
87
|
*/
|
|
86
88
|
static _convertNativeSessionState(session: Native.Wrapper<Native.RegistrationSession>): RegistrationSessionState;
|
|
89
|
+
/**
|
|
90
|
+
* Create a registration client that sends requests to the returned fake chat.
|
|
91
|
+
*
|
|
92
|
+
* Calling code will need to retrieve the first fake remote from the fake chat
|
|
93
|
+
* server and respond in order for the returned Promise to resolve.
|
|
94
|
+
*
|
|
95
|
+
* Internal, only public for testing
|
|
96
|
+
*/
|
|
97
|
+
static fakeCreateSession(tokio: TokioAsyncContext, { e164 }: CreateSessionArgs): [Promise<RegistrationService>, Native.Wrapper<Native.FakeChatServer>];
|
|
87
98
|
}
|
|
88
99
|
export {};
|
package/dist/net/Registration.js
CHANGED
|
@@ -100,6 +100,22 @@ class RegistrationService {
|
|
|
100
100
|
requestedInformation: new Set(Native.RegistrationSession_GetRequestedInformation(session)),
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Create a registration client that sends requests to the returned fake chat.
|
|
105
|
+
*
|
|
106
|
+
* Calling code will need to retrieve the first fake remote from the fake chat
|
|
107
|
+
* server and respond in order for the returned Promise to resolve.
|
|
108
|
+
*
|
|
109
|
+
* Internal, only public for testing
|
|
110
|
+
*/
|
|
111
|
+
static fakeCreateSession(tokio, { e164 }) {
|
|
112
|
+
const server = (0, net_1.newNativeHandle)(Native.TESTING_FakeChatServer_Create());
|
|
113
|
+
const registration = async () => {
|
|
114
|
+
const handle = await Native.TESTING_FakeRegistrationSession_CreateSession(tokio, { number: e164 }, server);
|
|
115
|
+
return new RegistrationService(handle, tokio);
|
|
116
|
+
};
|
|
117
|
+
return [registration(), server];
|
|
118
|
+
}
|
|
103
119
|
}
|
|
104
120
|
exports.RegistrationService = RegistrationService;
|
|
105
121
|
//# sourceMappingURL=Registration.js.map
|
package/dist/net.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ export type NetConstructorOptions = Readonly<{
|
|
|
35
35
|
localTestServer?: false;
|
|
36
36
|
env: Environment;
|
|
37
37
|
userAgent: string;
|
|
38
|
+
remoteConfig?: Map<string, string>;
|
|
38
39
|
} | {
|
|
39
40
|
localTestServer: true;
|
|
40
41
|
userAgent: string;
|
|
@@ -175,6 +176,8 @@ export declare class Net {
|
|
|
175
176
|
* was set, calling this method is a no-op.
|
|
176
177
|
*/
|
|
177
178
|
clearProxy(): void;
|
|
179
|
+
/** Updates the remote config settings used by libsignal. */
|
|
180
|
+
setRemoteConfig(remoteConfig: Map<string, string>): void;
|
|
178
181
|
/**
|
|
179
182
|
* Notifies libsignal that the network has changed.
|
|
180
183
|
*
|
package/dist/net.js
CHANGED
|
@@ -23,6 +23,7 @@ const Native = require("../Native");
|
|
|
23
23
|
const CDSI_1 = require("./net/CDSI");
|
|
24
24
|
const Chat_1 = require("./net/Chat");
|
|
25
25
|
const Registration_1 = require("./net/Registration");
|
|
26
|
+
const internal_1 = require("./internal");
|
|
26
27
|
__exportStar(require("./net/CDSI"), exports);
|
|
27
28
|
__exportStar(require("./net/Chat"), exports);
|
|
28
29
|
__exportStar(require("./net/Registration"), exports);
|
|
@@ -69,7 +70,7 @@ class Net {
|
|
|
69
70
|
this._connectionManager = newNativeHandle(Native.TESTING_ConnectionManager_newLocalOverride(options.userAgent, options.TESTING_localServer_chatPort, options.TESTING_localServer_cdsiPort, options.TESTING_localServer_svr2Port, options.TESTING_localServer_rootCertificateDer));
|
|
70
71
|
}
|
|
71
72
|
else {
|
|
72
|
-
this._connectionManager = newNativeHandle(Native.ConnectionManager_new(options.env, options.userAgent));
|
|
73
|
+
this._connectionManager = newNativeHandle(Native.ConnectionManager_new(options.env, options.userAgent, new internal_1.BridgedStringMap(options.remoteConfig || new Map())));
|
|
73
74
|
}
|
|
74
75
|
}
|
|
75
76
|
/**
|
|
@@ -239,6 +240,10 @@ class Net {
|
|
|
239
240
|
clearProxy() {
|
|
240
241
|
Native.ConnectionManager_clear_proxy(this._connectionManager);
|
|
241
242
|
}
|
|
243
|
+
/** Updates the remote config settings used by libsignal. */
|
|
244
|
+
setRemoteConfig(remoteConfig) {
|
|
245
|
+
Native.ConnectionManager_set_remote_config(this._connectionManager, new internal_1.BridgedStringMap(remoteConfig));
|
|
246
|
+
}
|
|
242
247
|
/**
|
|
243
248
|
* Notifies libsignal that the network has changed.
|
|
244
249
|
*
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
const ByteArray_1 = require("../internal/ByteArray");
|
|
8
8
|
const Native = require("../../../Native");
|
|
9
9
|
const CallLinkPublicParams_1 = require("./CallLinkPublicParams");
|
|
10
|
+
const UuidCiphertext_1 = require("../groups/UuidCiphertext");
|
|
10
11
|
const Address_1 = require("../../Address");
|
|
11
12
|
class CallLinkSecretParams extends ByteArray_1.default {
|
|
12
13
|
static deriveFromRootKey(callLinkRootKey) {
|
|
@@ -21,6 +22,9 @@ class CallLinkSecretParams extends ByteArray_1.default {
|
|
|
21
22
|
decryptUserId(userId) {
|
|
22
23
|
return Address_1.Aci.parseFromServiceIdFixedWidthBinary(Native.CallLinkSecretParams_DecryptUserId(this.contents, userId.contents));
|
|
23
24
|
}
|
|
25
|
+
encryptUserId(userId) {
|
|
26
|
+
return new UuidCiphertext_1.default(Native.CallLinkSecretParams_EncryptUserId(this.contents, userId.getServiceIdFixedWidthBinary()));
|
|
27
|
+
}
|
|
24
28
|
}
|
|
25
29
|
exports.default = CallLinkSecretParams;
|
|
26
30
|
//# sourceMappingURL=CallLinkSecretParams.js.map
|
|
@@ -9,6 +9,10 @@ class GroupIdentifier extends ByteArray_1.default {
|
|
|
9
9
|
constructor(contents) {
|
|
10
10
|
super(contents, GroupIdentifier.checkLength(GroupIdentifier.SIZE));
|
|
11
11
|
}
|
|
12
|
+
/** Returns the group ID as a base64 string (with padding). */
|
|
13
|
+
toString() {
|
|
14
|
+
return this.contents.toString('base64');
|
|
15
|
+
}
|
|
12
16
|
}
|
|
13
17
|
GroupIdentifier.SIZE = 32;
|
|
14
18
|
exports.default = GroupIdentifier;
|
|
@@ -3,6 +3,7 @@ import ByteArray, { UNCHECKED_AND_UNCLONED } from '../internal/ByteArray';
|
|
|
3
3
|
import GroupSecretParams from '../groups/GroupSecretParams';
|
|
4
4
|
import GroupSendFullToken from './GroupSendFullToken';
|
|
5
5
|
import GroupSendToken from './GroupSendToken';
|
|
6
|
+
import CallLinkSecretParams from '../calllinks/CallLinkSecretParams';
|
|
6
7
|
/**
|
|
7
8
|
* An endorsement for a user or set of users in a group.
|
|
8
9
|
*
|
|
@@ -55,7 +56,7 @@ export default class GroupSendEndorsement extends ByteArray {
|
|
|
55
56
|
*
|
|
56
57
|
* @see {@link GroupSendToken}
|
|
57
58
|
*/
|
|
58
|
-
toToken(
|
|
59
|
+
toToken(params: GroupSecretParams | CallLinkSecretParams): GroupSendToken;
|
|
59
60
|
/**
|
|
60
61
|
* Generates a token used to authenticate sends, ready to put in an auth header.
|
|
61
62
|
*
|
|
@@ -64,5 +65,5 @@ export default class GroupSendEndorsement extends ByteArray {
|
|
|
64
65
|
*
|
|
65
66
|
* Equivalent to {@link #toToken} followed by {@link GroupSendToken#toFullToken}.
|
|
66
67
|
*/
|
|
67
|
-
toFullToken(
|
|
68
|
+
toFullToken(params: GroupSecretParams | CallLinkSecretParams, expiration: Date): GroupSendFullToken;
|
|
68
69
|
}
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
const ByteArray_1 = require("../internal/ByteArray");
|
|
8
8
|
const Native = require("../../../Native");
|
|
9
|
+
const GroupSecretParams_1 = require("../groups/GroupSecretParams");
|
|
9
10
|
const GroupSendToken_1 = require("./GroupSendToken");
|
|
11
|
+
const CallLinkSecretParams_1 = require("../calllinks/CallLinkSecretParams");
|
|
10
12
|
/**
|
|
11
13
|
* An endorsement for a user or set of users in a group.
|
|
12
14
|
*
|
|
@@ -65,8 +67,14 @@ class GroupSendEndorsement extends ByteArray_1.default {
|
|
|
65
67
|
*
|
|
66
68
|
* @see {@link GroupSendToken}
|
|
67
69
|
*/
|
|
68
|
-
toToken(
|
|
69
|
-
|
|
70
|
+
toToken(params) {
|
|
71
|
+
if (params instanceof GroupSecretParams_1.default) {
|
|
72
|
+
return new GroupSendToken_1.default(Native.GroupSendEndorsement_ToToken(this.contents, params.contents));
|
|
73
|
+
}
|
|
74
|
+
else if (params instanceof CallLinkSecretParams_1.default) {
|
|
75
|
+
return new GroupSendToken_1.default(Native.GroupSendEndorsement_CallLinkParams_ToToken(this.contents, params.contents));
|
|
76
|
+
}
|
|
77
|
+
throw new Error('Unsupported token type');
|
|
70
78
|
}
|
|
71
79
|
/**
|
|
72
80
|
* Generates a token used to authenticate sends, ready to put in an auth header.
|
|
@@ -76,8 +84,8 @@ class GroupSendEndorsement extends ByteArray_1.default {
|
|
|
76
84
|
*
|
|
77
85
|
* Equivalent to {@link #toToken} followed by {@link GroupSendToken#toFullToken}.
|
|
78
86
|
*/
|
|
79
|
-
toFullToken(
|
|
80
|
-
return this.toToken(
|
|
87
|
+
toFullToken(params, expiration) {
|
|
88
|
+
return this.toToken(params).toFullToken(expiration);
|
|
81
89
|
}
|
|
82
90
|
}
|
|
83
91
|
exports.default = GroupSendEndorsement;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signalapp/libsignal-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.69.1",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"node-gyp-build": "^4.8.0",
|
|
35
35
|
"type-fest": "^4.26.0",
|
|
36
|
-
"uuid": "^
|
|
36
|
+
"uuid": "^11"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@indutny/bencher": "^1.2.0",
|
|
@@ -42,12 +42,10 @@
|
|
|
42
42
|
"@types/chai": "^4.3.1",
|
|
43
43
|
"@types/chai-as-promised": "^7.1.3",
|
|
44
44
|
"@types/chance": "^1.1.3",
|
|
45
|
-
"@types/long": "^4.0.0",
|
|
46
45
|
"@types/mocha": "^5.2.7",
|
|
47
46
|
"@types/node": "~20.11.0",
|
|
48
47
|
"@types/sinon": "^17.0.3",
|
|
49
48
|
"@types/sinon-chai": "^3.2.12",
|
|
50
|
-
"@types/uuid": "^8.3.0",
|
|
51
49
|
"@typescript-eslint/eslint-plugin": "^6.18.1",
|
|
52
50
|
"@typescript-eslint/parser": "^6.18.1",
|
|
53
51
|
"chai": "^4.2.0",
|
|
@@ -61,10 +59,10 @@
|
|
|
61
59
|
"eslint-plugin-mocha": "^10.1.0",
|
|
62
60
|
"eslint-plugin-more": "^1.0.0",
|
|
63
61
|
"mocha": "^9",
|
|
64
|
-
"node-gyp": "^
|
|
62
|
+
"node-gyp": "^11.2.0",
|
|
65
63
|
"prebuildify": "^6.0.0",
|
|
66
64
|
"prettier": "^2.7.1",
|
|
67
|
-
"rimraf": "^
|
|
65
|
+
"rimraf": "^6.0.1",
|
|
68
66
|
"sinon": "^18.0.0",
|
|
69
67
|
"sinon-chai": "^3.7.0",
|
|
70
68
|
"source-map-support": "^0.5.19",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|