@angelitosystems/nest-auth
v1.0.0
Published
Enterprise modular authentication, authorization, RBAC, sessions, 2FA, and audit ecosystem for NestJS by Angelito Systems
Maintainers
Readme
@angelitosystems/nest-auth
Enterprise-grade, modular authentication, authorization, RBAC, sessions, 2FA, and audit ecosystem for NestJS applications.
⚡ Quick Start
Installation
# Recommended: initialize via interactive CLI toolkit
npx nest-auth-kit init
# Or install manually
npm install @angelitosystems/nest-authModule Registration
import { Module } from '@nestjs/common';
import { AuthModule } from '@angelitosystems/nest-auth';
import { PrismaAuthAdapter } from '@angelitosystems/nest-auth-prisma';
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
@Module({
imports: [
AuthModule.forRoot({
adapter: new PrismaAuthAdapter(prisma),
jwt: {
secret: process.env.AUTH_JWT_SECRET || 'super-secret-key-min-32-chars-long!',
expiresIn: '15m',
refreshExpiresIn: '7d',
},
twoFactor: {
enabled: true,
appName: 'My Enterprise App',
},
session: {
maxConcurrent: 5,
},
audit: {
enabled: true,
},
}),
],
})
export class AppModule {}🔐 Key Features
- Decoupled Architecture: Persistence-agnostic core supporting Prisma, TypeORM, Sequelize, and Mongoose adapters.
- Timing-Safe Cryptography: PBKDF2 with 100,000 iterations & SHA-512 for password hashing, timing-safe verification.
- Token Lifecycle: Short-lived JWT access tokens, automatic refresh rotation, and token reuse attack detection.
- Granular RBAC: Decorators
@Roles(),@Permissions()with wildcard matching (users.*,*), and@CurrentUser(). - Two-Factor Authentication: RFC 6238 TOTP with QR URI generation and single-use hashed recovery codes.
- Multi-Device Sessions: Device fingerprinting, IP & User-Agent tracking, concurrent session caps, and instant revocation.
- Audit Logging: Decorator
@Audited()&AuditInterceptortracking actor, action, route, and state changes.
📦 Database Adapters
@angelitosystems/nest-auth-prisma@angelitosystems/nest-auth-typeorm@angelitosystems/nest-auth-sequelize@angelitosystems/nest-auth-mongoose
📄 License
MIT © Angelito Systems
