@signalapp/libsignal-client
Advanced tools
Comparing version 0.21.1 to 0.22.0
@@ -11,3 +11,9 @@ import { ProtocolAddress } from './Address'; | ||
InvalidSession = 6, | ||
InvalidSenderKeySession = 7 | ||
InvalidSenderKeySession = 7, | ||
CannotBeEmpty = 8, | ||
CannotStartWithDigit = 9, | ||
MissingSeparator = 10, | ||
BadNicknameCharacter = 11, | ||
NicknameTooShort = 12, | ||
NicknameTooLong = 13 | ||
} | ||
@@ -21,30 +27,48 @@ export declare class LibSignalErrorBase extends Error { | ||
} | ||
export declare type LibSignalErrorCommon = Omit<LibSignalErrorBase, 'addr'>; | ||
export declare type GenericError = LibSignalErrorCommon & { | ||
export type LibSignalErrorCommon = Omit<LibSignalErrorBase, 'addr'>; | ||
export type GenericError = LibSignalErrorCommon & { | ||
code: ErrorCode.Generic; | ||
}; | ||
export declare type DuplicatedMessageError = LibSignalErrorCommon & { | ||
export type DuplicatedMessageError = LibSignalErrorCommon & { | ||
code: ErrorCode.DuplicatedMessage; | ||
}; | ||
export declare type SealedSenderSelfSendError = LibSignalErrorCommon & { | ||
export type SealedSenderSelfSendError = LibSignalErrorCommon & { | ||
code: ErrorCode.SealedSenderSelfSend; | ||
}; | ||
export declare type UntrustedIdentityError = LibSignalErrorCommon & { | ||
export type UntrustedIdentityError = LibSignalErrorCommon & { | ||
code: ErrorCode.UntrustedIdentity; | ||
addr: string; | ||
}; | ||
export declare type InvalidRegistrationIdError = LibSignalErrorCommon & { | ||
export type InvalidRegistrationIdError = LibSignalErrorCommon & { | ||
code: ErrorCode.InvalidRegistrationId; | ||
addr: ProtocolAddress; | ||
}; | ||
export declare type VerificationFailedError = LibSignalErrorCommon & { | ||
export type VerificationFailedError = LibSignalErrorCommon & { | ||
code: ErrorCode.VerificationFailed; | ||
}; | ||
export declare type InvalidSessionError = LibSignalErrorCommon & { | ||
export type InvalidSessionError = LibSignalErrorCommon & { | ||
code: ErrorCode.InvalidSession; | ||
}; | ||
export declare type InvalidSenderKeySessionError = LibSignalErrorCommon & { | ||
export type InvalidSenderKeySessionError = LibSignalErrorCommon & { | ||
code: ErrorCode.InvalidSenderKeySession; | ||
distributionId: string; | ||
}; | ||
export declare type LibSignalError = GenericError | DuplicatedMessageError | SealedSenderSelfSendError | UntrustedIdentityError | InvalidRegistrationIdError | VerificationFailedError | InvalidSessionError | InvalidSenderKeySessionError; | ||
export type CannotBeEmptyError = LibSignalErrorCommon & { | ||
code: ErrorCode.CannotBeEmpty; | ||
}; | ||
export type CannotStartWithDigitError = LibSignalErrorCommon & { | ||
code: ErrorCode.CannotStartWithDigit; | ||
}; | ||
export type MissingSeparatorError = LibSignalErrorCommon & { | ||
code: ErrorCode.MissingSeparator; | ||
}; | ||
export type BadNicknameCharacterError = LibSignalErrorCommon & { | ||
code: ErrorCode.BadNicknameCharacter; | ||
}; | ||
export type NicknameTooShortError = LibSignalErrorCommon & { | ||
code: ErrorCode.NicknameTooShort; | ||
}; | ||
export type NicknameTooLongError = LibSignalErrorCommon & { | ||
code: ErrorCode.NicknameTooLong; | ||
}; | ||
export type LibSignalError = GenericError | DuplicatedMessageError | SealedSenderSelfSendError | UntrustedIdentityError | InvalidRegistrationIdError | VerificationFailedError | InvalidSessionError | InvalidSenderKeySessionError | CannotBeEmptyError | CannotStartWithDigitError | MissingSeparatorError | BadNicknameCharacterError | NicknameTooShortError | NicknameTooLongError; |
@@ -19,2 +19,8 @@ "use strict"; | ||
ErrorCode[ErrorCode["InvalidSenderKeySession"] = 7] = "InvalidSenderKeySession"; | ||
ErrorCode[ErrorCode["CannotBeEmpty"] = 8] = "CannotBeEmpty"; | ||
ErrorCode[ErrorCode["CannotStartWithDigit"] = 9] = "CannotStartWithDigit"; | ||
ErrorCode[ErrorCode["MissingSeparator"] = 10] = "MissingSeparator"; | ||
ErrorCode[ErrorCode["BadNicknameCharacter"] = 11] = "BadNicknameCharacter"; | ||
ErrorCode[ErrorCode["NicknameTooShort"] = 12] = "NicknameTooShort"; | ||
ErrorCode[ErrorCode["NicknameTooLong"] = 13] = "NicknameTooLong"; | ||
})(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {})); | ||
@@ -21,0 +27,0 @@ class LibSignalErrorBase extends Error { |
@@ -5,2 +5,3 @@ /// <reference types="node" /> | ||
export * from './Address'; | ||
export * as usernames from './usernames'; | ||
import * as Native from '../Native'; | ||
@@ -22,3 +23,3 @@ export declare enum CiphertextMessageType { | ||
} | ||
export declare type Uuid = string; | ||
export type Uuid = string; | ||
export declare class HKDF { | ||
@@ -25,0 +26,0 @@ /** |
@@ -30,3 +30,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.initLogger = exports.LogLevel = exports.HsmEnclaveClient = exports.Cds2Client = exports.sealedSenderDecryptToUsmc = exports.sealedSenderDecryptMessage = exports.sealedSenderMultiRecipientMessageForSingleRecipient = exports.sealedSenderMultiRecipientEncrypt = exports.sealedSenderEncrypt = exports.sealedSenderEncryptMessage = exports.signalDecryptPreKey = exports.signalDecrypt = exports.signalEncrypt = exports.processPreKeyBundle = exports.DecryptionErrorMessage = exports.PlaintextContent = exports.CiphertextMessage = exports.SealedSenderDecryptionResult = exports.groupDecrypt = exports.groupEncrypt = exports.SenderKeyStore = exports.SignedPreKeyStore = exports.PreKeyStore = exports.IdentityKeyStore = exports.SessionStore = exports.UnidentifiedSenderMessageContent = exports.SenderKeyMessage = exports.processSenderKeyDistributionMessage = exports.SenderKeyDistributionMessage = exports.SenderCertificate = exports.SenderKeyRecord = exports.ServerCertificate = exports.SessionRecord = exports.PreKeySignalMessage = exports.SignalMessage = exports.SignedPreKeyRecord = exports.PreKeyRecord = exports.PreKeyBundle = exports.IdentityKeyPair = exports.PrivateKey = exports.PublicKey = exports.Aes256GcmSiv = exports.Fingerprint = exports.DisplayableFingerprint = exports.ScannableFingerprint = exports.hkdf = exports.HKDF = exports.ContentHint = exports.Direction = exports.CiphertextMessageType = void 0; | ||
exports.LogLevel = exports.HsmEnclaveClient = exports.Cds2Client = exports.sealedSenderDecryptToUsmc = exports.sealedSenderDecryptMessage = exports.sealedSenderMultiRecipientMessageForSingleRecipient = exports.sealedSenderMultiRecipientEncrypt = exports.sealedSenderEncrypt = exports.sealedSenderEncryptMessage = exports.signalDecryptPreKey = exports.signalDecrypt = exports.signalEncrypt = exports.processPreKeyBundle = exports.DecryptionErrorMessage = exports.PlaintextContent = exports.CiphertextMessage = exports.SealedSenderDecryptionResult = exports.groupDecrypt = exports.groupEncrypt = exports.SenderKeyStore = exports.SignedPreKeyStore = exports.PreKeyStore = exports.IdentityKeyStore = exports.SessionStore = exports.UnidentifiedSenderMessageContent = exports.SenderKeyMessage = exports.processSenderKeyDistributionMessage = exports.SenderKeyDistributionMessage = exports.SenderCertificate = exports.SenderKeyRecord = exports.ServerCertificate = exports.SessionRecord = exports.PreKeySignalMessage = exports.SignalMessage = exports.SignedPreKeyRecord = exports.PreKeyRecord = exports.PreKeyBundle = exports.IdentityKeyPair = exports.PrivateKey = exports.PublicKey = exports.Aes256GcmSiv = exports.Fingerprint = exports.DisplayableFingerprint = exports.ScannableFingerprint = exports.hkdf = exports.HKDF = exports.ContentHint = exports.Direction = exports.CiphertextMessageType = exports.usernames = void 0; | ||
exports.initLogger = void 0; | ||
const uuid = require("uuid"); | ||
@@ -37,2 +38,3 @@ const Errors = require("./Errors"); | ||
__exportStar(require("./Address"), exports); | ||
exports.usernames = require("./usernames"); | ||
const Native = require("../Native"); | ||
@@ -398,8 +400,8 @@ Native.registerErrors(Errors); | ||
class ServerCertificate { | ||
static _fromNativeHandle(nativeHandle) { | ||
return new ServerCertificate(nativeHandle); | ||
} | ||
constructor(nativeHandle) { | ||
this._nativeHandle = nativeHandle; | ||
} | ||
static _fromNativeHandle(nativeHandle) { | ||
return new ServerCertificate(nativeHandle); | ||
} | ||
static new(keyId, serverKey, trustRoot) { | ||
@@ -429,8 +431,8 @@ return new ServerCertificate(Native.ServerCertificate_New(keyId, serverKey, trustRoot)); | ||
class SenderKeyRecord { | ||
static _fromNativeHandle(nativeHandle) { | ||
return new SenderKeyRecord(nativeHandle); | ||
} | ||
constructor(nativeHandle) { | ||
this._nativeHandle = nativeHandle; | ||
} | ||
static _fromNativeHandle(nativeHandle) { | ||
return new SenderKeyRecord(nativeHandle); | ||
} | ||
static deserialize(buffer) { | ||
@@ -888,3 +890,3 @@ return new SenderKeyRecord(Native.SenderKeyRecord_Deserialize(buffer)); | ||
static new(public_key, code_hashes) { | ||
code_hashes.forEach(hash => { | ||
code_hashes.forEach((hash) => { | ||
if (hash.length != 32) { | ||
@@ -923,15 +925,15 @@ throw new Error('code hash length must be 32'); | ||
case LogLevel.Error: | ||
nativeMaxLevel = 1 /* Error */; | ||
nativeMaxLevel = 1 /* Native.LogLevel.Error */; | ||
break; | ||
case LogLevel.Warn: | ||
nativeMaxLevel = 2 /* Warn */; | ||
nativeMaxLevel = 2 /* Native.LogLevel.Warn */; | ||
break; | ||
case LogLevel.Info: | ||
nativeMaxLevel = 3 /* Info */; | ||
nativeMaxLevel = 3 /* Native.LogLevel.Info */; | ||
break; | ||
case LogLevel.Debug: | ||
nativeMaxLevel = 4 /* Debug */; | ||
nativeMaxLevel = 4 /* Native.LogLevel.Debug */; | ||
break; | ||
case LogLevel.Trace: | ||
nativeMaxLevel = 5 /* Trace */; | ||
nativeMaxLevel = 5 /* Native.LogLevel.Trace */; | ||
break; | ||
@@ -942,15 +944,15 @@ } | ||
switch (nativeLevel) { | ||
case 1 /* Error */: | ||
case 1 /* Native.LogLevel.Error */: | ||
level = LogLevel.Error; | ||
break; | ||
case 2 /* Warn */: | ||
case 2 /* Native.LogLevel.Warn */: | ||
level = LogLevel.Warn; | ||
break; | ||
case 3 /* Info */: | ||
case 3 /* Native.LogLevel.Info */: | ||
level = LogLevel.Info; | ||
break; | ||
case 4 /* Debug */: | ||
case 4 /* Native.LogLevel.Debug */: | ||
level = LogLevel.Debug; | ||
break; | ||
case 5 /* Trace */: | ||
case 5 /* Native.LogLevel.Trace */: | ||
level = LogLevel.Trace; | ||
@@ -957,0 +959,0 @@ break; |
@@ -14,5 +14,2 @@ "use strict"; | ||
class GroupSecretParams extends ByteArray_1.default { | ||
constructor(contents) { | ||
super(contents, Native.GroupSecretParams_CheckValidContents); | ||
} | ||
static generate() { | ||
@@ -28,2 +25,5 @@ const random = (0, crypto_1.randomBytes)(Constants_1.RANDOM_LENGTH); | ||
} | ||
constructor(contents) { | ||
super(contents, Native.GroupSecretParams_CheckValidContents); | ||
} | ||
getMasterKey() { | ||
@@ -30,0 +30,0 @@ return new GroupMasterKey_1.default(Native.GroupSecretParams_GetMasterKey(this.contents)); |
@@ -14,3 +14,3 @@ "use strict"; | ||
static checkLength(expectedLength) { | ||
return contents => { | ||
return (contents) => { | ||
if (contents.length !== expectedLength) { | ||
@@ -17,0 +17,0 @@ throw new Errors_1.LibSignalErrorBase(`Length of array supplied was ${contents.length} expected ${expectedLength}`, undefined, this.name); |
/// <reference types="node" /> | ||
export declare type UUIDType = string; | ||
export type UUIDType = string; | ||
export declare function toUUID(array: Buffer): UUIDType; | ||
export declare function fromUUID(uuid: UUIDType): Buffer; |
@@ -14,5 +14,2 @@ "use strict"; | ||
class ServerSecretParams extends ByteArray_1.default { | ||
constructor(contents) { | ||
super(contents, Native.ServerSecretParams_CheckValidContents); | ||
} | ||
static generate() { | ||
@@ -25,2 +22,5 @@ const random = (0, crypto_1.randomBytes)(Constants_1.RANDOM_LENGTH); | ||
} | ||
constructor(contents) { | ||
super(contents, Native.ServerSecretParams_CheckValidContents); | ||
} | ||
getPublicParams() { | ||
@@ -27,0 +27,0 @@ return new ServerPublicParams_1.default(Native.ServerSecretParams_GetPublicParams(this.contents)); |
@@ -296,2 +296,6 @@ // | ||
export function UnidentifiedSenderMessageContent_Serialize(obj: Wrapper<UnidentifiedSenderMessageContent>): Buffer; | ||
export function Username_CandidatesFrom(nickname: string, minLen: number, maxLen: number): string; | ||
export function Username_Hash(username: string): Buffer; | ||
export function Username_Proof(username: string, randomness: Buffer): Buffer; | ||
export function Username_Verify(proof: Buffer, hash: Buffer): void; | ||
export function UuidCiphertext_CheckValidContents(buffer: Buffer): void; | ||
@@ -298,0 +302,0 @@ export function initLogger(maxLevel: LogLevel, callback: (level: LogLevel, target: string, file: string | null, line: number | null, message: string) => void): void |
{ | ||
"name": "@signalapp/libsignal-client", | ||
"version": "0.21.1", | ||
"version": "0.22.0", | ||
"license": "AGPL-3.0-only", | ||
@@ -36,21 +36,21 @@ "main": "dist/index.js", | ||
"@types/mocha": "^5.2.7", | ||
"@types/node": "*", | ||
"@types/node": "16.18.3", | ||
"@types/uuid": "^8.3.0", | ||
"@typescript-eslint/eslint-plugin": "^4.6.0", | ||
"@typescript-eslint/parser": "^4.6.0", | ||
"@typescript-eslint/eslint-plugin": "^5.47.0", | ||
"@typescript-eslint/parser": "^5.47.0", | ||
"chai": "^4.2.0", | ||
"chai-as-promised": "^7.1.1", | ||
"eslint": "^7.12.1", | ||
"eslint-config-prettier": "^6.15.0", | ||
"eslint": "^8.30.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-header": "^3.1.0", | ||
"eslint-plugin-import": "^2.22.1", | ||
"eslint-plugin-mocha": "^8.0.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-plugin-mocha": "^10.1.0", | ||
"eslint-plugin-more": "^1.0.0", | ||
"mocha": "^9", | ||
"node-gyp": "^8.4.1", | ||
"prettier": "^1.19.1", | ||
"prettier": "^2.7.1", | ||
"rimraf": "^3.0.1", | ||
"source-map-support": "^0.5.19", | ||
"typescript": "4.6.2" | ||
"typescript": "4.9.3" | ||
} | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32140870
111
3478
2