
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@ebay/oja-pubsub
Advanced tools
This module is a subset of eBay Oja framework.
The module defines generic actions that can be used to organize actions into publishers and subscribers that are completely disconnected from each others.
Comparing to Oja v1.0 this one is pub/sub on steroids - it defines pub/sub pattern using dependency injection.
$ npm install @ebay/oja-pubsub --save
function (eventType, ...eventData) {}
const { createContext } = require('@ebay/oja-action');
const context = await createContext();
// subscribe
const listener = await context.action('oja/subscribe', 'topic', (eventType, eventData) => {
console.log(eventData);
});
await context.action('oja/dispatch', 'topic', eventData);
const { createContext } = require('@ebay/oja-action');
const context = await createContext();
// subscribe
const listener1 = await context.action('oja/subscribe', 'topic', (eventType, eventData) => {
console.log('sub1', eventData); // >> one, three
return 'ok1';
});
const listener2 = await context.action('oja/subscribe', 'topic', (eventType, eventData) => {
console.log('sub2', eventData); // >> two, four
return 'ok2'
});
await context.action('oja/route', 'topic', 'one'); // >> ok1
await context.action('oja/route', 'topic', 'two'); // >> ok2
await context.action('oja/route', 'topic', 'three'); // >> ok1
await context.action('oja/route', 'topic', 'four'); // >> ok2
await context.action('oja/unsubscribe', 'topic', listener);
context => {
const listener = context.action(
'oja/subscribe', 'topic', (eventType, eventData) => {
console.log(eventData);
}
);
}
To trigger subscription, one needs to trigger the respective action.
In some cases it may be required to reset any cache related to oja.
@ebay/oja-action makes an optional action call 'oja/extension/context/reset' that if extended can be used to reset respective caches. The only problem is it allows a single extenstion while we may need to reset more then one module. That's where pub/sub pattern comes handy - the module extends reset action and dispatches the event that can be listened by many subscribers.
// this examples requires these modules to be installed: oja-context, oja-action, oja-pubsub
// register reset listeners
await context.action('oja/subscribe', 'oja:reset:event', (eventType, eventData) => {
console.log('sub1:', eventType); // >>> sub1: oja:reset:event
console.log(eventData); // >>> undefined, nothing to dispatch yet
});
await context.action('oja/subscribe', 'oja:reset:event', (eventType, eventData) => {
console.log('sub2:', eventType); // >>> sub2: oja:reset:event
console.log(eventData); // >>> undefined, nothing to dispatch yet
});
// trigger reset somewhere in the code
await context.action('oja/reset');
FAQs
Organizing actions into pubblishers and subscribers
The npm package @ebay/oja-pubsub receives a total of 3 weekly downloads. As such, @ebay/oja-pubsub popularity was classified as not popular.
We found that @ebay/oja-pubsub demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 13 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
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.