New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@matter/general

Package Overview
Dependencies
Maintainers
0
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@matter/general - npm Package Compare versions

Comparing version 0.12.0-alpha.0-20250103-ba0c01a01 to 0.12.0-alpha.0-20250107-af5a068c3

52

dist/cjs/crypto/Crypto.d.ts

@@ -61,53 +61,3 @@ /**

notImplemented: () => never;
p256: Readonly<{
create: (hash: import("@noble/curves/abstract/utils").CHash) => import("@noble/curves/abstract/weierstrass").CurveFn;
CURVE: ReturnType<(curve: import("@noble/curves/abstract/weierstrass").CurveType) => Readonly<{
readonly nBitLength: number;
readonly nByteLength: number;
readonly Fp: import("@noble/curves/abstract/modular").IField<bigint>;
readonly n: bigint;
readonly h: bigint;
readonly hEff?: bigint;
readonly Gx: bigint;
readonly Gy: bigint;
readonly allowInfinityPoint?: boolean;
readonly a: bigint;
readonly b: bigint;
readonly allowedPrivateKeyLengths?: readonly number[];
readonly wrapPrivateKey?: boolean;
readonly endo?: {
beta: bigint;
splitScalar: (k: bigint) => {
k1neg: boolean;
k1: bigint;
k2neg: boolean;
k2: bigint;
};
};
readonly isTorsionFree?: ((c: import("@noble/curves/abstract/weierstrass").ProjConstructor<bigint>, point: import("@noble/curves/abstract/weierstrass").ProjPointType<bigint>) => boolean) | undefined;
readonly clearCofactor?: ((c: import("@noble/curves/abstract/weierstrass").ProjConstructor<bigint>, point: import("@noble/curves/abstract/weierstrass").ProjPointType<bigint>) => import("@noble/curves/abstract/weierstrass").ProjPointType<bigint>) | undefined;
readonly hash: import("@noble/curves/abstract/utils").CHash;
readonly hmac: (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array;
readonly randomBytes: (bytesLength?: number) => Uint8Array;
lowS: boolean;
readonly bits2int?: (bytes: Uint8Array) => bigint;
readonly bits2int_modN?: (bytes: Uint8Array) => bigint;
readonly p: bigint;
}>>;
getPublicKey: (privateKey: import("@noble/curves/abstract/utils").PrivKey, isCompressed?: boolean) => Uint8Array;
getSharedSecret: (privateA: import("@noble/curves/abstract/utils").PrivKey, publicB: import("@noble/curves/abstract/utils").Hex, isCompressed?: boolean) => Uint8Array;
sign: (msgHash: import("@noble/curves/abstract/utils").Hex, privKey: import("@noble/curves/abstract/utils").PrivKey, opts?: import("@noble/curves/abstract/weierstrass").SignOpts) => import("@noble/curves/abstract/weierstrass").RecoveredSignatureType;
verify: (signature: import("@noble/curves/abstract/utils").Hex | {
r: bigint;
s: bigint;
}, msgHash: import("@noble/curves/abstract/utils").Hex, publicKey: import("@noble/curves/abstract/utils").Hex, opts?: import("@noble/curves/abstract/weierstrass").VerOpts) => boolean;
ProjectivePoint: import("@noble/curves/abstract/weierstrass").ProjConstructor<bigint>;
Signature: import("@noble/curves/abstract/weierstrass").SignatureConstructor;
utils: {
normPrivateKeyToScalar: (key: import("@noble/curves/abstract/utils").PrivKey) => bigint;
isValidPrivateKey(privateKey: import("@noble/curves/abstract/utils").PrivKey): boolean;
randomPrivateKey: () => Uint8Array;
precompute: (windowSize?: number, point?: import("@noble/curves/abstract/weierstrass").ProjPointType<bigint>) => import("@noble/curves/abstract/weierstrass").ProjPointType<bigint>;
};
}>;
p256: import("@noble/curves/_shortw_utils").CurveFnWithCreate;
};

@@ -114,0 +64,0 @@ export declare const CRYPTO_RANDOM_LENGTH = 32;

2

dist/cjs/crypto/Spake2p.js

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

static create(context, w0) {
const random = import_Crypto.Crypto.getRandomBigInt(32, P256_CURVE.p);
const random = import_Crypto.Crypto.getRandomBigInt(32, P256_CURVE.Fp.ORDER);
return new Spake2p(context, random, w0);

@@ -66,0 +66,0 @@ }

@@ -21,3 +21,3 @@ /**

send(host: string, port: number, data: Uint8Array): Promise<void>;
close(): void;
close(): Promise<void>;
get port(): number;

@@ -24,0 +24,0 @@ supports(type: ChannelType, address?: string): boolean;

@@ -58,4 +58,4 @@ "use strict";

}
async close() {
this.server.close();
close() {
return this.server.close();
}

@@ -62,0 +62,0 @@ }

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

var import_Cache = require("../util/Cache.js");
var import_Error = require("../util/Error.js");
var import_Ip = require("../util/Ip.js");

@@ -92,3 +93,3 @@ /**

} catch (error) {
logger.info(`${netInterface} ${uniCastTarget}: ${error.message}`);
logger.info(`${netInterface} ${uniCastTarget}: ${(0, import_Error.asError)(error).message}`);
}

@@ -115,3 +116,3 @@ } else {

} catch (error) {
logger.info(`${netInterface2}: ${error.message}`);
logger.info(`${netInterface2}: ${(0, import_Error.asError)(error).message}`);
}

@@ -134,4 +135,4 @@ }),

async close() {
this.serverIpv4?.close();
this.serverIpv6.close();
await this.serverIpv4?.close();
await this.serverIpv6.close();
await this.broadcastChannels.close();

@@ -138,0 +139,0 @@ }

@@ -18,3 +18,3 @@ /**

clone(): StorageBackendMemory;
close(): void;
close(): Promise<void>;
clear(): void;

@@ -21,0 +21,0 @@ get data(): any;

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

}
close() {
async close() {
this.isInitialized = false;

@@ -63,0 +63,0 @@ }

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

} catch (e) {
error = e;
error = (0, import_Error.asError)(e);
}

@@ -409,0 +409,0 @@ if (error) {

@@ -7,2 +7,3 @@ /**

import { ClassExtends } from "./Type.js";
export declare function asError(e: any): Error;
/**

@@ -9,0 +10,0 @@ * Ensure that a cause is an error object.

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

__export(Error_exports, {
asError: () => asError,
errorOf: () => errorOf,

@@ -34,2 +35,8 @@ repackErrorAs: () => repackErrorAs

}
function asError(e) {
if (considerAsError(e)) {
return e;
}
return new Error(e?.toString() ?? "Unknown error");
}
function errorOf(cause) {

@@ -36,0 +43,0 @@ if (cause?.construction?.error) {

@@ -17,3 +17,3 @@ /**

*/
then<TResult1 = void, TResult2 = never>(onfulfilled?: ((value: unknown) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): PromiseLike<TResult1 | TResult2>;
then<TResult1 = void, TResult2 = never>(onfulfilled?: ((value: unknown) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): PromiseLike<TResult1 | TResult2>;
/**

@@ -20,0 +20,0 @@ * Enqueue additional work.

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

var import_Logger = require("../log/Logger.js");
var import_Error = require("./Error.js");
/**

@@ -86,3 +87,3 @@ * @license

} catch (e) {
reject(e);
reject((0, import_Error.asError)(e));
}

@@ -89,0 +90,0 @@ }, cancel);

@@ -102,3 +102,3 @@ /**

once(observer: Observer<T, R>): void;
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): PromiseLike<TResult1 | TResult2>;
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): PromiseLike<TResult1 | TResult2>;
[Symbol.asyncIterator](): AsyncIterator<T[0]>;

@@ -105,0 +105,0 @@ }

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

var import_disposable = require("../polyfills/disposable.js");
var import_Error = require("./Error.js");
var import_Promises = require("./Promises.js");

@@ -102,7 +103,3 @@ /**

} catch (e) {
if (e instanceof Error) {
this.#errorHandler(e, observer);
} else {
this.#errorHandler(new Error(`${e}`), observer);
}
this.#errorHandler((0, import_Error.asError)(e), observer);
}

@@ -109,0 +106,0 @@ if (this.#once?.has(observer)) {

@@ -61,7 +61,7 @@ /**

*/
catch<T, TResult = never>(producer: MaybePromise<T> | (() => MaybePromise<T>), onrejected?: ((reason: any) => MaybePromise<TResult>) | undefined | null): MaybePromise<TResult>;
catch<T, TResult = never>(producer: MaybePromise<T> | (() => MaybePromise<T>), onrejected?: ((reason: any) => MaybePromise<TResult>) | null): MaybePromise<TResult>;
/**
* Equivalent of {@link Promise.finally}.
*/
finally<T>(producer: MaybePromise<T> | (() => MaybePromise<T>), onfinally?: (() => MaybePromise<void>) | undefined | null): MaybePromise<T>;
finally<T>(producer: MaybePromise<T> | (() => MaybePromise<T>), onfinally?: (() => MaybePromise<void>) | null): MaybePromise<T>;
[Symbol.toStringTag]: string;

@@ -78,5 +78,5 @@ };

cancel(): void;
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): CancelablePromise<TResult1 | TResult2>;
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): CancelablePromise<T | TResult>;
finally(onfinally?: (() => void) | undefined | null): CancelablePromise<T>;
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): CancelablePromise<TResult1 | TResult2>;
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): CancelablePromise<T | TResult>;
finally(onfinally?: (() => void) | null): CancelablePromise<T>;
get [Symbol.toStringTag](): string;

