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

@signalapp/mock-server

Package Overview
Dependencies
Maintainers
6
Versions
115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@signalapp/mock-server - npm Package Compare versions

Comparing version 6.11.0 to 7.0.1

2

package.json
{
"name": "@signalapp/mock-server",
"version": "6.11.0",
"version": "7.0.1",
"description": "Mock Signal Server for writing tests",

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

@@ -13,7 +13,7 @@ import z from 'zod';

}, "strip", z.ZodTypeAny, {
publicKey: string;
keyId: number;
}, {
publicKey: string;
}, {
keyId: number;
publicKey: string;
}>;

@@ -26,8 +26,8 @@ export type ServerPreKey = z.infer<typeof PreKeySchema>;

}, "strip", z.ZodTypeAny, {
publicKey: string;
keyId: number;
publicKey: string;
signature: string;
}, {
publicKey: string;
keyId: number;
publicKey: string;
signature: string;

@@ -41,7 +41,7 @@ }>;

}, "strip", z.ZodTypeAny, {
publicKey: string;
keyId: number;
}, {
publicKey: string;
}, {
keyId: number;
publicKey: string;
}>, "many">;

@@ -53,8 +53,8 @@ pqPreKeys: z.ZodOptional<z.ZodArray<z.ZodObject<{

}, "strip", z.ZodTypeAny, {
publicKey: string;
keyId: number;
publicKey: string;
signature: string;
}, {
publicKey: string;
keyId: number;
publicKey: string;
signature: string;

@@ -67,8 +67,8 @@ }>, "many">>;

}, "strip", z.ZodTypeAny, {
publicKey: string;
keyId: number;
publicKey: string;
signature: string;
}, {
publicKey: string;
keyId: number;
publicKey: string;
signature: string;

@@ -81,8 +81,8 @@ }>>;

}, "strip", z.ZodTypeAny, {
publicKey: string;
keyId: number;
publicKey: string;
signature: string;
}, {
publicKey: string;
keyId: number;
publicKey: string;
signature: string;

@@ -92,18 +92,18 @@ }>>;

preKeys: {
publicKey: string;
keyId: number;
publicKey: string;
}[];
pqPreKeys?: {
publicKey: string;
keyId: number;
publicKey: string;
signature: string;
}[] | undefined;
pqLastResortPreKey?: {
publicKey: string;
keyId: number;
publicKey: string;
signature: string;
} | undefined;
signedPreKey?: {
publicKey: string;
keyId: number;
publicKey: string;
signature: string;

@@ -113,18 +113,18 @@ } | undefined;

preKeys: {
publicKey: string;
keyId: number;
publicKey: string;
}[];
pqPreKeys?: {
publicKey: string;
keyId: number;
publicKey: string;
signature: string;
}[] | undefined;
pqLastResortPreKey?: {
publicKey: string;
keyId: number;
publicKey: string;
signature: string;
} | undefined;
signedPreKey?: {
publicKey: string;
keyId: number;
publicKey: string;
signature: string;

@@ -207,3 +207,2 @@ } | undefined;

}, "strip", z.ZodTypeAny, {
fetchesMessages: boolean;
registrationId: number & {

@@ -216,7 +215,8 @@ __reg_id: never;

name: string;
fetchesMessages: boolean;
}, {
fetchesMessages: boolean;
registrationId: number;
pniRegistrationId: number;
name: string;
fetchesMessages: boolean;
}>;

@@ -228,8 +228,8 @@ aciSignedPreKey: z.ZodObject<{

}, "strip", z.ZodTypeAny, {
publicKey: string;
keyId: number;
publicKey: string;
signature: string;
}, {
publicKey: string;
keyId: number;
publicKey: string;
signature: string;

@@ -242,8 +242,8 @@ }>;

}, "strip", z.ZodTypeAny, {
publicKey: string;
keyId: number;
publicKey: string;
signature: string;
}, {
publicKey: string;
keyId: number;
publicKey: string;
signature: string;

@@ -256,8 +256,8 @@ }>;

}, "strip", z.ZodTypeAny, {
publicKey: string;
keyId: number;
publicKey: string;
signature: string;
}, {
publicKey: string;
keyId: number;
publicKey: string;
signature: string;

@@ -270,8 +270,8 @@ }>;

}, "strip", z.ZodTypeAny, {
publicKey: string;
keyId: number;
publicKey: string;
signature: string;
}, {
publicKey: string;
keyId: number;
publicKey: string;
signature: string;

@@ -282,3 +282,2 @@ }>;

