
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
origin-storage
Advanced tools
A same-origin storage(IndexedDB/WebSQL/localStorage) for cross-domain access
A same-origin storage for cross-domain access, it is based on localForage and supports IndexedDB, WebSQL and localStorage.
origin-storageuses localStorage in browsers with no IndexedDB or WebSQL support. And Safari is not supported.
When different Website domains need a same-origin storage container, we have to use iframe's same-origin policy Web local storage solution. localForage is an excellent storage library, it supports IndexedDB, WebSQL and localStorage, but it can't solve this problem directly.
That's why we have this library for same-origin storage based on localForage.
yarn add origin-storage
OriginStorage on http://localhost:9000/storage.js:import { OriginStorage } from 'origin-storage';
const originStorage = new OriginStorage();
If you need to set up a more secure origin control, you can set
targetOriginlike this.
const originStorage = new OriginStorage({
targetOrigin: 'http://example.com',
});
Create and host a Web page(http://localhost:9000/storage.html) containing JavaScript file storage.js.
Use OriginStorageClient on a cross-domain page:
import { OriginStorageClient } from 'origin-storage';
const originStorageClient = new OriginStorageClient({
uri: 'http://localhost:9000/storage.html',
});
OriginStoragenew OriginStorage(options)interface OriginStorageOptions extends IFrameTransportInternalOptions {
/**
* Enable read access to OriginStorage.
*/
read?: boolean;
/**
* Enable write access to OriginStorage.
*/
write?: boolean;
/**
* Enable broadcast data changes on OriginStorage.
*/
broadcastChanges?: boolean;
/**
* Specify broadcastChannel name.
*/
broadcastChannelName?: string;
}
OriginStorageClientnew OriginStorageClient(options)interface OriginStorageClientOptions extends IFrameMainTransportOptions {
/**
* Specify the uri of an OriginStorage container.
*/
uri: string;
/**
* Set storage options for localforage.
*/
storageOptions?: LocalForageOptions;
}
OriginStorageClient instance methods.interface IOriginStorageClient {
/**
* The callback will be called when the iframe is connected.
*/
onConnect(callback: () => void): void;
/**
* The callback will be called when the storage is changed.
*/
onChange(callback: (data: IChangeData) => void): Promise<{
off: () => void;
broadcastChanges: boolean;
}>;
/**
* Get the value of the specified key.
*/
getItem(key: string): Promise<any>;
/**
* Set the value of the specified key.
*/
setItem(key: string, value: any): Promise<void>;
/**
* Remove the value of the specified key.
*/
removeItem(key: string): Promise<void>;
/**
* Clear all key/value pairs in the storage.
*/
clear(): Promise<void>;
/**
* Get the number of key/value pairs in the storage.
*/
length(): Promise<number>;
/**
* Get the name of the nth key in the storage.
*/
key(index: number): Promise<string>;
/**
* Get all keys in the storage.
*/
keys(): Promise<string[]>;
}
FAQs
A same-origin storage(IndexedDB/WebSQL/localStorage) for cross-domain access
The npm package origin-storage receives a total of 69 weekly downloads. As such, origin-storage popularity was classified as not popular.
We found that origin-storage demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.