@vernostdev/server-vauth v1.0.0
Overview
@vernost/server-vauth is a robust authentication and authorization library tailored for Node.js applications. It provides an easy-to-use middleware framework for managing user authentication, token verification, and secure access control using JWT (JSON Web Tokens) and other modern security standards.
Key Features:
JWT-Based Authentication: Supports secure authentication using JSON Web Tokens (JWT).
✅ Role-Based Access Control (RBAC): Manage user roles and permissions effortlessly.
✅ Token Validation: Middleware for validating access tokens and ensuring secure API access.
✅ Customizable Middleware: Easily integrate with existing Express.js or Node.js frameworks.
✅ Secure Encryption: Protect sensitive data with built-in encryption mechanisms.
✅ Session Management: Support for both stateless (JWT) and stateful authentication strategies.
✅ Environment Configuration: Flexible environment-based settings for token secrets and expiration.
📌 Installation
npm install @vernost/server-vauth
Configuration
let config = {
secretKey: 'JGJHGJHGJH',
tokenExpiry: '7d',
otpVerificationRequired: true,
googleCaptchaVerification: true,
googleCaptchaSecrectKey: "6Le3ZOwpAAAAAHDtu9hSFI90tWtOzmHI_HVYyJjD",
seprateDatabase: true,
databseType: databaseType.MONGODB,
databaseConfig: {
mongodbURL: "", // MongoDB configuration
filePath: '', // SQLite configuration
host: '', // PostgreSQL or MySQL configuration
user: '', // PostgreSQL or MySQL configuration
password: '', // PostgreSQL or MySQL configuration
database: '' // PostgreSQL or MySQL configuration
},
SMTPConfiguration: {
server: "",
port: "465",
auth: {
user: "",
pass: ""
},
fromEmail: "",
bccEmail: ""
}
};
Properties
- secretKey: Secret key for the application.
- tokenExpiry: Token expiry duration.
- otpVerificationRequired: Boolean indicating if OTP verification is required.
- googleCaptchaVerification: Boolean indicating if Google Captcha verification is required.
- googleCaptchaSecrectKey: Secret key for Google Captcha.
- seprateDatabase: Boolean indicating if a separate database is used.
- databseType: Type of the database being used. Should be one of the values from databaseType enum.
- databaseConfig: Configuration object for the database.
- mongodbURL: URL for MongoDB.
- filePath: File path for SQLite.
- host: Host for PostgreSQL or MySQL.
- user: User for PostgreSQL or MySQL.
- password: Password for PostgreSQL or MySQL.
- database: Database name for PostgreSQL or MySQL.
- SMTPConfiguration: Configuration object for SMTP.
- server: SMTP server.
- port: SMTP port.
- auth: Authentication object for SMTP.
- user: SMTP user.
- pass: SMTP password.
- fromEmail: From email address.
- bccEmail: BCC email address.
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago