1.0.0 • Published 7 months ago

@vernostdev/server-vauth v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

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.
1.0.0

7 months ago

0.0.10

7 months ago

0.0.11

7 months ago

0.0.12

7 months ago

0.0.13

7 months ago

0.1.0

7 months ago

0.1.2

7 months ago

0.1.1

7 months ago

0.0.9

7 months ago

0.0.8

7 months ago

0.1.4

7 months ago

0.1.3

7 months ago

0.0.4

7 months ago

0.1.6

7 months ago

0.0.7

7 months ago

0.1.5

7 months ago

0.0.6

7 months ago

0.0.3

7 months ago

0.0.2

7 months ago