@@ -83,0 +83,0 @@ static is<T>(value: MaybePromise<T>): value is CancelablePromise<T>;

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

module.exports = __toCommonJS(Promises_exports);
var import_Error = require("#util/Error.js");
var import_MatterError = require("../MatterError.js");

@@ -92,3 +93,11 @@ var import_Time = require("../time/Time.js");

const timeout = new Promise((resolve, reject) => {
const timer = import_Time.Time.getTimer("promise-timeout", timeoutMs, () => reject(cancelFn));
const timer = import_Time.Time.getTimer("promise-timeout", timeoutMs, () => {
try {
cancelFn();
} catch (e) {
reject((0, import_Error.asError)(e));
return;
}
reject(new Error("Timer canceled promise, but no error was thrown"));
});
cancelTimer = () => {

@@ -95,0 +104,0 @@ timer.stop();

@@ -61,53 +61,3 @@ /**

notImplemented: () => never;
p256: Readonly<{
create: (hash: import("@noble/curves/abstract/utils").CHash) => import("@noble/curves/abstract/weierstrass").CurveFn;
CURVE: ReturnType<(curve: import("@noble/curves/abstract/weierstrass").CurveType) => Readonly<{
readonly nBitLength: number;
readonly nByteLength: number;
readonly Fp: import("@noble/curves/abstract/modular").IField<bigint>;
readonly n: bigint;
readonly h: bigint;
readonly hEff?: bigint;
readonly Gx: bigint;
readonly Gy: bigint;
readonly allowInfinityPoint?: boolean;
readonly a: bigint;
readonly b: bigint;
readonly allowedPrivateKeyLengths?: readonly number[];
readonly wrapPrivateKey?: boolean;
readonly endo?: {
beta: bigint;
splitScalar: (k: bigint) => {
k1neg: boolean;
k1: bigint;
k2neg: boolean;
k2: bigint;
};
};
readonly isTorsionFree?: ((c: import("@noble/curves/abstract/weierstrass").ProjConstructor<bigint>, point: import("@noble/curves/abstract/weierstrass").ProjPointType<bigint>) => boolean) | undefined;
readonly clearCofactor?: ((c: import("@noble/curves/abstract/weierstrass").ProjConstructor<bigint>, point: import("@noble/curves/abstract/weierstrass").ProjPointType<bigint>) => import("@noble/curves/abstract/weierstrass").ProjPointType<bigint>) | undefined;
readonly hash: import("@noble/curves/abstract/utils").CHash;
readonly hmac: (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array;
readonly randomBytes: (bytesLength?: number) => Uint8Array;
lowS: boolean;
readonly bits2int?: (bytes: Uint8Array) => bigint;
readonly bits2int_modN?: (bytes: Uint8Array) => bigint;
readonly p: bigint;
}>>;
getPublicKey: (privateKey: import("@noble/curves/abstract/utils").PrivKey, isCompressed?: boolean) => Uint8Array;
getSharedSecret: (privateA: import("@noble/curves/abstract/utils").PrivKey, publicB: import("@noble/curves/abstract/utils").Hex, isCompressed?: boolean) => Uint8Array;
sign: (msgHash: import("@noble/curves/abstract/utils").Hex, privKey: import("@noble/curves/abstract/utils").PrivKey, opts?: import("@noble/curves/abstract/weierstrass").SignOpts) => import("@noble/curves/abstract/weierstrass").RecoveredSignatureType;
verify: (signature: import("@noble/curves/abstract/utils").Hex | {
r: bigint;
s: bigint;
}, msgHash: import("@noble/curves/abstract/utils").Hex, publicKey: import("@noble/curves/abstract/utils").Hex, opts?: import("@noble/curves/abstract/weierstrass").VerOpts) => boolean;
ProjectivePoint: import("@noble/curves/abstract/weierstrass").ProjConstructor<bigint>;
Signature: import("@noble/curves/abstract/weierstrass").SignatureConstructor;
utils: {
normPrivateKeyToScalar: (key: import("@noble/curves/abstract/utils").PrivKey) => bigint;
isValidPrivateKey(privateKey: import("@noble/curves/abstract/utils").PrivKey): boolean;
randomPrivateKey: () => Uint8Array;
precompute: (windowSize?: number, point?: import("@noble/curves/abstract/weierstrass").ProjPointType<bigint>) => import("@noble/curves/abstract/weierstrass").ProjPointType<bigint>;
};
}>;
p256: import("@noble/curves/_shortw_utils").CurveFnWithCreate;
};

@@ -114,0 +64,0 @@ export declare const CRYPTO_RANDOM_LENGTH = 32;

@@ -40,3 +40,3 @@ /**

static create(context, w0) {
const random = Crypto.getRandomBigInt(32, P256_CURVE.p);
const random = Crypto.getRandomBigInt(32, P256_CURVE.Fp.ORDER);
return new Spake2p(context, random, w0);

@@ -43,0 +43,0 @@ }

@@ -21,3 +21,3 @@ /**

send(host: string, port: number, data: Uint8Array): Promise<void>;
close(): void;
close(): Promise<void>;
get port(): number;

@@ -24,0 +24,0 @@ supports(type: ChannelType, address?: string): boolean;

@@ -35,4 +35,4 @@ /**

}
async close() {
this.server.close();
close() {
return this.server.close();
}

@@ -39,0 +39,0 @@ }

@@ -9,2 +9,3 @@ /**

import { Cache } from "../util/Cache.js";
import { asError } from "../util/Error.js";
import { isIPv4 } from "../util/Ip.js";

@@ -69,3 +70,3 @@ const logger = Logger.get("UdpMulticastServer");

} catch (error) {
logger.info(`${netInterface} ${uniCastTarget}: ${error.message}`);
logger.info(`${netInterface} ${uniCastTarget}: ${asError(error).message}`);
}

@@ -92,3 +93,3 @@ } else {

} catch (error) {
logger.info(`${netInterface2}: ${error.message}`);
logger.info(`${netInterface2}: ${asError(error).message}`);
}

@@ -111,4 +112,4 @@ }),

async close() {
this.serverIpv4?.close();
this.serverIpv6.close();
await this.serverIpv4?.close();
await this.serverIpv6.close();
await this.broadcastChannels.close();

@@ -115,0 +116,0 @@ }

@@ -18,3 +18,3 @@ /**

clone(): StorageBackendMemory;
close(): void;
close(): Promise<void>;
clear(): void;

@@ -21,0 +21,0 @@ get data(): any;

@@ -37,3 +37,3 @@ /**

}
close() {
async close() {
this.isInitialized = false;

@@ -40,0 +40,0 @@ }

@@ -8,3 +8,3 @@ /**

import { ImplementationError } from "../MatterError.js";
import { errorOf } from "./Error.js";
import { asError, errorOf } from "./Error.js";
import { CrashedDependenciesError, CrashedDependencyError, Lifecycle } from "./Lifecycle.js";

@@ -383,3 +383,3 @@ import { Observable } from "./Observable.js";

} catch (e) {
error = e;
error = asError(e);
}

@@ -386,0 +386,0 @@ if (error) {

@@ -7,2 +7,3 @@ /**

import { ClassExtends } from "./Type.js";
export declare function asError(e: any): Error;
/**

@@ -9,0 +10,0 @@ * Ensure that a cause is an error object.

@@ -9,2 +9,8 @@ /**

}
function asError(e) {
if (considerAsError(e)) {
return e;
}
return new Error(e?.toString() ?? "Unknown error");
}
function errorOf(cause) {

@@ -34,2 +40,3 @@ if (cause?.construction?.error) {

export {
asError,
errorOf,

@@ -36,0 +43,0 @@ repackErrorAs

@@ -17,3 +17,3 @@ /**

*/
then<TResult1 = void, TResult2 = never>(onfulfilled?: ((value: unknown) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): PromiseLike<TResult1 | TResult2>;
then<TResult1 = void, TResult2 = never>(onfulfilled?: ((value: unknown) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): PromiseLike<TResult1 | TResult2>;
/**

@@ -20,0 +20,0 @@ * Enqueue additional work.

@@ -7,2 +7,3 @@ /**

import { Logger } from "../log/Logger.js";
import { asError } from "./Error.js";
const logger = Logger.get("Mutex");

@@ -63,3 +64,3 @@ class Mutex {

} catch (e) {
reject(e);
reject(asError(e));
}

@@ -66,0 +67,0 @@ }, cancel);

@@ -102,3 +102,3 @@ /**

once(observer: Observer<T, R>): void;
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): PromiseLike<TResult1 | TResult2>;
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): PromiseLike<TResult1 | TResult2>;
[Symbol.asyncIterator](): AsyncIterator<T[0]>;

@@ -105,0 +105,0 @@ }

@@ -9,2 +9,3 @@ /**

import "../polyfills/disposable.js";
import { asError } from "./Error.js";
import { MaybePromise } from "./Promises.js";

@@ -73,7 +74,3 @@ const logger = Logger.get("Observable");

} catch (e) {
if (e instanceof Error) {
this.#errorHandler(e, observer);
} else {
this.#errorHandler(new Error(`${e}`), observer);
}
this.#errorHandler(asError(e), observer);
}

@@ -80,0 +77,0 @@ if (this.#once?.has(observer)) {

@@ -61,7 +61,7 @@ /**

*/
catch<T, TResult = never>(producer: MaybePromise<T> | (() => MaybePromise<T>), onrejected?: ((reason: any) => MaybePromise<TResult>) | undefined | null): MaybePromise<TResult>;
catch<T, TResult = never>(producer: MaybePromise<T> | (() => MaybePromise<T>), onrejected?: ((reason: any) => MaybePromise<TResult>) | null): MaybePromise<TResult>;
/**
* Equivalent of {@link Promise.finally}.
*/
finally<T>(producer: MaybePromise<T> | (() => MaybePromise<T>), onfinally?: (() => MaybePromise<void>) | undefined | null): MaybePromise<T>;
finally<T>(producer: MaybePromise<T> | (() => MaybePromise<T>), onfinally?: (() => MaybePromise<void>) | null): MaybePromise<T>;
[Symbol.toStringTag]: string;

@@ -78,5 +78,5 @@ };

cancel(): void;
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): CancelablePromise<TResult1 | TResult2>;
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): CancelablePromise<T | TResult>;
finally(onfinally?: (() => void) | undefined | null): CancelablePromise<T>;
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): CancelablePromise<TResult1 | TResult2>;
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): CancelablePromise<T | TResult>;
finally(onfinally?: (() => void) | null): CancelablePromise<T>;
get [Symbol.toStringTag](): string;

