xypriss-acpes
v1.0.4
Published
XyPriss Security is an advanced JavaScript security library designed for enterprise applications. It provides military-grade encryption, secure data structures, quantum-resistant cryptography, and comprehensive security utilities for modern web applicatio
Maintainers
Keywords
Readme
ACPES - Advanced Cross-Platform Encrypted Storage
ACPES is a secure, cross-platform storage solution that works seamlessly across Web, Mobile (React Native), and Node.js environments. It provides military-grade encryption, automatic platform detection, and comprehensive security features.
Migration Notice: The XyPriss library is the separated version of FortifyJS accessible via the link or using
npm install fortify2-js. The FortifyJS library will be deprecated soon, so start moving from it to XyPriss for future improvements.
Features
- Cross-Platform Compatibility: Works on Web, Mobile (React Native), and Node.js
- Triple-Layer Encryption: Base + Double AES-256 + Advanced user-key encryption
- Binary Obfuscation: Data converted to binary for maximum unreadability
- User-Specified Keys: Custom encryption keys for maximum security control
- Integrity Verification: HMAC-SHA256 checksums prevent data tampering
- Device Fingerprinting: Unique encryption keys per device
- Automatic Lockout: Protection against brute force attacks
- TTL Support: Automatic data expiration
- Compression: LZ-string compression for large data
- Architecture: Import only what you need
- TypeScript Support: Full type definitions included
Installation
npm install xypriss-acpes
# or
yarn add xypriss-acpes
# or
pnpm add xypriss-acpesQuick Start
import { Storage, STORAGE_KEYS } from "xypriss-acpes";
// Store sensitive data
await Storage.setItem(STORAGE_KEYS.SESSION_TOKEN, "hello world");
// Retrieve data
const token = await Storage.getItem(STORAGE_KEYS.SESSION_TOKEN);
// Store with TTL (expires in 1 hour)
await Storage.setItemWithTTL("temp-data", "value", 3600);
// Advanced encryption with user-specified key
await Storage.setItem("top-secret", "classified-data", {
userEncryptionKey: "MySecretKey2024!",
advancedEncryption: true,
enableBinaryEncoding: true,
});
// Check platform capabilities
const info = Storage.getPlatformInfo();
console.log(`Platform: ${info.platform}, Has Keychain: ${info.hasKeychain}`);Platform Support
Web
- localStorage: Primary storage for small data
- IndexedDB: Fallback for large data or when localStorage is unavailable
- Memory: Final fallback for unsupported browsers
Mobile (React Native)
- Keychain (iOS): Secure keychain storage with biometric support
- Keystore (Android): Android keystore integration
- Biometric Authentication: Touch ID, Face ID, and fingerprint support
Node.js
- File System: Encrypted file storage with proper permissions
- Memory: Fallback for restricted environments
Security Features
Encryption
- Double AES-256: Two layers of AES-256 encryption
- PBKDF2 Key Derivation: 10,000 iterations for key strengthening
- Device-Specific Keys: Unique keys per device using fingerprinting
Integrity Protection
- HMAC-SHA256: Cryptographic checksums for data integrity
- Version Validation: Automatic handling of format changes
- Corruption Detection: Automatic cleanup of corrupted data
Access Control
- Automatic Lockout: Configurable failed attempt limits
- Security Metrics: Detailed access attempt tracking
- Manual Unlock: Administrative override capabilities
Advanced Usage
Custom Configuration
import { ACPES } from "xypriss-acpes";
const customStorage = new ACPES({
nodeStoragePath: "/custom/secure/path",
});Platform-Specific Options
// Web with IndexedDB and compression
await Storage.setItem("data", largeJsonString, {
useIndexedDB: true,
compressionEnabled: true,
});
// Mobile with biometric authentication
await Storage.setItem("sensitive-data", value, {
touchID: true,
requireAuth: true,
service: "MyApp",
});
// Node.js with custom file path
await Storage.setItem("server-config", config, {
filePath: "/etc/myapp/secure.enc",
});Security Monitoring
// Check security status
const metrics = Storage.getSecurityMetrics("sensitive-key");
if (metrics.isLocked) {
console.log(`Service locked until: ${new Date(metrics.lockUntil)}`);
}
// Manual unlock if needed
await Storage.unlockService("sensitive-key");API Reference
Core Methods
setItem(key, value, options?)- Store encrypted datagetItem(key, options?)- Retrieve and decrypt dataremoveItem(key, options?)- Remove stored dataclear()- Remove all stored datahasItem(key, options?)- Check if key exists
Utility Methods
setItemWithTTL(key, value, ttlSeconds, options?)- Store with expirationupdateItem(key, updater, options?)- Atomic updatesgetPlatformInfo()- Get platform capabilitiesgetSecurityMetrics(key)- Get security statusunlockService(key)- Manual unlock
Documentation
- Getting Started - Quick start guide and basic usage
- API Reference - Complete API documentation
- Architecture - Architecture overview
- Platform Support - Platform-specific features
- Security - Security features and best practices
- Examples - Real-world usage examples
- Troubleshooting - Common issues and solutions
Requirements
Web
- Modern browsers with localStorage support
- IndexedDB support (optional, for enhanced features)
Mobile
- React Native 0.60+
- react-native-keychain (for secure storage)
Node.js
- Node.js 14+
- File system write permissions
License
MIT License - see LICENSE file for details.
Contributing
Contributions are welcome! Please read our Contributing Guide for details on our code of conduct and development process.
Changelog
See CHANGELOG.md for version history and changes.
