
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.
mobx-persist
Advanced tools
$ npm install mobx-persist --save
import { observable } from 'mobx'
import { create, persist } from 'mobx-persist'
class SomeItem {
@persist @observable name = 'some'
@persist @observable count = 0
}
class SomeStore {
@persist('object') @observable obj = { a: 1, b: 2 }
@persist('map') @observable stringMap = observable.map<string>({})
@persist('list') @observable numList = [1,2,3,4]
@persist('object', SomeItem) @observable s = new SomeItem
@persist('map', SomeItem) @observable m = observable.map<SomeItem>({})
@persist('list', SomeItem) @observable l = []
}
const hydrate = create({
storage: localForage, // or AsyncStorage in react-native.
// default: localStorage
jsonify: false // if you use AsyncStorage, here shoud be true
// default: true
})
// create the state
export const someStore = new SomeStore()
hydrate('some', someStore)
// post hydration
.then(() => console.log('some hydrated'))
without decorators
const data = observable({
title: 'no decorator',
someObject: {
a: 1,
b: 'b',
},
someArray: [{
c: 1,
d: 'd'
}]
})
const schema = {
title: true,
someObject: {
type: 'object',
schema: {
a: true,
b: true
}
},
someArray: {
type: 'list',
schema: {
c: true,
d: true
}
}
}
export const someStore = persist(schema)(data)
hydrate('some', state)
.then(() => console.log('some hydrated'))
with initial state
const initialState = window.__STATE__.some || {
obj: { a: 2, b: 1 }
}
export const someStore = new SomeStore()
hydrate('some', someStore, initialState)
.then(() => console.log('some hydrated'))
re-hydration
const result = hydrate('some', someStore, initialState)
const rehydrate = result.rehydrate
result.then(() => console.log('some hydrated'))
setTimeout(() => {
rehydrate().then(() => console.log('rehydrated'))
}, 3000)
persist(schema)(object)
'object' | 'list' | 'map'
or a structured schema object.create(config)
hydrate(key, store)
IHydrateResult
extends Promise
FAQs
create and persist mobx stores
The npm package mobx-persist receives a total of 0 weekly downloads. As such, mobx-persist popularity was classified as not popular.
We found that mobx-persist 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.