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

@signalapp/mock-server

Package Overview
Dependencies
Maintainers
0
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.9.0 to 6.10.0

2

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

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

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

import { signalservice as Proto } from '../../protos/compiled';
import { Server as BaseServer, EnvelopeType, IsSendRateLimitedOptions, ModifyGroupOptions, ModifyGroupResult, ProvisionDeviceOptions, ProvisioningResponse } from '../server/base';
import { Server as BaseServer, ChallengeResponse, EnvelopeType, IsSendRateLimitedOptions, ModifyGroupOptions, ModifyGroupResult, ProvisionDeviceOptions, ProvisioningResponse } from '../server/base';
import { Device, DeviceKeys } from '../data/device';

@@ -58,2 +58,3 @@ import { PrimaryDevice } from './primary-device';

private rateLimitCountByPair;
private responseForChallenges;
private unregisteredServiceIds;

@@ -70,2 +71,5 @@ constructor(config?: Config);

register(primary: PrimaryDevice, serviceIdKind?: ServiceIdKind): void;
respondToChallengesWith(code?: number, data?: unknown): void;
stopRespondingToChallenges(): void;
getResponseForChallenges(): ChallengeResponse | undefined;
rateLimit({ source, target }: RateLimitOptions): void;

@@ -72,0 +76,0 @@ stopRateLimiting({ source, target, }: RateLimitOptions): number | undefined;

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

rateLimitCountByPair = new Map();
responseForChallenges;
unregisteredServiceIds = new Set();

@@ -233,2 +234,14 @@ constructor(config = {}) {

}
respondToChallengesWith(code = 413, data) {
this.responseForChallenges = {
code,
data,
};
}
stopRespondingToChallenges() {
this.responseForChallenges = undefined;
}
getResponseForChallenges() {
return this.responseForChallenges;
}
rateLimit({ source, target }) {

@@ -235,0 +248,0 @@ this.rateLimitCountByPair.set(`${source}:${target}`, 0);

@@ -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;

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

}, "strip", z.ZodTypeAny, {
content: string;
type: number;

@@ -148,8 +149,7 @@ destinationDeviceId: number & {

};
}, {
content: string;
}, {
type: number;
destinationDeviceId: number;
destinationRegistrationId: number;
content: string;
}>;

@@ -164,2 +164,3 @@ export type Message = z.infer<typeof MessageSchema>;

}, "strip", z.ZodTypeAny, {
content: string;
type: number;

@@ -172,12 +173,13 @@ destinationDeviceId: number & {

};
}, {
content: string;
}, {
type: number;
destinationDeviceId: number;
destinationRegistrationId: number;
content: string;
}>, "many">;
timestamp: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
timestamp: number;
messages: {
content: string;
type: number;

@@ -190,13 +192,11 @@ destinationDeviceId: number & {

};
content: string;
}[];
}, {
timestamp: number;
}, {
messages: {
content: string;
type: number;
destinationDeviceId: number;
destinationRegistrationId: number;
content: string;
}[];
timestamp: number;
}>;

@@ -212,3 +212,2 @@ export type MessageList = z.infer<typeof MessageListSchema>;

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

@@ -221,7 +220,8 @@ __reg_id: never;

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

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

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

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

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

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

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

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

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

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

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

@@ -296,21 +295,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;

@@ -321,25 +321,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;

@@ -356,8 +356,8 @@ };

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

@@ -368,17 +368,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[];

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

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

}>;
export type ChallengeResponse = Readonly<{
code: number;
data: unknown;
}>;
export type PreparedMultiDeviceMessage = ReadonlyArray<[Device, Message]>;

@@ -209,2 +213,3 @@ export type ProvisionDeviceOptions = Readonly<{

abstract isSendRateLimited(options: IsSendRateLimitedOptions): boolean;
abstract getResponseForChallenges(): ChallengeResponse | undefined;
protected set certificate(value: ServerCertificate);

@@ -211,0 +216,0 @@ protected get certificate(): ServerCertificate;

@@ -416,2 +416,6 @@ "use strict";

}
const response = server.getResponseForChallenges();
if (response) {
return (0, micro_1.send)(res, response.code, response.data);
}
return { ok: true };

@@ -418,0 +422,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