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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@fortressauth/core

v0.1.8

Published

Secure-by-default, database-agnostic authentication library built with hexagonal architecture.

Readme

@fortressauth/core

Secure-by-default, database-agnostic authentication library built with hexagonal architecture.

Features

  • 🔒 Secure by Default: Argon2id password hashing, SHA-256 session tokens, timing-attack prevention
  • 🏗️ Hexagonal Architecture: Clean separation of business logic from infrastructure
  • 📦 Database Agnostic: Works with any database through adapter pattern
  • 🎯 Type Safe: Built with TypeScript 5.7+ in strict mode
  • Zero Dependencies: Core logic has minimal dependencies
  • 🛡️ Rate Limiting: Built-in token bucket rate limiter
  • 🔐 Account Lockout: Automatic lockout after failed login attempts

Installation

npm install @fortressauth/core
# or
pnpm add @fortressauth/core
# or
yarn add @fortressauth/core

Quick Start

import { FortressAuth, MemoryRateLimiter } from '@fortressauth/core';
import { SqlAdapter } from '@fortressauth/adapter-sql';

// Initialize with your database adapter
const adapter = new SqlAdapter(db);
const rateLimiter = new MemoryRateLimiter();

const fortress = new FortressAuth({
  repository: adapter,
  rateLimiter,
  config: {
    session: {
      ttlMs: 7 * 24 * 60 * 60 * 1000, // 7 days
    },
    password: {
      minLength: 8,
      maxLength: 128,
    },
  },
});

// Sign up a new user
const signupResult = await fortress.signUp({
  email: '[email protected]',
  password: 'SecurePassword123!',
});

if (signupResult.success) {
  const { user, token } = signupResult.data;
  // Store token in cookie or return to client
}

// Sign in
const signinResult = await fortress.signIn({
  email: '[email protected]',
  password: 'SecurePassword123!',
});

// Validate session
const sessionResult = await fortress.validateSession(token);

Security Features

Password Hashing

Uses Argon2id with OWASP-recommended parameters:

  • Memory cost: 19456 KB
  • Time cost: 2 iterations
  • Parallelism: 1 thread

Session Tokens

  • 32 bytes of cryptographic randomness
  • Stored as SHA-256 hash in database
  • Raw token returned only once to client

Rate Limiting

Token bucket algorithm with configurable limits:

  • Default: 5 attempts per 15 minutes for login
  • Prevents brute force attacks

Account Lockout

  • Configurable failed attempt threshold
  • Automatic unlock after duration
  • Prevents credential stuffing

Architecture

FortressAuth follows hexagonal architecture principles:

  • Domain Entities: User, Account, Session, LoginAttempt
  • Ports: AuthRepository, RateLimiterPort (interfaces)
  • Use Cases: FortressAuth class orchestrates business logic
  • Adapters: Implement ports for specific infrastructure (SQL, Redis, etc.)

API Reference

See full documentation for detailed API reference.

License

MIT