
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
A simple yet scalable state-management solution built on-top of redux
.
Install boko using:
npm install boko
First we must setup the redux store using the boko reducer and middleware:
import {createStore, applyMiddleware} from "redux"
import {reducer, middleware} from "boko"
const store = createStore(reducer, applyMiddleware(middleware))
Now we can define "state nodes". These are essentially individual atoms of state and it is up to you to decide how you wish to divide your app state across these nodes.
import boko from "boko"
const foo = boko(0)
const bar = boko(1)
In the example above, we've created two nodes, each initially storing a distinct number.
Mutating state is done via thunks (hence the middleware). For example, lets write a thunk that swaps the values of these two state nodes.
const swapValues = (store) => {
// Grab the initial values of the state nodes.
const fooVal = foo.get(store)
const barVal = bar.get(store)
// Swap 'em.
foo.set(barVal)(store)
bar.set(fooVal)(store)
}
Now we can (optionally) connect our state up to React components. As this is built ontop of Redux, we can use the standard react-redux
library to achieve this. We'll create a higher-order component that provides the values of foo
and bar
as props, as well as a nullary method to swap said values.
import {connect} from "react-redux"
export const higherOrderComponent = connect(
(state) => ({
// Use the lens methods to grab the values of the state nodes.
foo: foo.lens(state),
bar: bar.lens(state)
}),
(dispatch) => ({
// The middleware we've included allows us to dispatch thunks directly.
swap: () => dispatch(swapValues)
})
)
FAQs
A simple yet scalable state-management solution built on-top of `redux`.
The npm package boko receives a total of 1 weekly downloads. As such, boko popularity was classified as not popular.
We found that boko 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
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.