
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
storage-typed
Advanced tools
Web Storage wrapper that provides automatic JSON parsing/stringifying and type-specific features.
Web Storage only accepts string value so you should write this verbose code everytime:
// get
try {
const value = window.localStorage.getItem(key);
return value ? JSON.parse(value) : null;
} catch (e) {
/* ... */
}
// set
window.localStorage.setItem(key, JSON.stringify(value));
And it does not provide any type-specific operation. (e.g. increasing number value, push to array)
// increasing count
const count = JSON.parse(window.localStorage.getItem(key));
window.localStorage.setItem(key, JSON.stringify(count + 1));
// push to array
const arr = JSON.parse(window.localStorage.getItem(key));
window.localStorage.setItem(key, JSON.stringify([...arr, value]));
So storage-typed
resolves all things above.
const count = TypedStorageFactory.create("count", 0); // NumberTypedStorage
count.increase();
count.get(); // 1
const arr = TypedStorageFactory.create("array", ["foo"]); // ArrayTypedStorage
arr.pop(); // "foo"
arr.push("bar");
arr.get(); // ["bar"]
/* and any other types... */
Creates TypedStorage by type of passed initial value. Note test code.
TypedStorageFactory.create<T>(key, initialValue, options);
(key, initialValue, options) => TypedStorage<T> | NumberTypedStorage | BooleanTypedStorage | ArrayTypedStorage<T[number]>
TypedStorage
by type of passed initial valuestring
T
TypedStorage
will be initialized withTypedStorageOptions<T>
Provides JSON parsing/stringifying. Note test code.
const storage = new TypedStorage<T>(key, initialValue, options);
storage.get();
storage.set(value);
constructor: (key, initialValue, options) => TypedStorage<T>
TypedStorage
by type of passed initial valuestring
T
TypedStorage
will be initialized withTypedStorageOptions<T>
get: () => T
set: (next) => void
T
interface TypedStorageOptions<T> {
storage?: Storage;
}
Storage
Storage
which TypedStorage
will useExtends number-specific methods based on TypedStorage
API. Note test code.
const storage = new NumberTypedStorage(key, initialValue, options);
storage.increase();
storage.decrease();
constructor: (key, initialValue, options) => TypedStorage<number>
TypedStorage
by type of passed initial valuestring
number
NumberTypedStorage
will be initialized withTypedStorageOptions<number>
increase: () => void
decrease: () => void
Extends boolean-specific methods based on TypedStorage
API. Note test code.
const storage = new BooleanTypedStorage(key, initialValue, options);
storage.toggle();
storage.true();
storage.false();
constructor: (key, initialValue, options) => TypedStorage<boolean>
TypedStorage
by type of passed initial valuestring
boolean
BooleanTypedStorage
will be initialized withTypedStorageOptions<boolean>
toggle: () => void
true: () => void
false: () => void
Extends number-specific methods based on TypedStorage
API. Note test code.
const storage = new ArrayTypedStorage<T>(key, initialValue, options);
storage.push(value);
storage.pop();
constructor: (key, initialValue, options) => TypedStorage<T[]>
TypedStorage
by type of passed initial valuestring
T[]
NumberTypedStorage
will be initialized withTypedStorageOptions<T[]>
push: (value: T) => void
pop: () => T | null
pop
returns null.FAQs
Web Storage wrapper that provides automatic JSON parsing/stringifying and type-specific features.
We found that storage-typed 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
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.