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

@sorux/better-auth-fingerprint

v1.0.1

Published

Fingerprint plugin for Better Auth

Readme

better-auth-fingerprint

Fingerprint plugin for Better Auth - device fingerprinting for fraud prevention and abuse detection.

Features

  • Lightweight browser fingerprint generation using stable Web APIs (no external dependencies)
  • Deterministic SHA-256 hashing of fingerprint data
  • Optional double-hashing (client + server) for added security
  • Automatic fingerprint attachment to authentication flows (sign-up, sign-in, session creation)
  • User fingerprint linking for abuse tracking and analysis
  • Configurable abuse detection rules (e.g. max accounts per fingerprint)
  • Flexible enforcement modes: log (monitor only), soft (rate limit/warn), hard (block)
  • Risk scoring system (0-100) to evaluate suspicious behavior patterns
  • Middleware integration for seamless use with auth lifecycle
  • Event hooks: onFingerprintCreated, onRiskDetected, onLimitExceeded, onUserFlagged
  • Support for database adapters (Prisma, Drizzle, and generic SQL)
  • Client-side helper utilities: getFingerprint, withFingerprint
  • Optional debug mode for development
  • Privacy-first design (no raw device data stored, only hashed fingerprints)
  • Configurable opt-out support
  • Minimal performance overhead
  • Abuse analytics support

Installation

npm install better-auth-fingerprint

Server Usage

import { betterAuth } from "better-auth";
import { fingerprint } from "better-auth-fingerprint";

export const auth = betterAuth({
  database: /* your database adapter */,
  plugins: [
    fingerprint({
      trustedDevicesMax: 5,
      autoRemoveOldDevices: true,
      enforcementMode: "soft",
      enableDoubleHashing: false,
      maxAccountsPerFingerprint: 3,
      riskThreshold: 50,
      enableDebug: false,
      allowOptOut: false,
      trackAbuseAnalytics: false,
      hooks: {
        onFingerprintCreated: async (ctx) => {
          console.log("Fingerprint created:", ctx.fingerprint?.fingerprintId);
        },
        onRiskDetected: async (ctx) => {
          console.log("Risk detected:", ctx.riskScore?.score);
        },
        onLimitExceeded: async (ctx) => {
          console.log("Limit exceeded for user:", ctx.userId);
        },
        onUserFlagged: async (ctx) => {
          console.log("User flagged:", ctx.userId, ctx.reason);
        },
      },
    }),
  ],
});

Client Usage

import { createAuthClient } from "better-auth";
import { fingerprintClient, getFingerprint } from "better-auth-fingerprint/client";

const authClient = createAuthClient({
  baseURL: "http://localhost:3000",
  plugins: [fingerprintClient()],
});

// Get browser fingerprint
const fp = await getFingerprint();

// Use with auth operations
await authClient.signIn.signIn({
  email: "[email protected]",
  password: "password",
  // Fingerprint is automatically attached via plugin middleware
});

Risk Scoring

The plugin calculates a risk score (0-100) based on multiple factors:

  • new_fingerprint (15pts) - New device not seen before
  • multiple_accounts (25pts) - Multiple accounts from same fingerprint
  • rapid_signups (30pts) - Rapid account creation
  • unusual_location (20pts) - IP address change
  • suspicious_user_agent (10pts) - Automated/bot user agents
  • known_abuse_marker (40pts) - Previously flagged device
  • device_mismatch (35pts) - Fingerprint mismatch

Risk levels:

  • low: 0-19
  • medium: 20-49
  • high: 50-74
  • critical: 75-100

Enforcement Modes

| Mode | Behavior | |------|----------| | log | Monitor only, log violations | | soft | Allow with warning, rate limit | | hard | Block requests exceeding threshold |

API Endpoints

| Endpoint | Method | Description | |----------|--------|-------------| | /fingerprint/validate | POST | Validate fingerprint | | /fingerprint/list | GET | List user fingerprints | | /fingerprint/delete | POST | Delete fingerprint | | /fingerprint/flag | POST | Flag fingerprint |

TypeScript Types

import type {
  FingerprintOptions,
  FingerprintData,
  FingerprintInput,
  RiskScore,
  EnforcementMode,
  FingerprintHooks,
  FingerprintClientPlugin,
} from "better-auth-fingerprint";

License

MIT !!! You are free to do whatever you want with it ;)