npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@hsuite/users

v2.1.3

Published

A comprehensive user management library for HbarSuite applications that provides robust user authentication, profile management, and security features.

Readme

@hsuite/users

A comprehensive user management library for HbarSuite applications that provides robust user authentication, profile management, and security features.

Features

  • User Management

    • User registration and account creation
    • Profile lookup and search functionality
    • Account deletion and management
    • Email verification system
  • Authentication & Security

    • Secure password management with hashing
    • Two-factor authentication (2FA) support
    • Email verification workflows
    • Password update and recovery processes
  • Data Management

    • MongoDB integration with Mongoose
    • Type-safe data models
    • Automatic timestamps
    • Collection management

Installation

npm install @hsuite/users

Usage

Module Setup

Import the UsersModule in your application:

import { Module } from '@nestjs/common';
import { UsersModule } from '@hsuite/users';

@Module({
  imports: [UsersModule]
})
export class AppModule {}

Basic Usage Examples

  1. User Creation
constructor(private usersService: UsersService) {}

async createUser() {
  const user = await this.usersService.create({
    email: '[email protected]',
    password: 'securepass123',
    username: 'johndoe'
  });
}
  1. Finding Users
// Find by ID
const user = await this.usersService.findById('507f1f77bcf86cd799439011');

// Find by credentials
const user = await this.usersService.find({
  email: '[email protected]',
  password: 'userpass123'
});
  1. Security Management
// Update password
await this.usersService.updatePassword(
  '[email protected]',
  'newSecurePass123'
);

// Configure 2FA
await this.usersService.updateTwoFactorAuth('userId', {
  enabled: true,
  secret: 'TOTP_SECRET_KEY',
  verified: false
});

API Reference

UsersService

Core service providing user management functionality:

  • create(user: User): Promise<UserDocument>
  • findById(userId: string): Promise<UserDocument>
  • find(credentials: IAuth.ICredentials.IWeb2.IDto.ILogin): Promise<UserDocument>
  • updateTwoFactorAuth(userId: string, twoFactorAuth: IAuth.ITwoFactor.IAuth): Promise<UserDocument>
  • updatePassword(userEmail: string, newPassword: string): Promise<UserDocument>
  • emailConfirmation(userId: string): Promise<UserDocument>
  • delete(user: IAuth.ICredentials.IWeb2.IDto.ISignup): Promise<UserDocument>

User Entity

The User entity extends UserNamespace.Safe and includes:

  • Required fields:

    • password: Hashed password string
    • Additional fields inherited from UserNamespace.Safe
  • Features:

    • Mongoose schema integration
    • Automatic timestamps
    • Pre-save validation
    • Collection management

Architecture

The library is structured into several key components:

  • UsersModule: Main module that orchestrates all user-related functionality
  • UsersService: Core business logic implementation
  • UserModelModule: Database operations and schema management
  • User Entity: Data model and validation rules

Database

The library uses MongoDB through Mongoose with the following configuration:

  • Collection name: auth_users
  • Schema features:
    • Pre-save validation
    • Automatic timestamps
    • Secure password hashing
    • Type-safe fields

Security

Built-in security features include:

  • Secure password hashing using bcrypt
  • Two-factor authentication support
  • Email verification system
  • Timing attack protection
  • One-way password hashing

Dependencies

  • @nestjs/common
  • @nestjs/mongoose
  • mongoose
  • @hsuite/auth-types
  • @hsuite/users-types
  • @hsuite/nestjs-swagger

License

[License information not found in source code]