![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
client-side-storage
Advanced tools
Simple, extensible, client-side key/value pair storage for winners, like you.
Provides key value pair storage. Right now only localStorage is implemented.
You want code coverage? We got code coverage so good it will make your head spin.
This package is distributed via npm:
npm install client-side-storage
var StorageAPI = require('client-side-storage');
//Optional name 'MyStorage' prevents namespace collisions
var MyStorage = new Storage('MyStorage');
MyStorage.addStorageMethod(require('client-side-storage/methods/localStorage');
MyStorage.set('stuff', 'things')
.then(function() {
return MyStorage.get('stuff');
})
.then(function(stuff) {
console.log(stuff); // 'things'
});
MyStorage.set({stuff: 'things', children: 'the future'})
.then(function() {
return MyStorage.get(['stuff', 'children']);
})
.then(function(obj) {
console.log(obj); // {stuff: 'things', children: 'the future'}
});
MyStorage.remove('stuff')
.then(function() {
console.log('stuff is gone');
});
MyStorage.clear()
.then(function() {
console.log('the past is dead, hoss...');
});
Implementing new methods is easy. Simply return a value from your implemented methods as below. See client-side-storage/methods/localStorage.js for example
class MyStorageMethod() {
constructor(name) {
//Save use for prefixing when viable
this.name = name;
}
//This method must be synchronous
isSupported() {
//Return true if the storage method will work in the current enviroment
if (typeof(RandomGlobal.Storage.Plugin) != 'undefined') {
return true;
}
}
get(variable) {
return '42';
//OR - if you need async, simply return a promise
var deferred = Q.defer();
deferred.resolve(42);
return deferred.promise;
}
getMultiple(array_of_values) {
//getMultiple will be called when Storage.get is called with an array of values
//Your class should return an object of key-value pairs (or a promise which resolves to one)
return {key1: 'cool_value', key2: 'cool_value2'}
}
set(key, value) {
//set key equal to value in your method
//if async, return a promise that will resolve when the process is complete
//i.e.
var deffered = Q.defer();
setValueOnServer(function() {
deferred.resolve(true);
});
return deferred.promise;
}
setMultiple(obj) {
//Called when Storage.set is called with an object of key value pairs
//Set all keys in storage, return a promise or value as above
}
remove(variable) {
//Delete variable, then return promise or value as above
}
clear() {
//Clear your storage then return promise or value as above
}
}
FAQs
Simple, extensible, client-side key/value pair storage for winners, like you.
The npm package client-side-storage receives a total of 7 weekly downloads. As such, client-side-storage popularity was classified as not popular.
We found that client-side-storage 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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.