Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
gdpr-guard-local
Advanced tools
Readme
A simple local storage adapter for gdpr-guard
This library predefines logic to store/save and restore gdpr-guard
state from localStorage.
If you need any help, you're more than welcome on my official Discord server dedicated to my open-source projects.
You can read the online documentation.
This library re-exports what's exported by gdpr-guard
.
import {
// everything from gdpr-guard
defaults,
LocalStorageSavior,
} from "gdpr-guard-local"
// In your browser
const {
// everything from gdpr-guard
defaults,
LocalStorageSavior,
} = gdprGuardLocal;
LocalStorageSavior
is a class that specializes the Savior API for local storage.
It is mainly for libraries developers or can be used as parameters for a library.
To construct one, simply pass a LocalStorageConfig
object followed by a LocalStoreFactory
(both are optional with default values):
interface LocalStorageConfig{
storeKey: string; // key of the serialized manager in local storage
versionKey: string; // key of the version of the serialized manager in local storage
version: string|number; // current version
comparator: (oldVersion, newVersion) => boolean; // if the versions are different
expiration: () => Date; // expiration date from current time
}
type LocalStoreFactory = () => LocalStore;
interface LocalStore{
has(key: string): Promise<boolean>;
set(key: string, value: any, expiration: Date): Promise<void>;
remove(key: string): Promise<void>;
get(key: string): Promise<any>;
removeExpiredKeys(): Promise<void>;
}
const savior = new LocalStorageSavior(myConfig, myStoreFactory);
To help users and developers, we provide default values as well as ways to easily create new values for the parameters.
const {
defaultStoreFactory, // the default argument of the savior constructor
expiration, // utility function
defaultConfig, // the default argument of the savior
makeConfig,
} = defaults;
The makeConfig
function is a utility function that merges the user provided config object with the default config:
declare const makeConfig: (config: Partial<LocalStorageConfig> = {}): LocalStorageConfig;
For instance, you can customize the savior like this:
const savior = new LocalStorageSavior(
makeConfig({
version: "v1.0.0",
//storeKey will be gdpr
//versionKey will be gdpr__version
}),
defaultStoreFactory, // optional, that's already the default parameter
);
FAQs
A simple local storage adapter for gdpr-guard
The npm package gdpr-guard-local receives a total of 5 weekly downloads. As such, gdpr-guard-local popularity was classified as not popular.
We found that gdpr-guard-local 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.