
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.
chrome-storage-wrapper
Advanced tools
A tiny wrapper for chrome.storage that using Promise.
chromeStorage.addChangeListener( (changes, area) => {
expect(changes.key).toBe('value in chrome.storage.local');
expect(changes.otherKey).toBeUndefined();
expect(area).toBe('local');
}, {
keys:['key'], // limit change event in these keys
areas:'local' // limit change event in chrome.storage.local storage area
} );
chromeStorage.defaultArea = 'sync';
// This will not fire the change listener because of the change occur in chrome.storage.sync
chromeStorage.set( 'key', 'value in chrome.storage.sync' )
.then( () => chromeStorage.get('key') )
.then( items => items.key === 'value in chrome.storage.sync' );
// This will fire the change listener by specified the storage area in chrome.storage.local
chromeStorage.set({
key:'value in chrome.storage.local',
otherKey:'other value in chrome.storage.local'
}, 'local')
.then( () => chromeStorage.remove(['key','otherKey'],'local') );
Install with Bower:
bower install chrome-storage-wrapper
Or install with npm:
npm install chrome-storage-wrapper
Or get chrome-storage.js
on release, then you can:
require(['path/to/chrome-storage.js'], chromeStorage => { ... })
const chromeStorage = require('path/to/chrome-storage.js')
<script>
:<script src="path/to/chrome-storage.js"></script><script>console.dir(chromeStorage)</script>
Each getter/setter function work on chrome.storage.local
by default. You can specified a different area by use chromeStorage.defaultArea
:
chromeStorage.defaultArea = 'sync'; // use chrome.storage.sync
chromeStorage.defaultArea = 'managed'; // use chrome.storage.managed
Or you can specified the area at the last params of each getter/setter function. For example:
chromeStorage.get('key','managed').then(() => { ... });
chromeStorage.set('key','value','sync').then(() => { ... })
chromeStorage.remove('key','local').then(() => { ... })
The getter/setter function whose are need a keys
param support these format:
'key'
['key1','key2']
Gets one or more items.
chromeStorage.get(['key1','key2'])
.then(items => {
console.log(items.key1);
console.log(items.key2);
});
Get all items.
chromeStorage.getAll()
.then(items => {
console.log(items.key1);
console.log(items.key2);
});
Sets one or multiple items.
chromeStorage.set({ key1:'value1', key2:'value2' })
.then(() => {
// ...
});
Removes one or more items.
chromeStorage.remove([ 'key1', 'key2' ])
.then(() => {
// ...
});
Removes all items.
Sync the data from area-from
to area-to
.
Fired when one or more items change. This function return a function, it's used by chromeStorage.removeChangeListener
. Note: The changes only has the new value. See below:
chromeStorage.addChangeListener((changes, area) => {
changes.key2 === 'value2 - changed';
area === 'local';
}, {
keys:['key2'], // optional, String or Array of String. Which keys you want listen.
areas:['local'] // optional, String or Array of String. Which storage areas you want listen.
} ); // Only listen the change from 'key2' and chrome.storage.local
chromeStorage.set('key2','value2 - changed','local');
Removes a callback function that returns by chromeStorage.addChangeListener
.
const cb = chromeStorage.addChangeListener((changes, area) => {
// ...
});
chromeStorage.removeChangeListener(cb);
Clone this project, then install dependencies:
npm install
bower install
Compile *.es6 files: gulp compile-es6
Now load src
folder which under the project in Chrome by click the Load unpacked extension...
button at chrome://extensions
. Then it will auto open a page to run test.
MIT
FAQs
A tiny wrapper for chrome.storage that using Promise.
The npm package chrome-storage-wrapper receives a total of 0 weekly downloads. As such, chrome-storage-wrapper popularity was classified as not popular.
We found that chrome-storage-wrapper 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.