accountAttributes: {
fetchesMessages: boolean;
registrationId: number & {

@@ -291,21 +290,22 @@ __reg_id: never;

name: string;
fetchesMessages: boolean;
};
aciSignedPreKey: {
publicKey: string;
keyId: number;
publicKey: string;
signature: string;
};
pniSignedPreKey: {
publicKey: string;
keyId: number;
publicKey: string;
signature: string;
};
aciPqLastResortPreKey: {
publicKey: string;
keyId: number;
publicKey: string;
signature: string;
};
pniPqLastResortPreKey: {
publicKey: string;
keyId: number;
publicKey: string;
signature: string;

@@ -316,25 +316,25 @@ };

accountAttributes: {
fetchesMessages: boolean;
registrationId: number;
pniRegistrationId: number;
name: string;
fetchesMessages: boolean;
};
aciSignedPreKey: {
publicKey: string;
keyId: number;
publicKey: string;
signature: string;
};
pniSignedPreKey: {
publicKey: string;
keyId: number;
publicKey: string;
signature: string;
};
aciPqLastResortPreKey: {
publicKey: string;
keyId: number;
publicKey: string;
signature: string;
};
pniPqLastResortPreKey: {
publicKey: string;
keyId: number;
publicKey: string;
signature: string;

@@ -351,8 +351,8 @@ };

}, "strip", z.ZodTypeAny, {
members: number;
attributes: number;
members: number;
addFromInviteLink: number;
}, {
members: number;
attributes: number;
members: number;
addFromInviteLink: number;

@@ -363,17 +363,17 @@ }>;

publicKey: Uint8Array;
version: 0;
accessControl: {
members: number;
attributes: number;
members: number;
addFromInviteLink: number;
};
version: 0;
members: unknown[];
}, {
publicKey: Uint8Array;
version: 0;
accessControl: {
members: number;
attributes: number;
members: number;
addFromInviteLink: number;
};
version: 0;
members: unknown[];

@@ -380,0 +380,0 @@ }>;

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

const buffer_1 = require("buffer");
const url_1 = require("url");
const crypto_1 = require("crypto");

@@ -357,3 +356,3 @@ const debug_1 = __importDefault(require("debug"));

if (url.startsWith('/v1/websocket/?')) {
return await this.handleNormal(url);
return await this.handleNormal(this.request);
}

@@ -399,15 +398,21 @@ }

}
async handleNormal(url) {
const query = (0, url_1.parse)(url, true).query || {};
// Note: when a device has been unlinked, it will use '' as its password
if (!query.login ||
Array.isArray(query.login) ||
typeof query.password !== 'string' ||
Array.isArray(query.password)) {
debug('Unauthorized WebSocket connection @ %s: %j', url, query);
async handleNormal(incomingMessage) {
const authHeaders = incomingMessage.headers.authorization;
if (!authHeaders) {
debug('Websocket connection does not include Authorization header');
return;
}
const device = await this.server.auth(query.login, query.password);
const { error, username, password } = (0, util_1.parseAuthHeader)(authHeaders, {
allowEmptyPassword: true,
});
if (error || !username) {
debug('Invalid Authorization header for websocket connection @ %s: %s', error, authHeaders);
return;
}
const device = await this.server.auth(username, password);
if (!device) {
debug('Invalid WebSocket credentials @ %s: %j', url, query);
debug('Invalid WebSocket credentials @ %s: %j', incomingMessage.url, {
username,
password,
});
this.ws.close(3000);

@@ -414,0 +419,0 @@ return;

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

};
export declare function parseAuthHeader(header?: string): ParseAuthHeaderResult;
export declare function parseAuthHeader(header?: string, options?: {
allowEmptyPassword?: boolean;
}): ParseAuthHeaderResult;
export declare class PromiseQueue<T> {

@@ -20,0 +22,0 @@ private readonly defaultTimeout;

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

exports.generateRandomE164 = generateRandomE164;
function parseAuthHeader(header) {
function parseAuthHeader(header, options) {
if (!header) {

@@ -42,3 +42,3 @@ return { error: 'Missing Authorization header' };

}
if (!password) {
if (!password && !options?.allowEmptyPassword) {
return { error: 'Missing password' };

@@ -45,0 +45,0 @@ }

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