@signalapp/libsignal-client 0.36.1 → 0.38.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/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  export * from './Errors';
3
- import { Aci, ProtocolAddress } from './Address';
3
+ import { Aci, ProtocolAddress, ServiceId } from './Address';
4
4
  export * from './Address';
5
5
  export * as usernames from './usernames';
6
6
  export * as io from './io';
@@ -387,6 +387,14 @@ export declare function signalDecrypt(message: SignalMessage, address: ProtocolA
387
387
  export declare function signalDecryptPreKey(message: PreKeySignalMessage, address: ProtocolAddress, sessionStore: SessionStore, identityStore: IdentityKeyStore, prekeyStore: PreKeyStore, signedPrekeyStore: SignedPreKeyStore, kyberPrekeyStore: KyberPreKeyStore): Promise<Buffer>;
388
388
  export declare function sealedSenderEncryptMessage(message: Buffer, address: ProtocolAddress, senderCert: SenderCertificate, sessionStore: SessionStore, identityStore: IdentityKeyStore): Promise<Buffer>;
389
389
  export declare function sealedSenderEncrypt(content: UnidentifiedSenderMessageContent, address: ProtocolAddress, identityStore: IdentityKeyStore): Promise<Buffer>;
390
+ type SealedSenderMultiRecipientEncryptOptions = {
391
+ content: UnidentifiedSenderMessageContent;
392
+ recipients: ProtocolAddress[];
393
+ excludedRecipients?: ServiceId[];
394
+ identityStore: IdentityKeyStore;
395
+ sessionStore: SessionStore;
396
+ };
397
+ export declare function sealedSenderMultiRecipientEncrypt(options: SealedSenderMultiRecipientEncryptOptions): Promise<Buffer>;
390
398
  export declare function sealedSenderMultiRecipientEncrypt(content: UnidentifiedSenderMessageContent, recipients: ProtocolAddress[], identityStore: IdentityKeyStore, sessionStore: SessionStore): Promise<Buffer>;
391
399
  export declare function sealedSenderMultiRecipientMessageForSingleRecipient(message: Buffer): Buffer;
392
400
  export declare function sealedSenderDecryptMessage(message: Buffer, trustRoot: PublicKey, timestamp: number, localE164: string | null, localUuid: string, localDeviceId: number, sessionStore: SessionStore, identityStore: IdentityKeyStore, prekeyStore: PreKeyStore, signedPrekeyStore: SignedPreKeyStore, kyberPrekeyStore: KyberPreKeyStore): Promise<SealedSenderDecryptionResult>;
package/dist/index.js CHANGED
@@ -928,9 +928,24 @@ function sealedSenderEncrypt(content, address, identityStore) {
928
928
  return Native.SealedSender_Encrypt(address, content, identityStore);
929
929
  }
930
930
  exports.sealedSenderEncrypt = sealedSenderEncrypt;
931
- async function sealedSenderMultiRecipientEncrypt(content, recipients, identityStore, sessionStore) {
931
+ async function sealedSenderMultiRecipientEncrypt(contentOrOptions, recipients, identityStore, sessionStore) {
932
+ let excludedRecipients = undefined;
933
+ if (contentOrOptions instanceof UnidentifiedSenderMessageContent) {
934
+ if (!recipients || !identityStore || !sessionStore) {
935
+ throw Error('missing arguments for sealedSenderMultiRecipientEncrypt');
936
+ }
937
+ }
938
+ else {
939
+ ({
940
+ content: contentOrOptions,
941
+ recipients,
942
+ excludedRecipients,
943
+ identityStore,
944
+ sessionStore,
945
+ } = contentOrOptions);
946
+ }
932
947
  const recipientSessions = await sessionStore.getExistingSessions(recipients);
933
- return await Native.SealedSender_MultiRecipientEncrypt(recipients, recipientSessions, content, identityStore);
948
+ return await Native.SealedSender_MultiRecipientEncrypt(recipients, recipientSessions, Address_1.ServiceId.toConcatenatedFixedWidthBinary(excludedRecipients ?? []), contentOrOptions, identityStore);
934
949
  }
935
950
  exports.sealedSenderMultiRecipientEncrypt = sealedSenderMultiRecipientEncrypt;
936
951
  // For testing only
@@ -0,0 +1,10 @@
1
+ /// <reference types="node" />
2
+ import ByteArray from '../internal/ByteArray';
3
+ import GroupSendCredentialPresentation from './GroupSendCredentialPresentation';
4
+ import ServerPublicParams from '../ServerPublicParams';
5
+ export default class GroupSendCredential extends ByteArray {
6
+ private readonly __type?;
7
+ constructor(contents: Buffer);
8
+ present(serverParams: ServerPublicParams): GroupSendCredentialPresentation;
9
+ presentWithRandom(serverParams: ServerPublicParams, random: Buffer): GroupSendCredentialPresentation;
10
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ //
3
+ // Copyright 2023 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 ByteArray_1 = require("../internal/ByteArray");
9
+ const Constants_1 = require("../internal/Constants");
10
+ const Native = require("../../../Native");
11
+ const GroupSendCredentialPresentation_1 = require("./GroupSendCredentialPresentation");
12
+ class GroupSendCredential extends ByteArray_1.default {
13
+ constructor(contents) {
14
+ super(contents, Native.GroupSendCredential_CheckValidContents);
15
+ }
16
+ present(serverParams) {
17
+ const random = (0, crypto_1.randomBytes)(Constants_1.RANDOM_LENGTH);
18
+ return this.presentWithRandom(serverParams, random);
19
+ }
20
+ presentWithRandom(serverParams, random) {
21
+ return new GroupSendCredentialPresentation_1.default(Native.GroupSendCredential_PresentDeterministic(this.contents, serverParams.contents, random));
22
+ }
23
+ }
24
+ exports.default = GroupSendCredential;
25
+ //# sourceMappingURL=GroupSendCredential.js.map
@@ -0,0 +1,9 @@
1
+ /// <reference types="node" />
2
+ import ByteArray from '../internal/ByteArray';
3
+ import ServerSecretParams from '../ServerSecretParams';
4
+ import { ServiceId } from '../../Address';
5
+ export default class GroupSendCredentialPresentation extends ByteArray {
6
+ private readonly __type?;
7
+ constructor(contents: Buffer);
8
+ verify(groupMembers: ServiceId[], serverParams: ServerSecretParams, now?: Date): void;
9
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ //
3
+ // Copyright 2023 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 Address_1 = require("../../Address");
10
+ class GroupSendCredentialPresentation extends ByteArray_1.default {
11
+ constructor(contents) {
12
+ super(contents, Native.GroupSendCredentialPresentation_CheckValidContents);
13
+ }
14
+ verify(groupMembers, serverParams, now = new Date()) {
15
+ Native.GroupSendCredentialPresentation_Verify(this.contents, Address_1.ServiceId.toConcatenatedFixedWidthBinary(groupMembers), Math.floor(now.getTime() / 1000), serverParams.contents);
16
+ }
17
+ }
18
+ exports.default = GroupSendCredentialPresentation;
19
+ //# sourceMappingURL=GroupSendCredentialPresentation.js.map
@@ -0,0 +1,16 @@
1
+ /// <reference types="node" />
2
+ import ByteArray from '../internal/ByteArray';
3
+ import GroupSendCredential from './GroupSendCredential';
4
+ import GroupSecretParams from '../groups/GroupSecretParams';
5
+ import ServerSecretParams from '../ServerSecretParams';
6
+ import ServerPublicParams from '../ServerPublicParams';
7
+ import UuidCiphertext from '../groups/UuidCiphertext';
8
+ import { Aci, ServiceId } from '../../Address';
9
+ export default class GroupSendCredentialResponse extends ByteArray {
10
+ private readonly __type?;
11
+ constructor(contents: Buffer);
12
+ private static defaultExpiration;
13
+ static issueCredential(groupMembers: UuidCiphertext[], requestingMember: UuidCiphertext, params: ServerSecretParams): GroupSendCredentialResponse;
14
+ static issueCredentialWithExpirationAndRandom(groupMembers: UuidCiphertext[], requestingMember: UuidCiphertext, expiration: Date, params: ServerSecretParams, random: Buffer): GroupSendCredentialResponse;
15
+ receive(groupMembers: ServiceId[], localUser: Aci, serverParams: ServerPublicParams, groupParams: GroupSecretParams, now?: Date): GroupSendCredential;
16
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ //
3
+ // Copyright 2023 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 ByteArray_1 = require("../internal/ByteArray");
9
+ const Native = require("../../../Native");
10
+ const Constants_1 = require("../internal/Constants");
11
+ const GroupSendCredential_1 = require("./GroupSendCredential");
12
+ const Address_1 = require("../../Address");
13
+ class GroupSendCredentialResponse extends ByteArray_1.default {
14
+ constructor(contents) {
15
+ super(contents, Native.GroupSendCredentialResponse_CheckValidContents);
16
+ }
17
+ static defaultExpiration() {
18
+ const expirationInSeconds = Native.GroupSendCredentialResponse_DefaultExpirationBasedOnCurrentTime();
19
+ return new Date(expirationInSeconds * 1000);
20
+ }
21
+ static issueCredential(groupMembers, requestingMember, params) {
22
+ const random = (0, crypto_1.randomBytes)(Constants_1.RANDOM_LENGTH);
23
+ return this.issueCredentialWithExpirationAndRandom(groupMembers, requestingMember, this.defaultExpiration(), params, random);
24
+ }
25
+ static issueCredentialWithExpirationAndRandom(groupMembers, requestingMember, expiration, params, random) {
26
+ const uuidCiphertextLen = requestingMember.contents.length;
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));
37
+ }
38
+ receive(groupMembers, localUser, serverParams, groupParams, now = new Date()) {
39
+ 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
+ }
41
+ }
42
+ exports.default = GroupSendCredentialResponse;
43
+ //# sourceMappingURL=GroupSendCredentialResponse.js.map
@@ -50,3 +50,6 @@ export { default as BackupAuthCredentialPresentation } from './backups/BackupAut
50
50
  export { default as BackupAuthCredentialRequest } from './backups/BackupAuthCredentialRequest';
51
51
  export { default as BackupAuthCredentialRequestContext } from './backups/BackupAuthCredentialRequestContext';
52
52
  export { default as BackupAuthCredentialResponse } from './backups/BackupAuthCredentialResponse';
53
+ export { default as GroupSendCredential } from './groupsend/GroupSendCredential';
54
+ export { default as GroupSendCredentialPresentation } from './groupsend/GroupSendCredentialPresentation';
55
+ export { default as GroupSendCredentialResponse } from './groupsend/GroupSendCredentialResponse';
@@ -5,7 +5,7 @@
5
5
  //
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.BackupAuthCredentialRequest = exports.BackupAuthCredentialPresentation = exports.BackupAuthCredential = exports.CreateCallLinkCredentialResponse = exports.CreateCallLinkCredentialRequestContext = exports.CreateCallLinkCredentialRequest = exports.CreateCallLinkCredentialPresentation = exports.CreateCallLinkCredential = exports.CallLinkAuthCredentialResponse = exports.CallLinkAuthCredentialPresentation = exports.CallLinkAuthCredential = exports.CallLinkSecretParams = exports.CallLinkPublicParams = exports.ReceiptSerial = exports.ReceiptCredentialResponse = exports.ReceiptCredentialRequestContext = exports.ReceiptCredentialRequest = exports.ReceiptCredentialPresentation = exports.ReceiptCredential = exports.ServerZkReceiptOperations = exports.ClientZkReceiptOperations = exports.ExpiringProfileKeyCredentialResponse = exports.ExpiringProfileKeyCredential = exports.ProfileKeyVersion = exports.ProfileKeyCredentialRequestContext = exports.ProfileKeyCredentialRequest = exports.ProfileKeyCredentialPresentation = exports.ProfileKeyCommitment = exports.ProfileKey = exports.ServerZkProfileOperations = exports.ClientZkProfileOperations = exports.UuidCiphertext = exports.ProfileKeyCiphertext = exports.GroupSecretParams = exports.GroupPublicParams = exports.GroupMasterKey = exports.GroupIdentifier = exports.ClientZkGroupCipher = exports.AuthCredentialWithPniResponse = exports.AuthCredentialWithPni = exports.AuthCredentialPresentation = exports.AuthCredentialResponse = exports.AuthCredential = exports.ServerZkAuthOperations = exports.ClientZkAuthOperations = exports.NotarySignature = exports.GenericServerSecretParams = exports.GenericServerPublicParams = exports.ServerSecretParams = exports.ServerPublicParams = void 0;
8
- exports.BackupAuthCredentialResponse = exports.BackupAuthCredentialRequestContext = void 0;
8
+ exports.GroupSendCredentialResponse = exports.GroupSendCredentialPresentation = exports.GroupSendCredential = exports.BackupAuthCredentialResponse = exports.BackupAuthCredentialRequestContext = void 0;
9
9
  // Root
10
10
  var ServerPublicParams_1 = require("./ServerPublicParams");
11
11
  Object.defineProperty(exports, "ServerPublicParams", { enumerable: true, get: function () { return ServerPublicParams_1.default; } });
@@ -117,4 +117,11 @@ var BackupAuthCredentialRequestContext_1 = require("./backups/BackupAuthCredenti
117
117
  Object.defineProperty(exports, "BackupAuthCredentialRequestContext", { enumerable: true, get: function () { return BackupAuthCredentialRequestContext_1.default; } });
118
118
  var BackupAuthCredentialResponse_1 = require("./backups/BackupAuthCredentialResponse");
119
119
  Object.defineProperty(exports, "BackupAuthCredentialResponse", { enumerable: true, get: function () { return BackupAuthCredentialResponse_1.default; } });
120
+ // Group Send
121
+ var GroupSendCredential_1 = require("./groupsend/GroupSendCredential");
122
+ Object.defineProperty(exports, "GroupSendCredential", { enumerable: true, get: function () { return GroupSendCredential_1.default; } });
123
+ var GroupSendCredentialPresentation_1 = require("./groupsend/GroupSendCredentialPresentation");
124
+ Object.defineProperty(exports, "GroupSendCredentialPresentation", { enumerable: true, get: function () { return GroupSendCredentialPresentation_1.default; } });
125
+ var GroupSendCredentialResponse_1 = require("./groupsend/GroupSendCredentialResponse");
126
+ Object.defineProperty(exports, "GroupSendCredentialResponse", { enumerable: true, get: function () { return GroupSendCredentialResponse_1.default; } });
120
127
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@signalapp/libsignal-client",
3
- "version": "0.36.1",
3
+ "version": "0.38.0",
4
4
  "license": "AGPL-3.0-only",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [
8
+ "dist/acknowledgments.md",
8
9
  "dist/*.js",
9
10
  "dist/*.d.ts",
10
11
  "dist/zkgroup/**/*.js",
@@ -22,7 +23,8 @@
22
23
  "clean": "rimraf dist build prebuilds",
23
24
  "test": "mocha --recursive dist/test --require source-map-support/register",
24
25
  "lint": "eslint . --ext .js,.jsx,.ts,.tsx",
25
- "format": "p() { prettier ${@:- --write} '**/*.{css,js,json,md,scss,ts,tsx}'; }; p"
26
+ "format": "p() { prettier ${@:- --write} '**/*.{css,js,json,md,scss,ts,tsx}'; }; p",
27
+ "prepack": "cp ../acknowledgments/acknowledgments.md dist"
26
28
  },
27
29
  "dependencies": {
28
30
  "node-gyp-build": "^4.2.3",
Binary file
Binary file
Binary file