2.0.0 • Published 8 months ago
@nextlayer/vaultx v2.0.0
VaultX Security Library
VaultX is a comprehensive, production-grade security library designed to provide robust authentication, authorization, and encryption features for applications across multiple programming languages.
Features
🔐 Advanced Encryption
- AES-256-GCM encryption with authenticated encryption
- RSA asymmetric encryption and digital signatures
- Secure key generation and management
- Support for multiple encryption algorithms
- Initialization vector (IV) handling
🔑 Authentication
- JWT-based authentication
- OAuth2 integration
- Refresh token support
- Argon2id password hashing
- Multi-factor authentication support
👥 Authorization
- Role-Based Access Control (RBAC)
- Permission-based authorization
- Token-based session management
- Fine-grained access control
🛡️ Security Features
- Rate limiting protection
- CORS configuration
- Helmet security headers
- Input validation and sanitization
- Protection against common attacks (XSS, CSRF, etc.)
📝 Logging and Monitoring
- Comprehensive security logging
- Winston-based logging system
- Error tracking and monitoring
- Audit trails
🌐 Multi-Language Support
VaultX can be used with any programming language through its REST API interface. Here are some examples:
Python
import requests
def encrypt_data(data):
response = requests.post('http://localhost:3000/crypto/encrypt', json={
'data': data,
'algorithm': 'aes-256-gcm'
})
return response.json()Java
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
public class VaultXClient {
public String authenticate(String username, String password) {
HttpPost request = new HttpPost("http://localhost:3000/auth/login");
// Add authentication logic
}
}PHP
<?php
function encryptData($data) {
$ch = curl_init('http://localhost:3000/crypto/encrypt');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['data' => $data]));
$response = curl_exec($ch);
return json_decode($response, true);
}Installation
- Clone the repository:
git clone https://github.com/yourusername/vaultx.git- Install dependencies:
npm install- Copy the environment configuration:
cp .env.example .envConfigure your environment variables in the .env file
Start the server:
npm startAPI Documentation
Once the server is running, you can access the API documentation at:
http://localhost:3000/api-docs
Security Best Practices
- Always use HTTPS in production
- Regularly rotate encryption keys
- Implement proper error handling
- Use secure session management
- Enable rate limiting
- Implement proper logging and monitoring
- Keep dependencies updated
Contributing
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
For support, please open an issue in the GitHub repository or contact the maintainers.