Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@signalapp/libsignal-client

Package Overview
Dependencies
Maintainers
6
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@signalapp/libsignal-client - npm Package Compare versions

Comparing version 0.42.0 to 0.43.0

32

dist/Errors.d.ts

@@ -25,11 +25,14 @@ import { ProtocolAddress } from './Address';

IoError = 20,
InvalidMediaInput = 21,
UnsupportedMediaInput = 22,
InputDataTooLong = 23,
InvalidEntropyDataLength = 24,
InvalidUsernameLinkEncryptedData = 25,
RateLimitedError = 26,
SvrDataMissing = 27,
SvrRequestFailed = 28,
SvrRestoreFailed = 29
CdsiInvalidToken = 21,
InvalidUri = 22,
InvalidMediaInput = 23,
UnsupportedMediaInput = 24,
InputDataTooLong = 25,
InvalidEntropyDataLength = 26,
InvalidUsernameLinkEncryptedData = 27,
RateLimitedError = 28,
SvrDataMissing = 29,
SvrRequestFailed = 30,
SvrRestoreFailed = 31,
ChatServiceInactive = 32
}

@@ -119,2 +122,8 @@ export declare class LibSignalErrorBase extends Error {

};
export type CdsiInvalidTokenError = LibSignalErrorCommon & {
code: ErrorCode.CdsiInvalidToken;
};
export type InvalidUriError = LibSignalErrorCommon & {
code: ErrorCode.InvalidUri;
};
export type InvalidMediaInputError = LibSignalErrorCommon & {

@@ -130,2 +139,5 @@ code: ErrorCode.InvalidMediaInput;

};
export type ChatServiceInactive = LibSignalErrorBase & {
code: ErrorCode.ChatServiceInactive;
};
export type SvrDataMissingError = LibSignalErrorBase & {

@@ -140,2 +152,2 @@ code: ErrorCode.SvrDataMissing;

};
export type LibSignalError = GenericError | DuplicatedMessageError | SealedSenderSelfSendError | UntrustedIdentityError | InvalidRegistrationIdError | VerificationFailedError | InvalidSessionError | InvalidSenderKeySessionError | NicknameCannotBeEmptyError | CannotStartWithDigitError | MissingSeparatorError | BadNicknameCharacterError | NicknameTooShortError | NicknameTooLongError | DiscriminatorCannotBeEmptyError | DiscriminatorCannotBeZeroError | DiscriminatorCannotBeSingleDigitError | DiscriminatorCannotHaveLeadingZerosError | BadDiscriminatorCharacterError | DiscriminatorTooLargeError | InputDataTooLong | InvalidEntropyDataLength | InvalidUsernameLinkEncryptedData | IoError | InvalidMediaInputError | SvrDataMissingError | SvrRestoreFailedError | SvrRequestFailedError | UnsupportedMediaInputError;
export type LibSignalError = GenericError | DuplicatedMessageError | SealedSenderSelfSendError | UntrustedIdentityError | InvalidRegistrationIdError | VerificationFailedError | InvalidSessionError | InvalidSenderKeySessionError | NicknameCannotBeEmptyError | CannotStartWithDigitError | MissingSeparatorError | BadNicknameCharacterError | NicknameTooShortError | NicknameTooLongError | DiscriminatorCannotBeEmptyError | DiscriminatorCannotBeZeroError | DiscriminatorCannotBeSingleDigitError | DiscriminatorCannotHaveLeadingZerosError | BadDiscriminatorCharacterError | DiscriminatorTooLargeError | InputDataTooLong | InvalidEntropyDataLength | InvalidUsernameLinkEncryptedData | IoError | CdsiInvalidTokenError | InvalidUriError | InvalidMediaInputError | SvrDataMissingError | SvrRestoreFailedError | SvrRequestFailedError | UnsupportedMediaInputError | ChatServiceInactive;

@@ -32,11 +32,14 @@ "use strict";

