2.0.0 • Published 8 months ago

@nextlayer/vaultx v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

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

  1. Clone the repository:
git clone https://github.com/yourusername/vaultx.git
  1. Install dependencies:
npm install
  1. Copy the environment configuration:
cp .env.example .env
  1. Configure your environment variables in the .env file

  2. Start the server:

npm start

API Documentation

Once the server is running, you can access the API documentation at: http://localhost:3000/api-docs

Security Best Practices

  1. Always use HTTPS in production
  2. Regularly rotate encryption keys
  3. Implement proper error handling
  4. Use secure session management
  5. Enable rate limiting
  6. Implement proper logging and monitoring
  7. Keep dependencies updated

Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. 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.