
Security News
Node.js Drops Bug Bounty Rewards After Funding Dries Up
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.
Glancy is a powerful, flexible, and efficient client-side storage library for modern JavaScript applications. It provides a range of features including key-value storage, item expiration (TTL), encryption, compression, and the ability to handle multiple items at once. This project is designed to be simple to use while also providing advanced features for complex storage needs.
Install the package via npm:
npm install glancy
Then, import the Glancy class:
import { Glancy } from 'glancy';
const storage = new Glancy({ namespace: 'my_app' });
Easily set, get, and remove items:
const storage = new Glancy({ namespace: 'my_app' });
interface MyData {
value: string;
}
// 🔑 Set a value
await storage.set<MyData>('my_key', { value: 'Hello, world!' }, 60000); // TTL of 1 minute
// 🔍 Get a value
const { data } = await storage.get<MyData>('my_key');
console.log(data?.value); // Outputs: Hello, world!
// 🗑️ Remove a value
storage.remove('my_key');
// 🧹 Clear all items in the namespace
storage.clear();
Optimize storage and secure your data with built-in compression and encryption:
const storage = new Glancy({
namespace: 'my_app',
encryption: {
enabled: true, // 🔒 Enable encryption
key: 'my-secret-key',
},
compress: true, // 🗜️ Enable compression
compressionLevel: 6, // Optional: Set compression level (0-9)
});
interface SecureData {
value: string;
}
// 🔑 Set a value securely
await storage.set<SecureData>(
'secure_key',
{ value: 'Sensitive Information' },
60000
);
// 🔍 Retrieve the secure value
const { data } = await storage.get<SecureData>('secure_key');
console.log(data?.value); // Outputs: Sensitive Information
🔧 Tip: You can generate a secure key using
opensslby runningopenssl rand -base64 32
Perform operations on multiple keys at once:
interface MyData {
value: string;
}
// 🔑 Set multiple items
await storage.setMany<MyData>({
key1: { value: 'value1' },
key2: { value: 'value2' },
});
// 🔍 Get multiple items
const { data } = await storage.getMany<MyData>(['key1', 'key2']);
console.log(data['key1']); // Outputs: value1
Store items with a lifespan:
await storage.set('temporary_data', { value: 'Expires Soon' }, 5000); // Expires in 5 seconds
setTimeout(async () => {
const data = await storage.get('temporary_data');
console.log(data); // Should be null after 5 seconds
}, 6000);
| Option | Description | Default |
|---|---|---|
namespace | A unique identifier for the storage namespace. | glancy |
encryption | An object containing encryption configuration. | { enabled: false, key: '' } |
defaultTTL | The default TTL (in milliseconds) for stored items. | null |
compress | Whether to enable compression for stored items. | false |
compressionLevel | The gzip compression level (0-9). | 6 |
get<T>(key: string): Promise<GlancyResponse<T>>Retrieves a value. Returns null if the key doesn't exist or has expired.
set(key: string, value: T, ttl?: number): Promise<GlancyResponse<void>>Stores a value with an optional TTL.
getMany<T>(keys: string[]): Promise<GlancyResponse<Record<string, T | null>>>Retrieves multiple values at once.
setMany<T>(values: Record<string, T>, ttl?: number): Promise<GlancyResponse<void>>Stores multiple values at once.
remove(key: string): GlancyResponse<void>Deletes an item from storage.
clear(): GlancyResponse<void>Removes all items in the current namespace.
keys(): GlancyResponse<string[]>Lists all keys in the namespace.
has(key: string): Promise<GlancyResponse<boolean>>Checks if a key exists and is not expired.
touch(key: string, ttl?: number): Promise<GlancyResponse<boolean>>Updates the TTL for an existing item.
getTTL(key: string): Promise<GlancyResponse<number | null>>Gets the remaining TTL for a key.
size(): GlancyResponse<number>Calculates the total size (in bytes) of all items in the namespace.
GlancyResponse<T>Represents the response from a storage operation.
| Property | Description |
|---|---|
success | Indicates whether the operation was successful. |
message | A message associated with the response. |
data | The data returned by the operation. |
interface GlancyResponse<T> {
success: boolean;
message: string;
data: T | null | undefined;
}
For more details, visit the Glancy Storage Library Documentation.
We ❤️ contributions! Here's how to get started:
git checkout -b feat/my-feature)git commit -am 'feat: add new feature')git push origin feat/my-feature)This project is licensed under the Apache 2.0 License.
🔧 Pro Tip: If you encounter any issues or have feature requests, feel free to open an issue or submit a pull request. Let's make Glancy even better!
FAQs
A secure and efficient storage solution with support for compression and encryption.
We found that glancy demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.