ErrorCode[ErrorCode["IoError"] = 20] = "IoError";
ErrorCode[ErrorCode["InvalidMediaInput"] = 21] = "InvalidMediaInput";
ErrorCode[ErrorCode["UnsupportedMediaInput"] = 22] = "UnsupportedMediaInput";
ErrorCode[ErrorCode["InputDataTooLong"] = 23] = "InputDataTooLong";
ErrorCode[ErrorCode["InvalidEntropyDataLength"] = 24] = "InvalidEntropyDataLength";
ErrorCode[ErrorCode["InvalidUsernameLinkEncryptedData"] = 25] = "InvalidUsernameLinkEncryptedData";
ErrorCode[ErrorCode["RateLimitedError"] = 26] = "RateLimitedError";
ErrorCode[ErrorCode["SvrDataMissing"] = 27] = "SvrDataMissing";
ErrorCode[ErrorCode["SvrRequestFailed"] = 28] = "SvrRequestFailed";
ErrorCode[ErrorCode["SvrRestoreFailed"] = 29] = "SvrRestoreFailed";
ErrorCode[ErrorCode["CdsiInvalidToken"] = 21] = "CdsiInvalidToken";
ErrorCode[ErrorCode["InvalidUri"] = 22] = "InvalidUri";
ErrorCode[ErrorCode["InvalidMediaInput"] = 23] = "InvalidMediaInput";
ErrorCode[ErrorCode["UnsupportedMediaInput"] = 24] = "UnsupportedMediaInput";
ErrorCode[ErrorCode["InputDataTooLong"] = 25] = "InputDataTooLong";
ErrorCode[ErrorCode["InvalidEntropyDataLength"] = 26] = "InvalidEntropyDataLength";
ErrorCode[ErrorCode["InvalidUsernameLinkEncryptedData"] = 27] = "InvalidUsernameLinkEncryptedData";
ErrorCode[ErrorCode["RateLimitedError"] = 28] = "RateLimitedError";
ErrorCode[ErrorCode["SvrDataMissing"] = 29] = "SvrDataMissing";
ErrorCode[ErrorCode["SvrRequestFailed"] = 30] = "SvrRequestFailed";
ErrorCode[ErrorCode["SvrRestoreFailed"] = 31] = "SvrRestoreFailed";
ErrorCode[ErrorCode["ChatServiceInactive"] = 32] = "ChatServiceInactive";
})(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {}));

@@ -43,0 +46,0 @@ class LibSignalErrorBase extends Error {

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

}>;
timeout: number;
returnAcisWithoutUaks: boolean;

@@ -47,9 +46,46 @@ };

constructor(env: Environment);
/**
* Initiates termination of the underlying connection to the Chat Service. After the service is
* disconnected, it will not attempt to automatically reconnect until you call
* {@link Net#connectAuthenticatedChatService} and/or {@link Net#connectUnauthenticatedChatService}.
*
* Note: the same instance of {@code ChatService} can be reused after {@code disconnect()} was
* called.
*/
disconnectChatService(): Promise<void>;
/**
* Initiates establishing of the underlying unauthenticated connection to the Chat Service. Once
* the service is connected, all the requests will be using the established connection. Also, if
* the connection is lost for any reason other than the call to {@link #disconnect()}, an
* automatic reconnect attempt will be made.
*/
connectUnauthenticatedChatService(): Promise<Native.ChatServiceDebugInfo>;
/**
* Initiates establishing of the underlying authenticated connection to the Chat Service. Once the
* service is connected, all the requests will be using the established connection. Also, if the
* connection is lost for any reason other than the call to {@link #disconnect()}, an automatic
* reconnect attempt will be made.
*
* Calling this method will result in starting to accept incoming requests from the Chat Service.
*/
connectAuthenticatedChatService(): Promise<Native.ChatServiceDebugInfo>;
/**
* Sends request to the Chat Service over an unauthenticated channel.
*
* In addition to the response, an object containing debug information about the request flow is
* returned.
*
* @throws {ChatServiceInactive} if you haven't called {@link Net#connectUnauthenticatedChatService()}.
*/
unauthenticatedFetchAndDebug(chatRequest: ChatRequest): Promise<Native.ResponseAndDebugInfo>;
unauthenticatedFetch(chatRequest: ChatRequest): Promise<Native.Response>;
/**
* Sends request to the Chat Service over an unauthenticated channel.
*
* @throws {ChatServiceInactive} if you haven't called {@link Net#connectUnauthenticatedChatService()}.
*/
unauthenticatedFetch(chatRequest: ChatRequest): Promise<Native.ChatResponse>;
static buildHttpRequest(chatRequest: ChatRequest): {
_nativeHandle: Native.HttpRequest;
};
cdsiLookup({ username, password }: Readonly<ServiceAuth>, { e164s, acisAndAccessKeys, timeout, returnAcisWithoutUaks, }: ReadonlyDeep<CDSRequestOptionsType>): Promise<CDSResponseType<string, string>>;
cdsiLookup({ username, password }: Readonly<ServiceAuth>, { e164s, acisAndAccessKeys, returnAcisWithoutUaks, }: ReadonlyDeep<CDSRequestOptionsType>): Promise<CDSResponseType<string, string>>;
}