@@ -83,0 +83,0 @@ static is<T>(value: MaybePromise<T>): value is CancelablePromise<T>;

@@ -8,2 +8,3 @@ /**

*/
import { asError } from "#util/Error.js";
import { InternalError, MatterError } from "../MatterError.js";

@@ -64,3 +65,11 @@ import { Time } from "../time/Time.js";

const timeout = new Promise((resolve, reject) => {
const timer = Time.getTimer("promise-timeout", timeoutMs, () => reject(cancelFn));
const timer = Time.getTimer("promise-timeout", timeoutMs, () => {
try {
cancelFn();
} catch (e) {
reject(asError(e));
return;
}
reject(new Error("Timer canceled promise, but no error was thrown"));
});
cancelTimer = () => {

@@ -67,0 +76,0 @@ timer.stop();

{
"name": "@matter/general",
"version": "0.12.0-alpha.0-20250103-ba0c01a01",
"version": "0.12.0-alpha.0-20250107-af5a068c3",
"description": "Non-Matter support for Matter.js",

@@ -36,6 +36,6 @@ "keywords": [

"dependencies": {
"@noble/curves": "^1.7.0"
"@noble/curves": "^1.8.0"
},
"devDependencies": {
"@matter/testing": "0.12.0-alpha.0-20250103-ba0c01a01"
"@matter/testing": "0.12.0-alpha.0-20250107-af5a068c3"
},

@@ -42,0 +42,0 @@ "files": [

@@ -48,3 +48,3 @@ /**

static create(context: Uint8Array, w0: bigint) {
const random = Crypto.getRandomBigInt(32, P256_CURVE.p);
const random = Crypto.getRandomBigInt(32, P256_CURVE.Fp.ORDER);
return new Spake2p(context, random, w0);

@@ -51,0 +51,0 @@ }

@@ -27,5 +27,5 @@ /**

send(host: string, port: number, data: Uint8Array): Promise<void>;
close(): void;
close(): Promise<void>;
get port(): number;
supports(type: ChannelType, address?: string): boolean;
}

@@ -45,4 +45,4 @@ /**

async close() {
this.server.close();
close() {
return this.server.close();
}

@@ -49,0 +49,0 @@ }

@@ -10,2 +10,3 @@ /**

import { Cache } from "../util/Cache.js";
import { asError } from "../util/Error.js";
import { isIPv4 } from "../util/Ip.js";

@@ -92,3 +93,3 @@ import { Network } from "./Network.js";

} catch (error) {
logger.info(`${netInterface} ${uniCastTarget}: ${(error as Error).message}`);
logger.info(`${netInterface} ${uniCastTarget}: ${asError(error).message}`);
}

@@ -119,3 +120,3 @@ } else {

} catch (error) {
logger.info(`${netInterface}: ${(error as Error).message}`);
logger.info(`${netInterface}: ${asError(error).message}`);
}

@@ -140,6 +141,6 @@ }),

async close() {
this.serverIpv4?.close();
this.serverIpv6.close();
await this.serverIpv4?.close();
await this.serverIpv6.close();
await this.broadcastChannels.close();
}
}

@@ -47,3 +47,3 @@ /**

close() {
async close() {
this.isInitialized = false;

@@ -50,0 +50,0 @@ // nothing to do

@@ -9,3 +9,3 @@ /**

import { ImplementationError } from "../MatterError.js";
import { errorOf } from "./Error.js";
import { asError, errorOf } from "./Error.js";
import { CrashedDependenciesError, CrashedDependencyError, Lifecycle } from "./Lifecycle.js";

@@ -310,4 +310,4 @@ import { Observable } from "./Observable.js";

then<TResult1 = T, TResult2 = never>(
onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null,
onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null,
onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null,
onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null,
): Promise<TResult1 | TResult2> {

@@ -331,3 +331,3 @@ const handleRejection = onrejected ? () => onrejected?.(crashedError()) as TResult2 : undefined;

catch<TResult = never>(
onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null,
onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null,
): Promise<T | TResult> {

@@ -505,4 +505,4 @@ return this.then(undefined, onrejected);

then<TResult1 = T, TResult2 = never>(
onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null,
onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null,
onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null,
onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null,
): Promise<TResult1 | TResult2> {

@@ -519,3 +519,3 @@ let rejectionHandler: undefined | typeof onrejected;

catch<TResult = never>(
onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null,
onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null,
): Promise<T | TResult> {

@@ -543,4 +543,4 @@ return this.then(undefined, onrejected);

then<TResult1 = void, TResult2 = never>(
onfulfilled?: ((value: void) => TResult1 | PromiseLike<TResult1>) | undefined | null,
onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null,
onfulfilled?: ((value: void) => TResult1 | PromiseLike<TResult1>) | null,
onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null,
): Promise<TResult1 | TResult2> {

@@ -557,3 +557,3 @@ let rejectionHandler: undefined | typeof onrejected;

catch<TResult = never>(
onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null,
onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null,
): Promise<T | TResult> {

@@ -714,3 +714,3 @@ return this.then(undefined, onrejected);

} catch (e) {
error = e;
error = asError(e);
}

@@ -717,0 +717,0 @@ if (error) {

@@ -15,2 +15,9 @@ /**

export function asError(e: any): Error {
if (considerAsError(e)) {
return e;
}
return new Error(e?.toString() ?? "Unknown error");
}
/**

@@ -17,0 +24,0 @@ * Ensure that a cause is an error object.

@@ -120,2 +120,3 @@ /**

const _InternalError = InternalError;
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
_InternalError;

@@ -122,0 +123,0 @@

@@ -8,2 +8,3 @@ /**

import { Logger } from "../log/Logger.js";
import { asError } from "./Error.js";

@@ -34,4 +35,4 @@ const logger = Logger.get("Mutex");

then<TResult1 = void, TResult2 = never>(
onfulfilled?: ((value: unknown) => TResult1 | PromiseLike<TResult1>) | undefined | null,
onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null,
onfulfilled?: ((value: unknown) => TResult1 | PromiseLike<TResult1>) | null,
onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null,
): PromiseLike<TResult1 | TResult2> {

@@ -79,3 +80,3 @@ return (this.#promise || Promise.resolve()).then(onfulfilled, onrejected);

} catch (e) {
reject(e);
reject(asError(e));
}

@@ -82,0 +83,0 @@ }, cancel);

@@ -10,2 +10,3 @@ /**

import "../polyfills/disposable.js";
import { asError } from "./Error.js";
import { MaybePromise } from "./Promises.js";

@@ -188,7 +189,3 @@

} catch (e) {
if (e instanceof Error) {
this.#errorHandler(e, observer);
} else {
this.#errorHandler(new Error(`${e}`), observer);
}
this.#errorHandler(asError(e), observer);
}

@@ -256,4 +253,4 @@

then<TResult1 = T, TResult2 = never>(
onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null,
onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null,
onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null,
onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null,
): PromiseLike<TResult1 | TResult2> {

@@ -260,0 +257,0 @@ return new Promise<T>(resolve => {

@@ -9,2 +9,3 @@ /**

import { asError } from "#util/Error.js";
import { InternalError, MatterError } from "../MatterError.js";

@@ -59,2 +60,3 @@ import { Time } from "../time/Time.js";

if (!wasResolved && numberRejected === promises.length) {
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
reject(reason);

@@ -105,3 +107,11 @@ }

const timeout = new Promise<void>((resolve, reject) => {
const timer = Time.getTimer("promise-timeout", timeoutMs, () => reject(cancelFn));
const timer = Time.getTimer("promise-timeout", timeoutMs, () => {
try {
cancelFn();
} catch (e) {
reject(asError(e));
return;
}
reject(new Error("Timer canceled promise, but no error was thrown"));
});

@@ -213,3 +223,3 @@ cancelTimer = () => {

producer: MaybePromise<T> | (() => MaybePromise<T>),
onrejected?: ((reason: any) => MaybePromise<TResult>) | undefined | null,
onrejected?: ((reason: any) => MaybePromise<TResult>) | null,
) {

@@ -224,3 +234,3 @@ return this.then(producer, undefined, onrejected);

producer: MaybePromise<T> | (() => MaybePromise<T>),
onfinally?: (() => MaybePromise<void>) | undefined | null,
onfinally?: (() => MaybePromise<void>) | null,
): MaybePromise<T> {

@@ -311,4 +321,4 @@ let result: MaybePromise<T> | undefined;

then<TResult1 = T, TResult2 = never>(
onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null,
onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null,
onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null,
onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null,
): CancelablePromise<TResult1 | TResult2> {

@@ -321,3 +331,3 @@ const result = this.#promise.then(onfulfilled, onrejected) as CancelablePromise<TResult1 | TResult2>;

catch<TResult = never>(
onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null,
onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null,
): CancelablePromise<T | TResult> {

@@ -327,3 +337,3 @@ return this.then(onrejected);

finally(onfinally?: (() => void) | undefined | null): CancelablePromise<T> {
finally(onfinally?: (() => void) | null): CancelablePromise<T> {
const handler = (result: any) => {

@@ -330,0 +340,0 @@ onfinally?.();

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

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

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

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

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

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

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