@signalapp/libsignal-client 0.15.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 +326 -0
- package/Native.js +6 -0
- package/dist/Address.d.ts +9 -0
- package/dist/Address.js +27 -0
- package/dist/Errors.d.ts +48 -0
- package/dist/Errors.js +54 -0
- package/dist/index.d.ts +353 -0
- package/dist/index.js +948 -0
- package/dist/zkgroup/NotarySignature.d.ts +6 -0
- package/dist/zkgroup/NotarySignature.js +15 -0
- package/dist/zkgroup/ServerPublicParams.d.ts +7 -0
- package/dist/zkgroup/ServerPublicParams.js +18 -0
- package/dist/zkgroup/ServerSecretParams.d.ts +12 -0
- package/dist/zkgroup/ServerSecretParams.js +36 -0
- package/dist/zkgroup/auth/AuthCredential.d.ts +5 -0
- package/dist/zkgroup/auth/AuthCredential.js +15 -0
- package/dist/zkgroup/auth/AuthCredentialPresentation.d.ts +8 -0
- package/dist/zkgroup/auth/AuthCredentialPresentation.js +22 -0
- package/dist/zkgroup/auth/AuthCredentialResponse.d.ts +5 -0
- package/dist/zkgroup/auth/AuthCredentialResponse.js +15 -0
- package/dist/zkgroup/auth/ClientZkAuthOperations.d.ts +14 -0
- package/dist/zkgroup/auth/ClientZkAuthOperations.js +29 -0
- package/dist/zkgroup/auth/ServerZkAuthOperations.d.ts +13 -0
- package/dist/zkgroup/auth/ServerZkAuthOperations.js +28 -0
- package/dist/zkgroup/groups/ClientZkGroupCipher.d.ts +17 -0
- package/dist/zkgroup/groups/ClientZkGroupCipher.js +42 -0
- package/dist/zkgroup/groups/GroupIdentifier.d.ts +6 -0
- package/dist/zkgroup/groups/GroupIdentifier.js +15 -0
- package/dist/zkgroup/groups/GroupMasterKey.d.ts +6 -0
- package/dist/zkgroup/groups/GroupMasterKey.js +15 -0
- package/dist/zkgroup/groups/GroupPublicParams.d.ts +7 -0
- package/dist/zkgroup/groups/GroupPublicParams.js +19 -0
- package/dist/zkgroup/groups/GroupSecretParams.d.ts +12 -0
- package/dist/zkgroup/groups/GroupSecretParams.js +35 -0
- package/dist/zkgroup/groups/ProfileKeyCiphertext.d.ts +5 -0
- package/dist/zkgroup/groups/ProfileKeyCiphertext.js +15 -0
- package/dist/zkgroup/groups/UuidCiphertext.d.ts +5 -0
- package/dist/zkgroup/groups/UuidCiphertext.js +15 -0
- package/dist/zkgroup/index.d.ts +37 -0
- package/dist/zkgroup/index.js +87 -0
- package/dist/zkgroup/internal/BigIntUtil.d.ts +2 -0
- package/dist/zkgroup/internal/BigIntUtil.js +18 -0
- package/dist/zkgroup/internal/ByteArray.d.ts +8 -0
- package/dist/zkgroup/internal/ByteArray.js +28 -0
- package/dist/zkgroup/internal/Constants.d.ts +4 -0
- package/dist/zkgroup/internal/Constants.js +12 -0
- package/dist/zkgroup/internal/UUIDUtil.d.ts +4 -0
- package/dist/zkgroup/internal/UUIDUtil.js +23 -0
- package/dist/zkgroup/profiles/ClientZkProfileOperations.d.ts +27 -0
- package/dist/zkgroup/profiles/ClientZkProfileOperations.js +57 -0
- package/dist/zkgroup/profiles/PniCredential.d.ts +5 -0
- package/dist/zkgroup/profiles/PniCredential.js +15 -0
- package/dist/zkgroup/profiles/PniCredentialPresentation.d.ts +10 -0
- package/dist/zkgroup/profiles/PniCredentialPresentation.js +26 -0
- package/dist/zkgroup/profiles/PniCredentialRequestContext.d.ts +7 -0
- package/dist/zkgroup/profiles/PniCredentialRequestContext.js +19 -0
- package/dist/zkgroup/profiles/PniCredentialResponse.d.ts +5 -0
- package/dist/zkgroup/profiles/PniCredentialResponse.js +15 -0
- package/dist/zkgroup/profiles/ProfileKey.d.ts +11 -0
- package/dist/zkgroup/profiles/ProfileKey.js +25 -0
- package/dist/zkgroup/profiles/ProfileKeyCommitment.d.ts +5 -0
- package/dist/zkgroup/profiles/ProfileKeyCommitment.js +15 -0
- package/dist/zkgroup/profiles/ProfileKeyCredential.d.ts +5 -0
- package/dist/zkgroup/profiles/ProfileKeyCredential.js +15 -0
- package/dist/zkgroup/profiles/ProfileKeyCredentialPresentation.d.ts +9 -0
- package/dist/zkgroup/profiles/ProfileKeyCredentialPresentation.js +23 -0
- package/dist/zkgroup/profiles/ProfileKeyCredentialRequest.d.ts +5 -0
- package/dist/zkgroup/profiles/ProfileKeyCredentialRequest.js +15 -0
- package/dist/zkgroup/profiles/ProfileKeyCredentialRequestContext.d.ts +7 -0
- package/dist/zkgroup/profiles/ProfileKeyCredentialRequestContext.js +19 -0
- package/dist/zkgroup/profiles/ProfileKeyCredentialResponse.d.ts +5 -0
- package/dist/zkgroup/profiles/ProfileKeyCredentialResponse.js +15 -0
- package/dist/zkgroup/profiles/ProfileKeyVersion.d.ts +7 -0
- package/dist/zkgroup/profiles/ProfileKeyVersion.js +18 -0
- package/dist/zkgroup/profiles/ServerZkProfileOperations.d.ts +20 -0
- package/dist/zkgroup/profiles/ServerZkProfileOperations.js +39 -0
- package/dist/zkgroup/receipts/ClientZkReceiptOperations.d.ts +16 -0
- package/dist/zkgroup/receipts/ClientZkReceiptOperations.js +36 -0
- package/dist/zkgroup/receipts/ReceiptCredential.d.ts +7 -0
- package/dist/zkgroup/receipts/ReceiptCredential.js +21 -0
- package/dist/zkgroup/receipts/ReceiptCredentialPresentation.d.ts +10 -0
- package/dist/zkgroup/receipts/ReceiptCredentialPresentation.js +26 -0
- package/dist/zkgroup/receipts/ReceiptCredentialRequest.d.ts +5 -0
- package/dist/zkgroup/receipts/ReceiptCredentialRequest.js +15 -0
- package/dist/zkgroup/receipts/ReceiptCredentialRequestContext.d.ts +8 -0
- package/dist/zkgroup/receipts/ReceiptCredentialRequestContext.js +20 -0
- package/dist/zkgroup/receipts/ReceiptCredentialResponse.d.ts +5 -0
- package/dist/zkgroup/receipts/ReceiptCredentialResponse.js +15 -0
- package/dist/zkgroup/receipts/ReceiptSerial.d.ts +6 -0
- package/dist/zkgroup/receipts/ReceiptSerial.js +15 -0
- package/dist/zkgroup/receipts/ServerZkReceiptOperations.d.ts +12 -0
- package/dist/zkgroup/receipts/ServerZkReceiptOperations.js +28 -0
- package/package.json +57 -0
- 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/zkgroup.d.ts +7 -0
- package/zkgroup.js +7 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// Copyright 2020-2021 Signal Messenger, LLC.
|
|
4
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
5
|
+
//
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const ByteArray_1 = require("../internal/ByteArray");
|
|
8
|
+
class ProfileKeyVersion extends ByteArray_1.default {
|
|
9
|
+
constructor(contents) {
|
|
10
|
+
super(typeof contents === 'string' ? Buffer.from(contents) : contents, ProfileKeyVersion.checkLength(ProfileKeyVersion.SIZE));
|
|
11
|
+
}
|
|
12
|
+
toString() {
|
|
13
|
+
return this.contents.toString('utf8');
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.default = ProfileKeyVersion;
|
|
17
|
+
ProfileKeyVersion.SIZE = 64;
|
|
18
|
+
//# sourceMappingURL=ProfileKeyVersion.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import ServerSecretParams from '../ServerSecretParams';
|
|
3
|
+
import GroupPublicParams from '../groups/GroupPublicParams';
|
|
4
|
+
import PniCredentialPresentation from './PniCredentialPresentation';
|
|
5
|
+
import PniCredentialResponse from './PniCredentialResponse';
|
|
6
|
+
import ProfileKeyCommitment from './ProfileKeyCommitment';
|
|
7
|
+
import ProfileKeyCredentialPresentation from './ProfileKeyCredentialPresentation';
|
|
8
|
+
import ProfileKeyCredentialResponse from './ProfileKeyCredentialResponse';
|
|
9
|
+
import ProfileKeyCredentialRequest from './ProfileKeyCredentialRequest';
|
|
10
|
+
import { UUIDType } from '../internal/UUIDUtil';
|
|
11
|
+
export default class ServerZkProfileOperations {
|
|
12
|
+
serverSecretParams: ServerSecretParams;
|
|
13
|
+
constructor(serverSecretParams: ServerSecretParams);
|
|
14
|
+
issueProfileKeyCredential(profileKeyCredentialRequest: ProfileKeyCredentialRequest, uuid: UUIDType, profileKeyCommitment: ProfileKeyCommitment): ProfileKeyCredentialResponse;
|
|
15
|
+
issueProfileKeyCredentialWithRandom(random: Buffer, profileKeyCredentialRequest: ProfileKeyCredentialRequest, uuid: UUIDType, profileKeyCommitment: ProfileKeyCommitment): ProfileKeyCredentialResponse;
|
|
16
|
+
issuePniCredential(profileKeyCredentialRequest: ProfileKeyCredentialRequest, aci: UUIDType, pni: UUIDType, profileKeyCommitment: ProfileKeyCommitment): PniCredentialResponse;
|
|
17
|
+
issuePniCredentialWithRandom(random: Buffer, profileKeyCredentialRequest: ProfileKeyCredentialRequest, aci: UUIDType, pni: UUIDType, profileKeyCommitment: ProfileKeyCommitment): PniCredentialResponse;
|
|
18
|
+
verifyProfileKeyCredentialPresentation(groupPublicParams: GroupPublicParams, profileKeyCredentialPresentation: ProfileKeyCredentialPresentation): void;
|
|
19
|
+
verifyPniCredentialPresentation(groupPublicParams: GroupPublicParams, presentation: PniCredentialPresentation): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// Copyright 2020-2021 Signal Messenger, LLC.
|
|
4
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
5
|
+
//
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const crypto_1 = require("crypto");
|
|
8
|
+
const Native = require("../../../Native");
|
|
9
|
+
const Constants_1 = require("../internal/Constants");
|
|
10
|
+
const PniCredentialResponse_1 = require("./PniCredentialResponse");
|
|
11
|
+
const ProfileKeyCredentialResponse_1 = require("./ProfileKeyCredentialResponse");
|
|
12
|
+
const UUIDUtil_1 = require("../internal/UUIDUtil");
|
|
13
|
+
class ServerZkProfileOperations {
|
|
14
|
+
constructor(serverSecretParams) {
|
|
15
|
+
this.serverSecretParams = serverSecretParams;
|
|
16
|
+
}
|
|
17
|
+
issueProfileKeyCredential(profileKeyCredentialRequest, uuid, profileKeyCommitment) {
|
|
18
|
+
const random = (0, crypto_1.randomBytes)(Constants_1.RANDOM_LENGTH);
|
|
19
|
+
return this.issueProfileKeyCredentialWithRandom(random, profileKeyCredentialRequest, uuid, profileKeyCommitment);
|
|
20
|
+
}
|
|
21
|
+
issueProfileKeyCredentialWithRandom(random, profileKeyCredentialRequest, uuid, profileKeyCommitment) {
|
|
22
|
+
return new ProfileKeyCredentialResponse_1.default(Native.ServerSecretParams_IssueProfileKeyCredentialDeterministic(this.serverSecretParams.getContents(), random, profileKeyCredentialRequest.getContents(), (0, UUIDUtil_1.fromUUID)(uuid), profileKeyCommitment.getContents()));
|
|
23
|
+
}
|
|
24
|
+
issuePniCredential(profileKeyCredentialRequest, aci, pni, profileKeyCommitment) {
|
|
25
|
+
const random = (0, crypto_1.randomBytes)(Constants_1.RANDOM_LENGTH);
|
|
26
|
+
return this.issuePniCredentialWithRandom(random, profileKeyCredentialRequest, aci, pni, profileKeyCommitment);
|
|
27
|
+
}
|
|
28
|
+
issuePniCredentialWithRandom(random, profileKeyCredentialRequest, aci, pni, profileKeyCommitment) {
|
|
29
|
+
return new PniCredentialResponse_1.default(Native.ServerSecretParams_IssuePniCredentialDeterministic(this.serverSecretParams.getContents(), random, profileKeyCredentialRequest.getContents(), (0, UUIDUtil_1.fromUUID)(aci), (0, UUIDUtil_1.fromUUID)(pni), profileKeyCommitment.getContents()));
|
|
30
|
+
}
|
|
31
|
+
verifyProfileKeyCredentialPresentation(groupPublicParams, profileKeyCredentialPresentation) {
|
|
32
|
+
Native.ServerSecretParams_VerifyProfileKeyCredentialPresentation(this.serverSecretParams.getContents(), groupPublicParams.getContents(), profileKeyCredentialPresentation.getContents());
|
|
33
|
+
}
|
|
34
|
+
verifyPniCredentialPresentation(groupPublicParams, presentation) {
|
|
35
|
+
Native.ServerSecretParams_VerifyPniCredentialPresentation(this.serverSecretParams.getContents(), groupPublicParams.getContents(), presentation.getContents());
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.default = ServerZkProfileOperations;
|
|
39
|
+
//# sourceMappingURL=ServerZkProfileOperations.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import ServerPublicParams from '../ServerPublicParams';
|
|
3
|
+
import ReceiptCredential from './ReceiptCredential';
|
|
4
|
+
import ReceiptCredentialPresentation from './ReceiptCredentialPresentation';
|
|
5
|
+
import ReceiptCredentialRequestContext from './ReceiptCredentialRequestContext';
|
|
6
|
+
import ReceiptCredentialResponse from './ReceiptCredentialResponse';
|
|
7
|
+
import ReceiptSerial from './ReceiptSerial';
|
|
8
|
+
export default class ClientZkReceiptOperations {
|
|
9
|
+
serverPublicParams: ServerPublicParams;
|
|
10
|
+
constructor(serverPublicParams: ServerPublicParams);
|
|
11
|
+
createReceiptCredentialRequestContext(receiptSerial: ReceiptSerial): ReceiptCredentialRequestContext;
|
|
12
|
+
createReceiptCredentialRequestContextWithRandom(random: Buffer, receiptSerial: ReceiptSerial): ReceiptCredentialRequestContext;
|
|
13
|
+
receiveReceiptCredential(receiptCredentialRequestContext: ReceiptCredentialRequestContext, receiptCredentialResponse: ReceiptCredentialResponse): ReceiptCredential;
|
|
14
|
+
createReceiptCredentialPresentation(receiptCredential: ReceiptCredential): ReceiptCredentialPresentation;
|
|
15
|
+
createReceiptCredentialPresentationWithRandom(random: Buffer, receiptCredential: ReceiptCredential): ReceiptCredentialPresentation;
|
|
16
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// Copyright 2021 Signal Messenger, LLC.
|
|
4
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
5
|
+
//
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const crypto_1 = require("crypto");
|
|
8
|
+
const Constants_1 = require("../internal/Constants");
|
|
9
|
+
const Native = require("../../../Native");
|
|
10
|
+
const ReceiptCredential_1 = require("./ReceiptCredential");
|
|
11
|
+
const ReceiptCredentialPresentation_1 = require("./ReceiptCredentialPresentation");
|
|
12
|
+
const ReceiptCredentialRequestContext_1 = require("./ReceiptCredentialRequestContext");
|
|
13
|
+
class ClientZkReceiptOperations {
|
|
14
|
+
constructor(serverPublicParams) {
|
|
15
|
+
this.serverPublicParams = serverPublicParams;
|
|
16
|
+
}
|
|
17
|
+
createReceiptCredentialRequestContext(receiptSerial) {
|
|
18
|
+
const random = (0, crypto_1.randomBytes)(Constants_1.RANDOM_LENGTH);
|
|
19
|
+
return this.createReceiptCredentialRequestContextWithRandom(random, receiptSerial);
|
|
20
|
+
}
|
|
21
|
+
createReceiptCredentialRequestContextWithRandom(random, receiptSerial) {
|
|
22
|
+
return new ReceiptCredentialRequestContext_1.default(Native.ServerPublicParams_CreateReceiptCredentialRequestContextDeterministic(this.serverPublicParams.getContents(), random, receiptSerial.getContents()));
|
|
23
|
+
}
|
|
24
|
+
receiveReceiptCredential(receiptCredentialRequestContext, receiptCredentialResponse) {
|
|
25
|
+
return new ReceiptCredential_1.default(Native.ServerPublicParams_ReceiveReceiptCredential(this.serverPublicParams.getContents(), receiptCredentialRequestContext.getContents(), receiptCredentialResponse.getContents()));
|
|
26
|
+
}
|
|
27
|
+
createReceiptCredentialPresentation(receiptCredential) {
|
|
28
|
+
const random = (0, crypto_1.randomBytes)(Constants_1.RANDOM_LENGTH);
|
|
29
|
+
return this.createReceiptCredentialPresentationWithRandom(random, receiptCredential);
|
|
30
|
+
}
|
|
31
|
+
createReceiptCredentialPresentationWithRandom(random, receiptCredential) {
|
|
32
|
+
return new ReceiptCredentialPresentation_1.default(Native.ServerPublicParams_CreateReceiptCredentialPresentationDeterministic(this.serverPublicParams.getContents(), random, receiptCredential.getContents()));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.default = ClientZkReceiptOperations;
|
|
36
|
+
//# sourceMappingURL=ClientZkReceiptOperations.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// Copyright 2021 Signal Messenger, LLC.
|
|
4
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
5
|
+
//
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const ByteArray_1 = require("../internal/ByteArray");
|
|
8
|
+
const Native = require("../../../Native");
|
|
9
|
+
class ReceiptCredential extends ByteArray_1.default {
|
|
10
|
+
constructor(contents) {
|
|
11
|
+
super(contents, Native.ReceiptCredential_CheckValidContents);
|
|
12
|
+
}
|
|
13
|
+
getReceiptExpirationTime() {
|
|
14
|
+
return Native.ReceiptCredential_GetReceiptExpirationTime(this.contents).readBigUInt64BE();
|
|
15
|
+
}
|
|
16
|
+
getReceiptLevel() {
|
|
17
|
+
return Native.ReceiptCredential_GetReceiptLevel(this.contents).readBigUInt64BE();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.default = ReceiptCredential;
|
|
21
|
+
//# sourceMappingURL=ReceiptCredential.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import ByteArray from '../internal/ByteArray';
|
|
3
|
+
import ReceiptSerial from './ReceiptSerial';
|
|
4
|
+
export default class ReceiptCredentialPresentation extends ByteArray {
|
|
5
|
+
static SIZE: number;
|
|
6
|
+
constructor(contents: Buffer);
|
|
7
|
+
getReceiptExpirationTime(): bigint;
|
|
8
|
+
getReceiptLevel(): bigint;
|
|
9
|
+
getReceiptSerialBytes(): ReceiptSerial;
|
|
10
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// Copyright 2021 Signal Messenger, LLC.
|
|
4
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
5
|
+
//
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const ByteArray_1 = require("../internal/ByteArray");
|
|
8
|
+
const Native = require("../../../Native");
|
|
9
|
+
const ReceiptSerial_1 = require("./ReceiptSerial");
|
|
10
|
+
class ReceiptCredentialPresentation extends ByteArray_1.default {
|
|
11
|
+
constructor(contents) {
|
|
12
|
+
super(contents, Native.ReceiptCredentialPresentation_CheckValidContents);
|
|
13
|
+
}
|
|
14
|
+
getReceiptExpirationTime() {
|
|
15
|
+
return Native.ReceiptCredentialPresentation_GetReceiptExpirationTime(this.contents).readBigUInt64BE();
|
|
16
|
+
}
|
|
17
|
+
getReceiptLevel() {
|
|
18
|
+
return Native.ReceiptCredentialPresentation_GetReceiptLevel(this.contents).readBigUInt64BE();
|
|
19
|
+
}
|
|
20
|
+
getReceiptSerialBytes() {
|
|
21
|
+
return new ReceiptSerial_1.default(Native.ReceiptCredentialPresentation_GetReceiptSerial(this.contents));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.default = ReceiptCredentialPresentation;
|
|
25
|
+
ReceiptCredentialPresentation.SIZE = 329;
|
|
26
|
+
//# sourceMappingURL=ReceiptCredentialPresentation.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// Copyright 2021 Signal Messenger, LLC.
|
|
4
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
5
|
+
//
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const ByteArray_1 = require("../internal/ByteArray");
|
|
8
|
+
const Native = require("../../../Native");
|
|
9
|
+
class ReceiptCredentialRequest extends ByteArray_1.default {
|
|
10
|
+
constructor(contents) {
|
|
11
|
+
super(contents, Native.ReceiptCredentialRequest_CheckValidContents);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.default = ReceiptCredentialRequest;
|
|
15
|
+
//# sourceMappingURL=ReceiptCredentialRequest.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import ByteArray from '../internal/ByteArray';
|
|
3
|
+
import ReceiptCredentialRequest from './ReceiptCredentialRequest';
|
|
4
|
+
export default class ReceiptCredentialRequestContext extends ByteArray {
|
|
5
|
+
static SIZE: number;
|
|
6
|
+
constructor(contents: Buffer);
|
|
7
|
+
getRequest(): ReceiptCredentialRequest;
|
|
8
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// Copyright 2021 Signal Messenger, LLC.
|
|
4
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
5
|
+
//
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const ByteArray_1 = require("../internal/ByteArray");
|
|
8
|
+
const Native = require("../../../Native");
|
|
9
|
+
const ReceiptCredentialRequest_1 = require("./ReceiptCredentialRequest");
|
|
10
|
+
class ReceiptCredentialRequestContext extends ByteArray_1.default {
|
|
11
|
+
constructor(contents) {
|
|
12
|
+
super(contents, Native.ReceiptCredentialRequestContext_CheckValidContents);
|
|
13
|
+
}
|
|
14
|
+
getRequest() {
|
|
15
|
+
return new ReceiptCredentialRequest_1.default(Native.ReceiptCredentialRequestContext_GetRequest(this.contents));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.default = ReceiptCredentialRequestContext;
|
|
19
|
+
ReceiptCredentialRequestContext.SIZE = 177;
|
|
20
|
+
//# sourceMappingURL=ReceiptCredentialRequestContext.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// Copyright 2021 Signal Messenger, LLC.
|
|
4
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
5
|
+
//
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const ByteArray_1 = require("../internal/ByteArray");
|
|
8
|
+
const Native = require("../../../Native");
|
|
9
|
+
class ReceiptCredentialResponse extends ByteArray_1.default {
|
|
10
|
+
constructor(contents) {
|
|
11
|
+
super(contents, Native.ReceiptCredentialResponse_CheckValidContents);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.default = ReceiptCredentialResponse;
|
|
15
|
+
//# sourceMappingURL=ReceiptCredentialResponse.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// Copyright 2021 Signal Messenger, LLC.
|
|
4
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
5
|
+
//
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const ByteArray_1 = require("../internal/ByteArray");
|
|
8
|
+
class ReceiptSerial extends ByteArray_1.default {
|
|
9
|
+
constructor(contents) {
|
|
10
|
+
super(contents, ReceiptSerial.checkLength(ReceiptSerial.SIZE));
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.default = ReceiptSerial;
|
|
14
|
+
ReceiptSerial.SIZE = 16;
|
|
15
|
+
//# sourceMappingURL=ReceiptSerial.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import ServerSecretParams from '../ServerSecretParams';
|
|
3
|
+
import ReceiptCredentialRequest from './ReceiptCredentialRequest';
|
|
4
|
+
import ReceiptCredentialResponse from './ReceiptCredentialResponse';
|
|
5
|
+
import ReceiptCredentialPresentation from './ReceiptCredentialPresentation';
|
|
6
|
+
export default class ServerZkReceiptOperations {
|
|
7
|
+
serverSecretParams: ServerSecretParams;
|
|
8
|
+
constructor(serverSecretParams: ServerSecretParams);
|
|
9
|
+
issueReceiptCredential(receiptCredentialRequest: ReceiptCredentialRequest, receiptExpirationTime: bigint, receiptLevel: bigint): ReceiptCredentialResponse;
|
|
10
|
+
issueReceiptCredentialWithRandom(random: Buffer, receiptCredentialRequest: ReceiptCredentialRequest, receiptExpirationTime: bigint, receiptLevel: bigint): ReceiptCredentialResponse;
|
|
11
|
+
verifyReceiptCredentialPresentation(receiptCredentialPresentation: ReceiptCredentialPresentation): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// Copyright 2021 Signal Messenger, LLC.
|
|
4
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
5
|
+
//
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const crypto_1 = require("crypto");
|
|
8
|
+
const Native = require("../../../Native");
|
|
9
|
+
const Constants_1 = require("../internal/Constants");
|
|
10
|
+
const BigIntUtil_1 = require("../internal/BigIntUtil");
|
|
11
|
+
const ReceiptCredentialResponse_1 = require("./ReceiptCredentialResponse");
|
|
12
|
+
class ServerZkReceiptOperations {
|
|
13
|
+
constructor(serverSecretParams) {
|
|
14
|
+
this.serverSecretParams = serverSecretParams;
|
|
15
|
+
}
|
|
16
|
+
issueReceiptCredential(receiptCredentialRequest, receiptExpirationTime, receiptLevel) {
|
|
17
|
+
const random = (0, crypto_1.randomBytes)(Constants_1.RANDOM_LENGTH);
|
|
18
|
+
return this.issueReceiptCredentialWithRandom(random, receiptCredentialRequest, receiptExpirationTime, receiptLevel);
|
|
19
|
+
}
|
|
20
|
+
issueReceiptCredentialWithRandom(random, receiptCredentialRequest, receiptExpirationTime, receiptLevel) {
|
|
21
|
+
return new ReceiptCredentialResponse_1.default(Native.ServerSecretParams_IssueReceiptCredentialDeterministic(this.serverSecretParams.getContents(), random, receiptCredentialRequest.getContents(), (0, BigIntUtil_1.bufferFromBigUInt64BE)(receiptExpirationTime), (0, BigIntUtil_1.bufferFromBigUInt64BE)(receiptLevel)));
|
|
22
|
+
}
|
|
23
|
+
verifyReceiptCredentialPresentation(receiptCredentialPresentation) {
|
|
24
|
+
Native.ServerSecretParams_VerifyReceiptCredentialPresentation(this.serverSecretParams.getContents(), receiptCredentialPresentation.getContents());
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.default = ServerZkReceiptOperations;
|
|
28
|
+
//# sourceMappingURL=ServerZkReceiptOperations.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@signalapp/libsignal-client",
|
|
3
|
+
"version": "0.15.0",
|
|
4
|
+
"license": "AGPL-3.0-only",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist/*.js",
|
|
9
|
+
"dist/*.d.ts",
|
|
10
|
+
"dist/zkgroup/**/*.js",
|
|
11
|
+
"dist/zkgroup/**/*.d.ts",
|
|
12
|
+
"Native.js",
|
|
13
|
+
"Native.d.ts",
|
|
14
|
+
"zkgroup.js",
|
|
15
|
+
"zkgroup.d.ts",
|
|
16
|
+
"prebuilds/*/*.node"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"install": "node-gyp-build",
|
|
20
|
+
"build": "node-gyp build",
|
|
21
|
+
"tsc": "tsc -b",
|
|
22
|
+
"clean": "rimraf dist build prebuilds",
|
|
23
|
+
"test": "electron-mocha --recursive dist/test --require source-map-support/register",
|
|
24
|
+
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
|
|
25
|
+
"format": "p() { prettier ${@:- --write} '**/*.{css,js,json,md,scss,ts,tsx}'; }; p"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"node-gyp-build": "^4.2.3",
|
|
29
|
+
"uuid": "^8.3.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/bindings": "^1.3.0",
|
|
33
|
+
"@types/chai": "^4.2.15",
|
|
34
|
+
"@types/chai-as-promised": "^7.1.3",
|
|
35
|
+
"@types/mocha": "^5.2.7",
|
|
36
|
+
"@types/node": "*",
|
|
37
|
+
"@types/uuid": "^8.3.0",
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "^4.6.0",
|
|
39
|
+
"@typescript-eslint/parser": "^4.6.0",
|
|
40
|
+
"chai": "^4.2.0",
|
|
41
|
+
"chai-as-promised": "^7.1.1",
|
|
42
|
+
"electron": "13.3.0",
|
|
43
|
+
"electron-mocha": "^10.0",
|
|
44
|
+
"eslint": "^7.12.1",
|
|
45
|
+
"eslint-config-prettier": "^6.15.0",
|
|
46
|
+
"eslint-plugin-header": "^3.1.0",
|
|
47
|
+
"eslint-plugin-import": "^2.22.1",
|
|
48
|
+
"eslint-plugin-mocha": "^8.0.0",
|
|
49
|
+
"eslint-plugin-more": "^1.0.0",
|
|
50
|
+
"mocha": "*",
|
|
51
|
+
"node-gyp": "^8.4.1",
|
|
52
|
+
"prettier": "^1.19.1",
|
|
53
|
+
"rimraf": "^3.0.1",
|
|
54
|
+
"source-map-support": "^0.5.19",
|
|
55
|
+
"typescript": "4.4.2"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/zkgroup.d.ts
ADDED