@@ -72,4 +108,4 @@ /**

* // Store a value in SVR3. Here 10 is the number of permitted restore attempts.
* const shareSet = await SVR3.backup(SECRET_TO_BE_STORED, PASSWORD, 10, auth, TIMEOUT);
* const restoredSecret = await SVR3.restore( PASSWORD, shareSet, auth, TIMEOUT);
* const shareSet = await SVR3.backup(SECRET_TO_BE_STORED, PASSWORD, 10, auth);
* const restoredSecret = await SVR3.restore( PASSWORD, shareSet, auth);
* ```

@@ -95,4 +131,2 @@ */

* time.
* @param opTimeoutMs - The maximum wall time libsignal is allowed to spend
* communicating with SVR3 service.
* @returns A `Promise` which--when awaited--will return a byte array with a

@@ -105,11 +139,12 @@ * serialized masked share set. It is supposed to be an opaque blob for the

*
* The returned `Promise` can also fail due to the network issues (including the
* timeout), problems establishing the Noise connection to the enclaves, or
* invalid arguments' values. {@link IoError} errors can, in general, be
* retried, although there is already a retry-with-backoff mechanism inside
* libsignal used to connect to the SVR3 servers. Other exceptions are caused
* by the bad input or data missing on the server. They are therefore
* non-actionable and are guaranteed to be thrown again when retried.
* The returned `Promise` can also fail due to the network issues (including a
* connection timeout), problems establishing the Noise connection to the
* enclaves, or invalid arguments' values. {@link IoError} errors can, in
* general, be retried, although there is already a retry-with-backoff
* mechanism inside libsignal used to connect to the SVR3 servers. Other
* exceptions are caused by the bad input or data missing on the server. They
* are therefore non-actionable and are guaranteed to be thrown again when
* retried.
*/
backup(what: Buffer, password: string, maxTries: number, auth: Readonly<ServiceAuth>, opTimeoutMs: number): Promise<Buffer>;
backup(what: Buffer, password: string, maxTries: number, auth: Readonly<ServiceAuth>): Promise<Buffer>;
/**

@@ -130,14 +165,13 @@ * Restore a secret from SVR3.

* time.
* @param opTimeoutMs - The maximum wall time libsignal is allowed to spend
* communicating with SVR3 service.
* @returns A `Promise` which--when awaited--will return a byte array with the
* restored secret.
*
* The returned `Promise` can also fail due to the network issues (including the
* timeout), problems establishing the Noise connection to the enclaves, or
* invalid arguments' values. {@link IoError} errors can, in general, be
* retried, although there is already a retry-with-backoff mechanism inside
* libsignal used to connect to the SVR3 servers. Other exceptions are caused
* by the bad input or data missing on the server. They are therefore
* non-actionable and are guaranteed to be thrown again when retried.
* The returned `Promise` can also fail due to the network issues (including
* the connection timeout), problems establishing the Noise connection to the
* enclaves, or invalid arguments' values. {@link IoError} errors can, in
* general, be retried, although there is already a retry-with-backoff
* mechanism inside libsignal used to connect to the SVR3 servers. Other
* exceptions are caused by the bad input or data missing on the server. They
* are therefore non-actionable and are guaranteed to be thrown again when
* retried.
*

@@ -153,3 +187,3 @@ * - {@link SvrDataMissingError} is returned when the maximum restore attempts

*/
restore(password: string, shareSet: Buffer, auth: Readonly<ServiceAuth>, opTimeoutMs: number): Promise<Buffer>;
restore(password: string, shareSet: Buffer, auth: Readonly<ServiceAuth>): Promise<Buffer>;
}

