
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@wrserver/core
Advanced tools
@wrserver core module that define the basic concepts of the WRS.
Install this library is easy by cloning the repo. You can install trhought npm too:
Local installation
npm install @wrserver/core
Global installation
npm install -g @wrserver/core
We recomend to use the entire base package (core, crypt, data, auth, mail)
The WRServer is built up on this elements:
//Incoming Message - from Core > Connection
interface IConnectionIncomingParsed {
target: string,
section: string,
page: string,
option: string,
id: number,
data: any
}
//Outcoming Message - from Core > Connection
interface IConnectionOutcome {
id?: number,
bad: boolean
code: string,
class: string,
data: any,
message: string,
}
Start-up The Server instanciate once every module disposed at the creation time and search for needs of every module. Then it instanciate every service once and inject them on modules that needs them. The Server is now ready to communicate. Connection A Client want to connect to the server, it make handshacke and the connection is approved. When Server and Client are connected the Server send a lookup table of codes to enstabilish the correct communication. Message Client send a message on the websocket connection. The Server try to parse the message as a well-formatted Message, if it fails reply with a bad-formatted CODE. After the formattation success Server route the Message to the instanciated Module that match name with the message target, check if module can create a Controller named as the message section. If success it create a Controller and try to call the message page method with the Message as argument to generate a response. If not page found try to check if default method is provided else generate a bad response. Anyway if no response is generated the Server provide a bad response as fallback. Broadcast The Server can send a message to every connection that satisfy a filter clause.
import { Module, Controller, Service, ModelBase, ControllerType } from "<core>";
//This are just suggested for typing your controller
export type MyControllerServices = { <ServiceName>: <ServiceType> };
export type MyControllerModels = { <ModelName>: <ModelType> };
export class MyModule extends Module {
protected controllers: ControllerType[] = [ ... Controllers needed ... ];
protected models: ModelType[] = [ ... Models needed ... ];
public services: ServiceType[] = [ ... Services needed ... ];
public dependencies: ModuleType[] = [ ... Other Modules needed ... ];
public codes: string[] = [ ... Response Codes needed ... ];
}
import { Controller, Connection, IConnectionIncomingParsed, IConnectionOutcome } from "<core>";
import { MyControllerServices, MyControllerModels } from "<my.module>";
export class MyController extends Controller {
protected services: MyControllerServices;
protected models: MyControllerModels;
//optional
constructor(connection: Connection, services: { [name: string]: any }, models: { [name: string]: any }){
super(connection, services, models);
//... code ...
}
// PAGES
protected <PageName>(message: IConnectionIncomingParsed): IConnectionOutcome {
//... code...
if(BAD){
return this.bad(<code>);
}
if(GOOD){
return this.ok(<class>, <response>)
}
}
public static section: string = <SectionName>;
}
NOTE: @wrserver/data gives a new model representation for db-like usage.
import { Model, ModelBase } from '<core>';
@Model
export class MyModel extends ModelBase {
// PROPERTIES
public sendable(): any{ return <object cleaned for response>; }
}
import { Service, Emitter, Connection } from "<core>";
/** Auth Service for simple manage of User Account with WS Connections */
export class MyService extends Service {
constructor(eventEmitter: Emitter){
super(eventEmitter);
//... code ...
//REMEBRE to call ready method after the service has started up
this.ready();
}
}
import { WRServer } from '@wrserver/core';
let options = {
path: <path>,
port: <port>,
modules: [ ... Modules ... ],
root: <static root>
}
let wrserver = new WRServer(options.path, options.port, options.modules).withRoot(options.root);
###JS
const { WRServer } = require('@wrserver/core');
let options = {
path: <path>,
port: <port>,
modules: [ ... Modules ... ],
root: <static root>
};
let wrserver = new WRServer(options.path, options.port, options.modules).withRoot(options.root);
If you like the project feel free to contact me on my .
Something gone wrong? Feel free to rise an issue!
Did you like this project and it was usefull? Help me improve my work:
FAQs
wrserver - core module
The npm package @wrserver/core receives a total of 3 weekly downloads. As such, @wrserver/core popularity was classified as not popular.
We found that @wrserver/core demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.