@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
|
@@ -10,6 +10,22 @@ class UuidCiphertext extends ByteArray_1.default {
|
|
|
10
10
|
constructor(contents) {
|
|
11
11
|
super(contents, Native.UuidCiphertext_CheckValidContents);
|
|
12
12
|
}
|
|
13
|
+
static serializeAndConcatenate(ciphertexts) {
|
|
14
|
+
if (ciphertexts.length == 0) {
|
|
15
|
+
return Buffer.of();
|
|
16
|
+
}
|
|
17
|
+
const uuidCiphertextLen = ciphertexts[0].contents.length;
|
|
18
|
+
const concatenated = Buffer.alloc(ciphertexts.length * uuidCiphertextLen);
|
|
19
|
+
let offset = 0;
|
|
20
|
+
for (const next of ciphertexts) {
|
|
21
|
+
if (next.contents.length !== uuidCiphertextLen) {
|
|
22
|
+
throw TypeError('UuidCiphertext with unexpected length');
|
|
23
|
+
}
|
|
24
|
+
concatenated.set(next.contents, offset);
|
|
25
|
+
offset += uuidCiphertextLen;
|
|
26
|
+
}
|
|
27
|
+
return concatenated;
|
|
28
|
+
}
|
|
13
29
|
}
|
|
14
30
|
exports.default = UuidCiphertext;
|
|
15
31
|
//# sourceMappingURL=UuidCiphertext.js.map
|
|
@@ -2,9 +2,29 @@
|
|
|
2
2
|
import ByteArray from '../internal/ByteArray';
|
|
3
3
|
import GroupSendCredentialPresentation from './GroupSendCredentialPresentation';
|
|
4
4
|
import ServerPublicParams from '../ServerPublicParams';
|
|
5
|
+
/**
|
|
6
|
+
* A credential indicating membership in a group, based on the set of *other* users in the
|
|
7
|
+
* group with you.
|
|
8
|
+
*
|
|
9
|
+
* Follows the usual zkgroup pattern of "issue response -> receive response -> present credential
|
|
10
|
+
* -> verify presentation".
|
|
11
|
+
*
|
|
12
|
+
* @see {@link GroupSendCredentialResponse}
|
|
13
|
+
* @see {@link GroupSendCredentialPresentation}
|
|
14
|
+
*/
|
|
5
15
|
export default class GroupSendCredential extends ByteArray {
|
|
6
16
|
private readonly __type?;
|
|
7
17
|
constructor(contents: Buffer);
|
|
18
|
+
/**
|
|
19
|
+
* Generates a new presentation, so that multiple uses of this credential are harder to link.
|
|
20
|
+
*/
|
|
8
21
|
present(serverParams: ServerPublicParams): GroupSendCredentialPresentation;
|
|
22
|
+
/**
|
|
23
|
+
* Generates a new presentation with a dedicated source of randomness.
|
|
24
|
+
*
|
|
25
|
+
* Should only be used for testing purposes.
|
|
26
|
+
*
|
|
27
|
+
* @see {@link GroupSendCredential#present}
|
|
28
|
+
*/
|
|
9
29
|
presentWithRandom(serverParams: ServerPublicParams, random: Buffer): GroupSendCredentialPresentation;
|
|
10
30
|
}
|
|
@@ -9,14 +9,34 @@ const ByteArray_1 = require("../internal/ByteArray");
|
|
|
9
9
|
const Constants_1 = require("../internal/Constants");
|
|
10
10
|
const Native = require("../../../Native");
|
|
11
11
|
const GroupSendCredentialPresentation_1 = require("./GroupSendCredentialPresentation");
|
|
12
|
+
/**
|
|
13
|
+
* A credential indicating membership in a group, based on the set of *other* users in the
|
|
14
|
+
* group with you.
|
|
15
|
+
*
|
|
16
|
+
* Follows the usual zkgroup pattern of "issue response -> receive response -> present credential
|
|
17
|
+
* -> verify presentation".
|
|
18
|
+
*
|
|
19
|
+
* @see {@link GroupSendCredentialResponse}
|
|
20
|
+
* @see {@link GroupSendCredentialPresentation}
|
|
21
|
+
*/
|
|
12
22
|
class GroupSendCredential extends ByteArray_1.default {
|
|
13
23
|
constructor(contents) {
|
|
14
24
|
super(contents, Native.GroupSendCredential_CheckValidContents);
|
|
15
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Generates a new presentation, so that multiple uses of this credential are harder to link.
|
|
28
|
+
*/
|
|
16
29
|
present(serverParams) {
|
|
17
30
|
const random = (0, crypto_1.randomBytes)(Constants_1.RANDOM_LENGTH);
|
|
18
31
|
return this.presentWithRandom(serverParams, random);
|
|
19
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Generates a new presentation with a dedicated source of randomness.
|
|
35
|
+
*
|
|
36
|
+
* Should only be used for testing purposes.
|
|
37
|
+
*
|
|
38
|
+
* @see {@link GroupSendCredential#present}
|
|
39
|
+
*/
|
|
20
40
|
presentWithRandom(serverParams, random) {
|
|
21
41
|
return new GroupSendCredentialPresentation_1.default(Native.GroupSendCredential_PresentDeterministic(this.contents, serverParams.contents, random));
|
|
22
42
|
}
|
|
@@ -2,8 +2,23 @@
|
|
|
2
2
|
import ByteArray from '../internal/ByteArray';
|
|
3
3
|
import ServerSecretParams from '../ServerSecretParams';
|
|
4
4
|
import { ServiceId } from '../../Address';
|
|
5
|
+
/**
|
|
6
|
+
* A credential presentation indicating membership in a group, based on the set of *other* users in
|
|
7
|
+
* the group with you.
|
|
8
|
+
*
|
|
9
|
+
* Follows the usual zkgroup pattern of "issue response -> receive response -> present credential ->
|
|
10
|
+
* verify presentation".
|
|
11
|
+
*
|
|
12
|
+
* @see {@link GroupSendCredentialResponse}
|
|
13
|
+
* @see {@link GroupSendCredential}
|
|
14
|
+
*/
|
|
5
15
|
export default class GroupSendCredentialPresentation extends ByteArray {
|
|
6
16
|
private readonly __type?;
|
|
7
17
|
constructor(contents: Buffer);
|
|
18
|
+
/**
|
|
19
|
+
* Verifies that the credential is valid for a group containing the holder and `groupMembers`.
|
|
20
|
+
*
|
|
21
|
+
* @throws {VerificationFailedError} if the credential is not valid for any reason
|
|
22
|
+
*/
|
|
8
23
|
verify(groupMembers: ServiceId[], serverParams: ServerSecretParams, now?: Date): void;
|
|
9
24
|
}
|
|
@@ -7,10 +7,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
const ByteArray_1 = require("../internal/ByteArray");
|
|
8
8
|
const Native = require("../../../Native");
|
|
9
9
|
const Address_1 = require("../../Address");
|
|
10
|
+
/**
|
|
11
|
+
* A credential presentation indicating membership in a group, based on the set of *other* users in
|
|
12
|
+
* the group with you.
|
|
13
|
+
*
|
|
14
|
+
* Follows the usual zkgroup pattern of "issue response -> receive response -> present credential ->
|
|
15
|
+
* verify presentation".
|
|
16
|
+
*
|
|
17
|
+
* @see {@link GroupSendCredentialResponse}
|
|
18
|
+
* @see {@link GroupSendCredential}
|
|
19
|
+
*/
|
|
10
20
|
class GroupSendCredentialPresentation extends ByteArray_1.default {
|
|
11
21
|
constructor(contents) {
|
|
12
22
|
super(contents, Native.GroupSendCredentialPresentation_CheckValidContents);
|
|
13
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Verifies that the credential is valid for a group containing the holder and `groupMembers`.
|
|
26
|
+
*
|
|
27
|
+
* @throws {VerificationFailedError} if the credential is not valid for any reason
|
|
28
|
+
*/
|
|
14
29
|
verify(groupMembers, serverParams, now = new Date()) {
|
|
15
30
|
Native.GroupSendCredentialPresentation_Verify(this.contents, Address_1.ServiceId.toConcatenatedFixedWidthBinary(groupMembers), Math.floor(now.getTime() / 1000), serverParams.contents);
|
|
16
31
|
}
|
|
@@ -6,11 +6,62 @@ import ServerSecretParams from '../ServerSecretParams';
|
|
|
6
6
|
import ServerPublicParams from '../ServerPublicParams';
|
|
7
7
|
import UuidCiphertext from '../groups/UuidCiphertext';
|
|
8
8
|
import { Aci, ServiceId } from '../../Address';
|
|
9
|
+
/**
|
|
10
|
+
* The issuance of a credential indicating membership in a group, based on the set of *other* users
|
|
11
|
+
* in the group with you.
|
|
12
|
+
*
|
|
13
|
+
* Follows the usual zkgroup pattern of "issue response -> receive response -> present credential ->
|
|
14
|
+
* verify presentation".
|
|
15
|
+
*
|
|
16
|
+
* @see {@link GroupSendCredential}
|
|
17
|
+
* @see {@link GroupSendCredentialPresentation}
|
|
18
|
+
*/
|
|
9
19
|
export default class GroupSendCredentialResponse extends ByteArray {
|
|
10
20
|
private readonly __type?;
|
|
11
21
|
constructor(contents: Buffer);
|
|
12
22
|
private static defaultExpiration;
|
|
23
|
+
/**
|
|
24
|
+
* Issues a new credential stating that `requestingMember` is a member of a group containing
|
|
25
|
+
* `groupMembers`.
|
|
26
|
+
*
|
|
27
|
+
* `groupMembers` should include `requestingMember` as well.
|
|
28
|
+
*/
|
|
13
29
|
static issueCredential(groupMembers: UuidCiphertext[], requestingMember: UuidCiphertext, params: ServerSecretParams): GroupSendCredentialResponse;
|
|
30
|
+
/**
|
|
31
|
+
* Issues a new credential stating that `requestingMember` is a member of a group containing
|
|
32
|
+
* `groupMembers`, with an explicity-chosen expiration and source of randomness.
|
|
33
|
+
*
|
|
34
|
+
* Should only be used for testing purposes.
|
|
35
|
+
*
|
|
36
|
+
* @see {@link GroupSendCredentialResponse#issueCredential}
|
|
37
|
+
*/
|
|
14
38
|
static issueCredentialWithExpirationAndRandom(groupMembers: UuidCiphertext[], requestingMember: UuidCiphertext, expiration: Date, params: ServerSecretParams, random: Buffer): GroupSendCredentialResponse;
|
|
39
|
+
/**
|
|
40
|
+
* Receives, validates, and extracts the credential from a response.
|
|
41
|
+
*
|
|
42
|
+
* Note that the `receive` operation is provided for both {@link ServiceId}s and
|
|
43
|
+
* {@link UuidCiphertext}s. If you already have the ciphertexts for the group members available,
|
|
44
|
+
* {@link GroupSendCredentialResponse#receiveWithCiphertexts} will be *significantly* faster; if
|
|
45
|
+
* you don't, this method is faster than generating the ciphertexts and throwing them away
|
|
46
|
+
* afterwards.
|
|
47
|
+
*
|
|
48
|
+
* `localUser` should be included in `groupMembers`.
|
|
49
|
+
*
|
|
50
|
+
* @throws {VerificationFailedError} if the credential is not valid for any reason
|
|
51
|
+
*/
|
|
15
52
|
receive(groupMembers: ServiceId[], localUser: Aci, serverParams: ServerPublicParams, groupParams: GroupSecretParams, now?: Date): GroupSendCredential;
|
|
53
|
+
/**
|
|
54
|
+
* Receives, validates, and extracts the credential from a response.
|
|
55
|
+
*
|
|
56
|
+
* Note that the `receive` operation is provided for both {@link ServiceId}s and
|
|
57
|
+
* {@link UuidCiphertext}s. If you already have the ciphertexts for the group members available,
|
|
58
|
+
* this method will be *significantly* faster; if you don't,
|
|
59
|
+
* {@link GroupSendCredentialResponse#receive} is faster than generating the ciphertexts and
|
|
60
|
+
* throwing them away afterwards.
|
|
61
|
+
*
|
|
62
|
+
* `localUser` should be included in `groupMembers`.
|
|
63
|
+
*
|
|
64
|
+
* @throws {VerificationFailedError} if the credential is not valid for any reason
|
|
65
|
+
*/
|
|
66
|
+
receiveWithCiphertexts(groupMembers: UuidCiphertext[], localUser: UuidCiphertext, serverParams: ServerPublicParams, groupParams: GroupSecretParams, now?: Date): GroupSendCredential;
|
|
16
67
|
}
|
|
@@ -9,7 +9,18 @@ const ByteArray_1 = require("../internal/ByteArray");
|
|
|
9
9
|
const Native = require("../../../Native");
|
|
10
10
|
const Constants_1 = require("../internal/Constants");
|
|
11
11
|
const GroupSendCredential_1 = require("./GroupSendCredential");
|
|
12
|
+
const UuidCiphertext_1 = require("../groups/UuidCiphertext");
|
|
12
13
|
const Address_1 = require("../../Address");
|
|
14
|
+
/**
|
|
15
|
+
* The issuance of a credential indicating membership in a group, based on the set of *other* users
|
|
16
|
+
* in the group with you.
|
|
17
|
+
*
|
|
18
|
+
* Follows the usual zkgroup pattern of "issue response -> receive response -> present credential ->
|
|
19
|
+
* verify presentation".
|
|
20
|
+
*
|
|
21
|
+
* @see {@link GroupSendCredential}
|
|
22
|
+
* @see {@link GroupSendCredentialPresentation}
|
|
23
|
+
*/
|
|
13
24
|
class GroupSendCredentialResponse extends ByteArray_1.default {
|
|
14
25
|
constructor(contents) {
|
|
15
26
|
super(contents, Native.GroupSendCredentialResponse_CheckValidContents);
|
|
@@ -18,26 +29,59 @@ class GroupSendCredentialResponse extends ByteArray_1.default {
|
|
|
18
29
|
const expirationInSeconds = Native.GroupSendCredentialResponse_DefaultExpirationBasedOnCurrentTime();
|
|
19
30
|
return new Date(expirationInSeconds * 1000);
|
|
20
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Issues a new credential stating that `requestingMember` is a member of a group containing
|
|
34
|
+
* `groupMembers`.
|
|
35
|
+
*
|
|
36
|
+
* `groupMembers` should include `requestingMember` as well.
|
|
37
|
+
*/
|
|
21
38
|
static issueCredential(groupMembers, requestingMember, params) {
|
|
22
39
|
const random = (0, crypto_1.randomBytes)(Constants_1.RANDOM_LENGTH);
|
|
23
40
|
return this.issueCredentialWithExpirationAndRandom(groupMembers, requestingMember, this.defaultExpiration(), params, random);
|
|
24
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Issues a new credential stating that `requestingMember` is a member of a group containing
|
|
44
|
+
* `groupMembers`, with an explicity-chosen expiration and source of randomness.
|
|
45
|
+
*
|
|
46
|
+
* Should only be used for testing purposes.
|
|
47
|
+
*
|
|
48
|
+
* @see {@link GroupSendCredentialResponse#issueCredential}
|
|
49
|
+
*/
|
|
25
50
|
static issueCredentialWithExpirationAndRandom(groupMembers, requestingMember, expiration, params, random) {
|
|
26
|
-
|
|
27
|
-
const concatenated = Buffer.alloc(groupMembers.length * uuidCiphertextLen);
|
|
28
|
-
let offset = 0;
|
|
29
|
-
for (const member of groupMembers) {
|
|
30
|
-
if (member.contents.length !== uuidCiphertextLen) {
|
|
31
|
-
throw TypeError('UuidCiphertext with unexpected length');
|
|
32
|
-
}
|
|
33
|
-
concatenated.set(member.contents, offset);
|
|
34
|
-
offset += uuidCiphertextLen;
|
|
35
|
-
}
|
|
36
|
-
return new GroupSendCredentialResponse(Native.GroupSendCredentialResponse_IssueDeterministic(concatenated, requestingMember.contents, Math.floor(expiration.getTime() / 1000), params.contents, random));
|
|
51
|
+
return new GroupSendCredentialResponse(Native.GroupSendCredentialResponse_IssueDeterministic(UuidCiphertext_1.default.serializeAndConcatenate(groupMembers), requestingMember.contents, Math.floor(expiration.getTime() / 1000), params.contents, random));
|
|
37
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Receives, validates, and extracts the credential from a response.
|
|
55
|
+
*
|
|
56
|
+
* Note that the `receive` operation is provided for both {@link ServiceId}s and
|
|
57
|
+
* {@link UuidCiphertext}s. If you already have the ciphertexts for the group members available,
|
|
58
|
+
* {@link GroupSendCredentialResponse#receiveWithCiphertexts} will be *significantly* faster; if
|
|
59
|
+
* you don't, this method is faster than generating the ciphertexts and throwing them away
|
|
60
|
+
* afterwards.
|
|
61
|
+
*
|
|
62
|
+
* `localUser` should be included in `groupMembers`.
|
|
63
|
+
*
|
|
64
|
+
* @throws {VerificationFailedError} if the credential is not valid for any reason
|
|
65
|
+
*/
|
|
38
66
|
receive(groupMembers, localUser, serverParams, groupParams, now = new Date()) {
|
|
39
67
|
return new GroupSendCredential_1.default(Native.GroupSendCredentialResponse_Receive(this.contents, Address_1.ServiceId.toConcatenatedFixedWidthBinary(groupMembers), localUser.getServiceIdFixedWidthBinary(), Math.floor(now.getTime() / 1000), serverParams.contents, groupParams.contents));
|
|
40
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Receives, validates, and extracts the credential from a response.
|
|
71
|
+
*
|
|
72
|
+
* Note that the `receive` operation is provided for both {@link ServiceId}s and
|
|
73
|
+
* {@link UuidCiphertext}s. If you already have the ciphertexts for the group members available,
|
|
74
|
+
* this method will be *significantly* faster; if you don't,
|
|
75
|
+
* {@link GroupSendCredentialResponse#receive} is faster than generating the ciphertexts and
|
|
76
|
+
* throwing them away afterwards.
|
|
77
|
+
*
|
|
78
|
+
* `localUser` should be included in `groupMembers`.
|
|
79
|
+
*
|
|
80
|
+
* @throws {VerificationFailedError} if the credential is not valid for any reason
|
|
81
|
+
*/
|
|
82
|
+
receiveWithCiphertexts(groupMembers, localUser, serverParams, groupParams, now = new Date()) {
|
|
83
|
+
return new GroupSendCredential_1.default(Native.GroupSendCredentialResponse_ReceiveWithCiphertexts(this.contents, UuidCiphertext_1.default.serializeAndConcatenate(groupMembers), localUser.contents, Math.floor(now.getTime() / 1000), serverParams.contents, groupParams.contents));
|
|
84
|
+
}
|
|
41
85
|
}
|
|
42
86
|
exports.default = GroupSendCredentialResponse;
|
|
43
87
|
//# sourceMappingURL=GroupSendCredentialResponse.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signalapp/libsignal-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.0",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"eslint-config-prettier": "^8.5.0",
|
|
49
49
|
"eslint-plugin-header": "^3.1.0",
|
|
50
50
|
"eslint-plugin-import": "^2.26.0",
|
|
51
|
+
"eslint-plugin-jsdoc": "^48.0.2",
|
|
51
52
|
"eslint-plugin-mocha": "^10.1.0",
|
|
52
53
|
"eslint-plugin-more": "^1.0.0",
|
|
53
54
|
"mocha": "^9",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|