@@ -28,8 +28,49 @@ "use strict";

}
/**
* Initiates termination of the underlying connection to the Chat Service. After the service is
* disconnected, it will not attempt to automatically reconnect until you call
* {@link Net#connectAuthenticatedChatService} and/or {@link Net#connectUnauthenticatedChatService}.
*
* Note: the same instance of {@code ChatService} can be reused after {@code disconnect()} was
* called.
*/
async disconnectChatService() {
await Native.ChatService_disconnect(this._asyncContext, this._chatService);
}
/**
* Initiates establishing of the underlying unauthenticated connection to the Chat Service. Once
* the service is connected, all the requests will be using the established connection. Also, if
* the connection is lost for any reason other than the call to {@link #disconnect()}, an
* automatic reconnect attempt will be made.
*/
async connectUnauthenticatedChatService() {
return await Native.ChatService_connect_unauth(this._asyncContext, this._chatService);
}
/**
* Initiates establishing of the underlying authenticated connection to the Chat Service. Once the
* service is connected, all the requests will be using the established connection. Also, if the
* connection is lost for any reason other than the call to {@link #disconnect()}, an automatic
* reconnect attempt will be made.
*
* Calling this method will result in starting to accept incoming requests from the Chat Service.
*/
async connectAuthenticatedChatService() {
return await Native.ChatService_connect_auth(this._asyncContext, this._chatService);
}
/**
* Sends request to the Chat Service over an unauthenticated channel.
*
* In addition to the response, an object containing debug information about the request flow is
* returned.
*
* @throws {ChatServiceInactive} if you haven't called {@link Net#connectUnauthenticatedChatService()}.
*/
async unauthenticatedFetchAndDebug(chatRequest) {
return await Native.ChatService_unauth_send_and_debug(this._asyncContext, this._chatService, Net.buildHttpRequest(chatRequest), chatRequest.timeoutMillis ?? DEFAULT_CHAT_REQUEST_TIMEOUT_MILLIS);
}
/**
* Sends request to the Chat Service over an unauthenticated channel.
*
* @throws {ChatServiceInactive} if you haven't called {@link Net#connectUnauthenticatedChatService()}.
*/
async unauthenticatedFetch(chatRequest) {

@@ -50,3 +91,3 @@ return await Native.ChatService_unauth_send(this._asyncContext, this._chatService, Net.buildHttpRequest(chatRequest), chatRequest.timeoutMillis ?? DEFAULT_CHAT_REQUEST_TIMEOUT_MILLIS);

}
async cdsiLookup({ username, password }, { e164s, acisAndAccessKeys, timeout, returnAcisWithoutUaks, }) {
async cdsiLookup({ username, password }, { e164s, acisAndAccessKeys, returnAcisWithoutUaks, }) {
const request = { _nativeHandle: Native.LookupRequest_new() };

@@ -60,3 +101,3 @@ e164s.forEach((e164) => {

Native.LookupRequest_setReturnAcisWithoutUaks(request, returnAcisWithoutUaks);
const lookup = await Native.CdsiLookup_new(this._asyncContext, this._connectionManager, username, password, request, timeout);
const lookup = await Native.CdsiLookup_new(this._asyncContext, this._connectionManager, username, password, request);
return await Native.CdsiLookup_complete(this._asyncContext, {

@@ -73,9 +114,9 @@ _nativeHandle: lookup,

}
async backup(what, password, maxTries, auth, opTimeoutMs) {
return Native.Svr3Backup(this._asyncContext, this._connectionManager, what, password, maxTries, auth.username, auth.password, opTimeoutMs);
async backup(what, password, maxTries, auth) {
return Native.Svr3Backup(this._asyncContext, this._connectionManager, what, password, maxTries, auth.username, auth.password);
}
async restore(password, shareSet, auth, opTimeoutMs) {
return Native.Svr3Restore(this._asyncContext, this._connectionManager, password, shareSet, auth.username, auth.password, opTimeoutMs);
async restore(password, shareSet, auth) {
return Native.Svr3Restore(this._asyncContext, this._connectionManager, password, shareSet, auth.username, auth.password);
}
}
//# sourceMappingURL=net.js.map

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

contents: Buffer;
constructor(contents: Buffer, checkValid: ((contents: Buffer) => void) | typeof UNCHECKED_AND_UNCLONED);
protected constructor(contents: Buffer, checkValid: ((contents: Buffer) => void) | typeof UNCHECKED_AND_UNCLONED);
protected static checkLength(expectedLength: number): (contents: Buffer) => void;

@@ -8,0 +8,0 @@ getContents(): Buffer;

@@ -9,2 +9,3 @@ "use strict";

const Errors_1 = require("../../Errors");
const Native = require("../../../Native");
exports.UNCHECKED_AND_UNCLONED = Symbol();

@@ -17,3 +18,3 @@ class ByteArray {

else {
checkValid(contents);
checkValid.call(Native, contents);
this.contents = Buffer.from(contents);

@@ -20,0 +21,0 @@ }

@@ -24,3 +24,3 @@ //

interface Response {
interface ChatResponse {
status: number;

@@ -32,11 +32,13 @@ message: string | undefined;

interface DebugInfo {
interface ChatServiceDebugInfo {
connectionReused: boolean;
reconnectCount: number;
ipType: number;
durationMillis: number;
connectionInfo: string;
}
interface ResponseAndDebugInfo {
response: Response;
debugInfo: DebugInfo;
response: ChatResponse;
debugInfo: ChatServiceDebugInfo;
}

@@ -169,7 +171,9 @@

export function CdsiLookup_complete(asyncRuntime: Wrapper<TokioAsyncContext>, lookup: Wrapper<CdsiLookup>): Promise<LookupResponse>;
export function CdsiLookup_new(asyncRuntime: Wrapper<TokioAsyncContext>, connectionManager: Wrapper<ConnectionManager>, username: string, password: string, request: Wrapper<LookupRequest>, timeoutMillis: number): Promise<CdsiLookup>;
export function CdsiLookup_new(asyncRuntime: Wrapper<TokioAsyncContext>, connectionManager: Wrapper<ConnectionManager>, username: string, password: string, request: Wrapper<LookupRequest>): Promise<CdsiLookup>;
export function CdsiLookup_token(lookup: Wrapper<CdsiLookup>): Buffer;
export function ChatService_connect_auth(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<Chat>): Promise<ChatServiceDebugInfo>;
export function ChatService_connect_unauth(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<Chat>): Promise<ChatServiceDebugInfo>;
export function ChatService_disconnect(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<Chat>): Promise<void>;
export function ChatService_new(connectionManager: Wrapper<ConnectionManager>, username: string, password: string): Chat;
export function ChatService_unauth_send(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<Chat>, httpRequest: Wrapper<HttpRequest>, timeoutMillis: number): Promise<Response>;
export function ChatService_unauth_send(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<Chat>, httpRequest: Wrapper<HttpRequest>, timeoutMillis: number): Promise<ChatResponse>;
export function ChatService_unauth_send_and_debug(asyncRuntime: Wrapper<TokioAsyncContext>, chat: Wrapper<Chat>, httpRequest: Wrapper<HttpRequest>, timeoutMillis: number): Promise<ResponseAndDebugInfo>;

@@ -463,13 +467,15 @@ export function CiphertextMessage_FromPlaintextContent(m: Wrapper<PlaintextContent>): CiphertextMessage;

export function SignedPreKeyRecord_Serialize(obj: Wrapper<SignedPreKeyRecord>): Buffer;
export function Svr3Backup(asyncRuntime: Wrapper<TokioAsyncContext>, connectionManager: Wrapper<ConnectionManager>, secret: Buffer, password: string, maxTries: number, username: string, enclavePassword: string, opTimeoutMs: number): Promise<Buffer>;
export function Svr3Restore(asyncRuntime: Wrapper<TokioAsyncContext>, connectionManager: Wrapper<ConnectionManager>, password: string, shareSet: Buffer, username: string, enclavePassword: string, opTimeoutMs: number): Promise<Buffer>;
export function TESTING_CdsiLookupErrorConvert(): void;
export function Svr3Backup(asyncRuntime: Wrapper<TokioAsyncContext>, connectionManager: Wrapper<ConnectionManager>, secret: Buffer, password: string, maxTries: number, username: string, enclavePassword: string): Promise<Buffer>;
export function Svr3Restore(asyncRuntime: Wrapper<TokioAsyncContext>, connectionManager: Wrapper<ConnectionManager>, password: string, shareSet: Buffer, username: string, enclavePassword: string): Promise<Buffer>;
export function TESTING_CdsiLookupErrorConvert(errorDescription: string): void;
export function TESTING_CdsiLookupResponseConvert(asyncRuntime: Wrapper<TokioAsyncContext>): Promise<LookupResponse>;
export function TESTING_ChatRequestGetBody(request: Wrapper<HttpRequest>): Buffer | null;
export function TESTING_ChatRequestGetBody(request: Wrapper<HttpRequest>): Buffer;
export function TESTING_ChatRequestGetHeaderValue(request: Wrapper<HttpRequest>, headerName: string): string;
export function TESTING_ChatRequestGetMethod(request: Wrapper<HttpRequest>): string;
export function TESTING_ChatRequestGetPath(request: Wrapper<HttpRequest>): string;
export function TESTING_ChatServiceDebugInfoConvert(): DebugInfo;
export function TESTING_ChatServiceDebugInfoConvert(): ChatServiceDebugInfo;
export function TESTING_ChatServiceErrorConvert(): void;
export function TESTING_ChatServiceResponseConvert(bodyPresent: boolean): Response;
export function TESTING_ChatServiceInactiveErrorConvert(): void;
export function TESTING_ChatServiceResponseAndDebugInfoConvert(): ResponseAndDebugInfo;
export function TESTING_ChatServiceResponseConvert(bodyPresent: boolean): ChatResponse;
export function TESTING_ErrorOnBorrowAsync(_input: null): Promise<void>;

@@ -476,0 +482,0 @@ export function TESTING_ErrorOnBorrowIo(asyncRuntime: Wrapper<NonSuspendingBackgroundThreadRuntime>, _input: null): Promise<void>;

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

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc