Socket
Socket
Sign inDemoInstall

@signalapp/libsignal-client

Package Overview
Dependencies
3
Maintainers
6
Versions
50
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.39.2 to 0.39.3

9

dist/io.d.ts
/// <reference types="node" />
import * as Native from '../Native';
import type { Buffer } from 'node:buffer';
/**

@@ -16,4 +17,4 @@ * An abstract class representing an input stream of bytes.

* @param amount The amount of bytes to read.
* @return A promise yielding a {@link Buffer} containing the read bytes.
* @throws IoError If an I/O error occurred while reading from the input.
* @returns A promise yielding a {@link Buffer} containing the read bytes.
* @throws {IoError} If an I/O error occurred while reading from the input.
*/

@@ -27,6 +28,6 @@ abstract read(amount: number): Promise<Buffer>;

* @param amount The amount of bytes to skip.
* @return A promise which is resolved once the bytes have been skipped.
* @throws IoError If an I/O error occurred while skipping the bytes in the input.
* @returns A promise which is resolved once the bytes have been skipped.
* @throws {IoError} If an I/O error occurred while skipping the bytes in the input.
*/
abstract skip(amount: number): Promise<void>;
}

@@ -37,3 +37,3 @@ /// <reference types="node" />

* Get the sanitized metadata, if any.
* @return The sanitized metadata, or {@code null} if it didn't need to be sanitized.
* @returns The sanitized metadata, or {@code null} if it didn't need to be sanitized.
*/

@@ -43,3 +43,3 @@ getMetadata(): Buffer | null;

* Get the offset of the media data in the processed input.
* @return The offset of the media data in the processed input.
* @returns The offset of the media data in the processed input.
*/

@@ -49,3 +49,3 @@ getDataOffset(): bigint;

* Get the length of the media data in the processed input.
* @return The length of the media data in the processed input.
* @returns The length of the media data in the processed input.
*/

@@ -59,3 +59,3 @@ getDataLen(): bigint;

* @param length The exact length of the input stream.
* @return The sanitized metadata.
* @returns The sanitized metadata.
* @throws IoError If an IO error on the input occurs.

@@ -62,0 +62,0 @@ * @throws InvalidMediaInputError If the input could not be parsed because it was invalid.

@@ -46,3 +46,3 @@ "use strict";

* Get the sanitized metadata, if any.
* @return The sanitized metadata, or {@code null} if it didn't need to be sanitized.
* @returns The sanitized metadata, or {@code null} if it didn't need to be sanitized.
*/

@@ -58,3 +58,3 @@ getMetadata() {

* Get the offset of the media data in the processed input.
* @return The offset of the media data in the processed input.
* @returns The offset of the media data in the processed input.
*/

@@ -67,3 +67,3 @@ getDataOffset() {

* Get the length of the media data in the processed input.
* @return The length of the media data in the processed input.
* @returns The length of the media data in the processed input.
*/

@@ -81,3 +81,3 @@ getDataLen() {

* @param length The exact length of the input stream.
* @return The sanitized metadata.
* @returns The sanitized metadata.
* @throws IoError If an IO error on the input occurs.

@@ -84,0 +84,0 @@ * @throws InvalidMediaInputError If the input could not be parsed because it was invalid.

@@ -38,3 +38,3 @@ /// <reference types="node" />

*
* This is enforced to be disjoint from the recipients in {@link recipientsByServiceIdString}; it
* This is enforced to be disjoint from the recipients in {@link #recipientsByServiceIdString}; it
* may be used for authorization purposes or just to check that certain recipients were

@@ -48,3 +48,3 @@ * deliberately excluded rather than accidentally.

* `recipient` must be one of the recipients in the map returned by
* {@link recipientsByServiceIdString}. The same payload should be sent to all of the recipient's
* {@link #recipientsByServiceIdString}. The same payload should be sent to all of the recipient's
* devices.

@@ -51,0 +51,0 @@ */

@@ -33,3 +33,3 @@ "use strict";

*
* This is enforced to be disjoint from the recipients in {@link recipientsByServiceIdString}; it
* This is enforced to be disjoint from the recipients in {@link #recipientsByServiceIdString}; it
* may be used for authorization purposes or just to check that certain recipients were

@@ -45,3 +45,3 @@ * deliberately excluded rather than accidentally.

* `recipient` must be one of the recipients in the map returned by
* {@link recipientsByServiceIdString}. The same payload should be sent to all of the recipient's
* {@link #recipientsByServiceIdString}. The same payload should be sent to all of the recipient's
* devices.

@@ -48,0 +48,0 @@ */

@@ -6,2 +6,3 @@ /// <reference types="node" />

constructor(contents: Buffer);
static serializeAndConcatenate(ciphertexts: UuidCiphertext[]): Buffer;
}

@@ -13,4 +13,20 @@ "use strict";

}
static serializeAndConcatenate(ciphertexts) {
if (ciphertexts.length == 0) {
return Buffer.of();
}
const uuidCiphertextLen = ciphertexts[0].contents.length;
const concatenated = Buffer.alloc(ciphertexts.length * uuidCiphertextLen);
let offset = 0;
for (const next of ciphertexts) {
if (next.contents.length !== uuidCiphertextLen) {
throw TypeError('UuidCiphertext with unexpected length');
}
concatenated.set(next.contents, offset);
offset += uuidCiphertextLen;
}
return concatenated;
}
}
exports.default = UuidCiphertext;
//# sourceMappingURL=UuidCiphertext.js.map

@@ -5,7 +5,27 @@ /// <reference types="node" />

import ServerPublicParams from '../ServerPublicParams';
/**
* A credential indicating membership in a group, based on the set of *other* users in the
* group with you.
*
* Follows the usual zkgroup pattern of "issue response -> receive response -> present credential
* -> verify presentation".
*
* @see {@link GroupSendCredentialResponse}
* @see {@link GroupSendCredentialPresentation}
*/
export default class GroupSendCredential extends ByteArray {
private readonly __type?;
constructor(contents: Buffer);
/**
* Generates a new presentation, so that multiple uses of this credential are harder to link.
*/
present(serverParams: ServerPublicParams): GroupSendCredentialPresentation;
/**
* Generates a new presentation with a dedicated source of randomness.
*
* Should only be used for testing purposes.
*
* @see {@link GroupSendCredential#present}
*/
presentWithRandom(serverParams: ServerPublicParams, random: Buffer): GroupSendCredentialPresentation;
}

@@ -12,2 +12,12 @@ "use strict";

const GroupSendCredentialPresentation_1 = require("./GroupSendCredentialPresentation");
/**
* A credential indicating membership in a group, based on the set of *other* users in the
* group with you.
*
* Follows the usual zkgroup pattern of "issue response -> receive response -> present credential
* -> verify presentation".
*
* @see {@link GroupSendCredentialResponse}
* @see {@link GroupSendCredentialPresentation}
*/
class GroupSendCredential extends ByteArray_1.default {

@@ -17,2 +27,5 @@ constructor(contents) {

}
/**
* Generates a new presentation, so that multiple uses of this credential are harder to link.
*/
present(serverParams) {

@@ -22,2 +35,9 @@ const random = (0, crypto_1.randomBytes)(Constants_1.RANDOM_LENGTH);

}
/**
* Generates a new presentation with a dedicated source of randomness.
*
* Should only be used for testing purposes.
*
* @see {@link GroupSendCredential#present}
*/
presentWithRandom(serverParams, random) {

@@ -24,0 +44,0 @@ return new GroupSendCredentialPresentation_1.default(Native.GroupSendCredential_PresentDeterministic(this.contents, serverParams.contents, random));

@@ -5,6 +5,21 @@ /// <reference types="node" />

import { ServiceId } from '../../Address';
/**
* A credential presentation indicating membership in a group, based on the set of *other* users in
* the group with you.
*
* Follows the usual zkgroup pattern of "issue response -> receive response -> present credential ->
* verify presentation".
*
* @see {@link GroupSendCredentialResponse}
* @see {@link GroupSendCredential}
*/
export default class GroupSendCredentialPresentation extends ByteArray {
private readonly __type?;
constructor(contents: Buffer);
/**
* Verifies that the credential is valid for a group containing the holder and `groupMembers`.
*
* @throws {VerificationFailedError} if the credential is not valid for any reason
*/
verify(groupMembers: ServiceId[], serverParams: ServerSecretParams, now?: Date): void;
}

@@ -10,2 +10,12 @@ "use strict";

const Address_1 = require("../../Address");
/**
* A credential presentation indicating membership in a group, based on the set of *other* users in
* the group with you.
*
* Follows the usual zkgroup pattern of "issue response -> receive response -> present credential ->
* verify presentation".
*
* @see {@link GroupSendCredentialResponse}
* @see {@link GroupSendCredential}
*/
class GroupSendCredentialPresentation extends ByteArray_1.default {

@@ -15,2 +25,7 @@ constructor(contents) {

}
/**
* Verifies that the credential is valid for a group containing the holder and `groupMembers`.
*
* @throws {VerificationFailedError} if the credential is not valid for any reason
*/
verify(groupMembers, serverParams, now = new Date()) {

@@ -17,0 +32,0 @@ Native.GroupSendCredentialPresentation_Verify(this.contents, Address_1.ServiceId.toConcatenatedFixedWidthBinary(groupMembers), Math.floor(now.getTime() / 1000), serverParams.contents);

@@ -9,2 +9,12 @@ /// <reference types="node" />

import { Aci, ServiceId } from '../../Address';
/**
* The issuance of a credential indicating membership in a group, based on the set of *other* users
* in the group with you.
*
* Follows the usual zkgroup pattern of "issue response -> receive response -> present credential ->
* verify presentation".
*
* @see {@link GroupSendCredential}
* @see {@link GroupSendCredentialPresentation}
*/
export default class GroupSendCredentialResponse extends ByteArray {

@@ -14,5 +24,46 @@ private readonly __type?;

private static defaultExpiration;
/**
* Issues a new credential stating that `requestingMember` is a member of a group containing
* `groupMembers`.
*
* `groupMembers` should include `requestingMember` as well.
*/
static issueCredential(groupMembers: UuidCiphertext[], requestingMember: UuidCiphertext, params: ServerSecretParams): GroupSendCredentialResponse;
/**
* Issues a new credential stating that `requestingMember` is a member of a group containing
* `groupMembers`, with an explicity-chosen expiration and source of randomness.
*
* Should only be used for testing purposes.
*
* @see {@link GroupSendCredentialResponse#issueCredential}
*/
static issueCredentialWithExpirationAndRandom(groupMembers: UuidCiphertext[], requestingMember: UuidCiphertext, expiration: Date, params: ServerSecretParams, random: Buffer): GroupSendCredentialResponse;
/**
* Receives, validates, and extracts the credential from a response.
*
* Note that the `receive` operation is provided for both {@link ServiceId}s and
* {@link UuidCiphertext}s. If you already have the ciphertexts for the group members available,
* {@link GroupSendCredentialResponse#receiveWithCiphertexts} will be *significantly* faster; if
* you don't, this method is faster than generating the ciphertexts and throwing them away
* afterwards.
*
* `localUser` should be included in `groupMembers`.
*
* @throws {VerificationFailedError} if the credential is not valid for any reason
*/
receive(groupMembers: ServiceId[], localUser: Aci, serverParams: ServerPublicParams, groupParams: GroupSecretParams, now?: Date): GroupSendCredential;
/**
* Receives, validates, and extracts the credential from a response.
*
* Note that the `receive` operation is provided for both {@link ServiceId}s and
* {@link UuidCiphertext}s. If you already have the ciphertexts for the group members available,
* this method will be *significantly* faster; if you don't,
* {@link GroupSendCredentialResponse#receive} is faster than generating the ciphertexts and
* throwing them away afterwards.
*
* `localUser` should be included in `groupMembers`.
*
* @throws {VerificationFailedError} if the credential is not valid for any reason
*/
receiveWithCiphertexts(groupMembers: UuidCiphertext[], localUser: UuidCiphertext, serverParams: ServerPublicParams, groupParams: GroupSecretParams, now?: Date): GroupSendCredential;
}

@@ -12,3 +12,14 @@ "use strict";

const GroupSendCredential_1 = require("./GroupSendCredential");
const UuidCiphertext_1 = require("../groups/UuidCiphertext");
const Address_1 = require("../../Address");
/**
* The issuance of a credential indicating membership in a group, based on the set of *other* users
* in the group with you.
*
* Follows the usual zkgroup pattern of "issue response -> receive response -> present credential ->
* verify presentation".
*
* @see {@link GroupSendCredential}
* @see {@link GroupSendCredentialPresentation}
*/
class GroupSendCredentialResponse extends ByteArray_1.default {

@@ -22,2 +33,8 @@ constructor(contents) {

}
/**
* Issues a new credential stating that `requestingMember` is a member of a group containing
* `groupMembers`.
*
* `groupMembers` should include `requestingMember` as well.
*/
static issueCredential(groupMembers, requestingMember, params) {

@@ -27,20 +44,47 @@ const random = (0, crypto_1.randomBytes)(Constants_1.RANDOM_LENGTH);

}
/**
* Issues a new credential stating that `requestingMember` is a member of a group containing
* `groupMembers`, with an explicity-chosen expiration and source of randomness.
*
* Should only be used for testing purposes.
*
* @see {@link GroupSendCredentialResponse#issueCredential}
*/
static issueCredentialWithExpirationAndRandom(groupMembers, requestingMember, expiration, params, random) {
const uuidCiphertextLen = requestingMember.contents.length;
const concatenated = Buffer.alloc(groupMembers.length * uuidCiphertextLen);
let offset = 0;
for (const member of groupMembers) {
if (member.contents.length !== uuidCiphertextLen) {
throw TypeError('UuidCiphertext with unexpected length');
}
concatenated.set(member.contents, offset);
offset += uuidCiphertextLen;
}
return new GroupSendCredentialResponse(Native.GroupSendCredentialResponse_IssueDeterministic(concatenated, requestingMember.contents, Math.floor(expiration.getTime() / 1000), params.contents, random));
return new GroupSendCredentialResponse(Native.GroupSendCredentialResponse_IssueDeterministic(UuidCiphertext_1.default.serializeAndConcatenate(groupMembers), requestingMember.contents, Math.floor(expiration.getTime() / 1000), params.contents, random));
}
/**
* Receives, validates, and extracts the credential from a response.
*
* Note that the `receive` operation is provided for both {@link ServiceId}s and
* {@link UuidCiphertext}s. If you already have the ciphertexts for the group members available,
* {@link GroupSendCredentialResponse#receiveWithCiphertexts} will be *significantly* faster; if
* you don't, this method is faster than generating the ciphertexts and throwing them away
* afterwards.
*
* `localUser` should be included in `groupMembers`.
*
* @throws {VerificationFailedError} if the credential is not valid for any reason
*/
receive(groupMembers, localUser, serverParams, groupParams, now = new Date()) {
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));
}
/**
* Receives, validates, and extracts the credential from a response.
*
* Note that the `receive` operation is provided for both {@link ServiceId}s and
* {@link UuidCiphertext}s. If you already have the ciphertexts for the group members available,
* this method will be *significantly* faster; if you don't,
* {@link GroupSendCredentialResponse#receive} is faster than generating the ciphertexts and
* throwing them away afterwards.
*
* `localUser` should be included in `groupMembers`.
*
* @throws {VerificationFailedError} if the credential is not valid for any reason
*/
receiveWithCiphertexts(groupMembers, localUser, serverParams, groupParams, now = new Date()) {
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));
}
}
exports.default = GroupSendCredentialResponse;
//# sourceMappingURL=GroupSendCredentialResponse.js.map

@@ -199,2 +199,3 @@ //

export function GroupSendCredentialResponse_Receive(responseBytes: Buffer, groupMembers: Buffer, localAci: Buffer, now: Timestamp, serverParams: Serialized<ServerPublicParams>, groupParams: Serialized<GroupSecretParams>): Buffer;
export function GroupSendCredentialResponse_ReceiveWithCiphertexts(responseBytes: Buffer, concatenatedGroupMemberCiphertexts: Buffer, requester: Serialized<UuidCiphertext>, now: Timestamp, serverParams: Serialized<ServerPublicParams>, groupParams: Serialized<GroupSecretParams>): Buffer;
export function GroupSendCredential_CheckValidContents(paramsBytes: Buffer): void;

@@ -201,0 +202,0 @@ export function GroupSendCredential_PresentDeterministic(credentialBytes: Buffer, serverParams: Serialized<ServerPublicParams>, randomness: Buffer): Buffer;

{
"name": "@signalapp/libsignal-client",
"version": "0.39.2",
"version": "0.39.3",
"license": "AGPL-3.0-only",

@@ -51,2 +51,3 @@ "main": "dist/index.js",

"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsdoc": "^48.0.2",
"eslint-plugin-mocha": "^10.1.0",

@@ -53,0 +54,0 @@ "eslint-plugin-more": "^1.0.0",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc