
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
safe-localstorage
Advanced tools
localStorage wrapper that fails gracefully when it's not available, like in Safari private mode
window.localStorage
wrapper that will fail gracefullyIn Safari's Private Browsing mode, attempting to store data in localStorage will throw an error. safeLocalStorage checks that window.localStorage
is safe to use. Added bonus - you can pass its methods an arbitrary callback to be fired if localStorage is unavailable.
The localStorage API is available in all modern browsers, going back to IE 8. Using this library will make you safe in IE 6 and 7.
npm install --save safe-localstorage
import safeLocalStorage from 'safe-localstorage';
safeLocalStorage.set('myKey', 'myValue', () => { console.warn('unable to use localStorage'); })
safeLocalStorage.get('myKey');
get(key[, onLocalStorageNotAvailable])
Wrapper for localStorage.getItem
key
(required): key string at which to get valueonLocalStorageNotAvailable
(optional): callback to be fired if localStorage is undefined or not safe to useset(key, value[, onLocalStorageNotAvailable])
Wrapper for localStorage.setItem
key
(required): key string to update (will be created if it doesn't exist)value
(required): string value to be stored at key
onLocalStorageNotAvailable
(optional): callback to be fired if localStorage is undefined or not safe to useremove(key[, onLocalStorageNotAvailable])
Wrapper for localStorage.removeItem
key
(required): key string at which to delete the current valueonLocalStorageNotAvailable
(optional): callback to be fired if localStorage is undefined or not safe to useremoveAll([onLocalStorageNotAvailable])
Wrapper for localStorage.clear
onLocalStorageNotAvailable
(optional): callback to be fired if localStorage is undefined or not safe to useFAQs
localStorage wrapper that fails gracefully when it's not available, like in Safari private mode
The npm package safe-localstorage receives a total of 161 weekly downloads. As such, safe-localstorage popularity was classified as not popular.
We found that safe-localstorage 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.