π@hsuite/auth-types - Authentication Type Definitions
A comprehensive TypeScript library providing type-safe authentication, authorization, and user management type definitions for Web2 and Web3 applications within the HSuite ecosystem.
Table of Contents
Quick Start
npm install @hsuite/auth-typesimport { IAuth, Auth } from '@hsuite/auth-types';
// Use interfaces for type checking
const loginData: IAuth.ICredentials.IWeb2.IDto.ILogin = {
username: "john_doe",
email: "[email protected]",
password: "securePassword123"
};
// Use models for runtime logic
const loginDto = new Auth.Credentials.Web2.Dto.Login(loginData);Key Features
Comprehensive TypeScript library for authentication and authorization type definitions
Complete set of TypeScript interfaces, models, and decorators for implementing secure, type-safe authentication across applications within the HSuite ecosystem.
ποΈ Architecture
Core Namespaces
π IAuth (Interfaces)
ITwilio- Twilio service integration interfacesITwoFactor- Two-factor authentication interfacesIConfiguration- System configuration interfacesIWeb3- Blockchain authentication interfacesIWeb2- Traditional authentication interfacesICredentials- Credential management interfacesIUser- User entity and management interfaces
ποΈ Auth (Models)
Twilio- SMS and voice verification modelsTwoFactor- TOTP and verification modelsConfiguration- Authentication system settingsWeb3- Blockchain wallet authentication modelsWeb2- Traditional credential modelsCredentials- Secure credential storage models
π₯ User (Models)
User.Safe- Safe user entity model with public propertiesUser management type definitions
User entity interfaces and implementations
π― Decorators
@Roles()- Role-based access control@Public()- Public route marker@isTwoFactorAuth()- Two-factor authentication requirement@bypassTokenGate()- Token gate bypass
Module Structure
π§ API Reference
Decorators
@Roles(roles: string[])
Role-based access control decorator using Reflector pattern.
@Public()
Marks route as publicly accessible without authentication.
@isTwoFactorAuth()
Enforces two-factor authentication requirement.
@bypassTokenGate()
Bypasses token gate verification checks.
Core Interfaces
IAuth.IConfiguration.IAuthentication
IAuth.ICredentials.IWeb2.IDto.ILogin
IAuth.ICredentials.IWeb2.IDto.ISignup
IAuth.ICredentials.IUser.IEntity
Model Classes
Auth.Configuration.Authentication
Auth.Credentials.Web2.Dto.Login
Auth.Credentials.Web3.Entity
Auth.TwoFactor.Auth
π Guides
Decorator Usage Guide
Learn how to use authentication decorators for route protection and access control. Implement role-based permissions, public endpoints, and advanced authentication patterns.
Interface Reference Guide
Complete reference for all authentication interfaces and type definitions. Understand the authentication system architecture and type contracts.
Model Implementation Guide
How to use model classes for type-safe authentication data handling. Learn about concrete implementations and runtime logic patterns.
π― Examples
Role-Based Access Control
Web2 Authentication Models
Web3 Authentication Models
Two-Factor Authentication
User Types
Configuration Models
π Integration
Required Dependencies
TypeScript Configuration
Metadata Keys
π§ Type Safety: All interfaces and models provide full TypeScript support with strict type checking and validation.
π Architecture: Clean separation between interfaces (IAuth namespace) and implementations (Auth namespace) following SOLID principles.
π― Best Practice: Use interfaces for type definitions and model classes for runtime validation and data transformation.
Built with β€οΈ by the HSuite Team Copyright Β© 2025 HSuite. All rights reserved.
Last updated