Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Ksike Hook library for easy implementation of Event Driven Design. The Hooks pattern is a design pattern that facilitates event-driven programming within a software architecture. It allows you to define events and configure them with subscribers and notifiers. Subscribers listen to specific events and define which notifier should handle them when the event is triggered. This pattern enhances modularity and extensibility in event-driven systems.
This library belong to the Ksike ecosystem:
For further information, check the following topics:
The library comprises four key components: Hooks, Subscriber, Notifier, and Processor. These components work in tandem to provide a modular and customizable solution for managing events and executing actions based on event triggers.
Install the library:
npm install kshook
Load your custom notifier, subscriber, and processors:
const locator = require('./notifier.locator');
const { models, driver, manager } = require('./db');
Register subscribers for each event in the data model
------------------------------------------------------------------------------------------
| id | event | notifier | value | param | processor | expression |
------------------------------------------------------------------------------------------
| 1 | logout | locator | newrelic | null | null | null |
| 2 | login | locator | alert | { failure: dto.inf} | native | failure EQUAL 11 |
------------------------------------------------------------------------------------------
Extended model useful for workflows:
----------------------------------------------------------------------------------------------------------------------------------------
| id | event | notifier | value | param | processor | expression | notifier_alt | value_alt | param_alt |
----------------------------------------------------------------------------------------------------------------------------------------
| 1 | logout | locator | newrelic | null | null | null | null | null | null |
| 2 | login | locator | alert | {failure:dto.inf} | native | failure EQUAL 11 | email | test@srv.com | {note:dto.note} |
----------------------------------------------------------------------------------------------------------------------------------------
For more details check the workflow section.
Configure and run
const KsHook = require('kshook');
// Initialize KsHook instance
const hook = KsHook.get();
// Configure supported components
hook.notifier.set({
name: "locator",
target: locator
});
hook.subscriber.get("Model").configure({
models,
driver,
manager
});
// Trigger the 'login' event
const res = hook.trigger({
subscriber: ["Model"],
event: "login",
data: { failure: 10, flow: "6868465468415", step: "STEP-1" }
});
Explore the potential of dynamic event handling with KsHook, a library designed to empower developers with flexibility, extensibility, and seamless event-driven architecture.
FAQs
Ksike Hook library for easy implementation of Event Driven Design
We found that kshook demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.