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

@endora-commerce/mod-mfa

v0.104.0

Published

Two-factor authentication (TOTP + recovery codes) and Google/Microsoft sign-in, with per-scope enablement/enforcement and admin reset.

Readme

MFA module (feature 042)

Two-factor authentication (TOTP + recovery codes) and federated sign-in (Google / Microsoft) for both the Storefront (customer accounts) and the Admin UI (admin users).

See specs/042-mfa-authentication/ for the full spec, plan, data model, and contracts.

Status

Complete (US1–US6). Capabilities:

  • TOTP 2FA (enrol / activate / disable / regenerate / status) on both surfaces, with single-use recovery codes and a replay-guarded second step.
  • Two-step login — credential step returns authenticated | mfaRequired | mfaSetupRequired; a separate verify step issues the session.
  • Enforcement — per-scope settings (admin global; storefront global/channel) and per-organization policy (org-admin + platform-admin); enforced-but- unenrolled accounts enrol via a setup ticket at login.
  • Federated sign-in — Google / Microsoft (OIDC via openid-client); storefront auto-creates a standalone account, admin matches existing only.
  • Admin reset — single account + organization-wide.

Self-service setup is gated on the per-scope "2FA enabled" setting (FR-001).

Routes (by file)

  • routes.public.ts — second-step verify + setup-ticket begin/complete (both surfaces)
  • routes.self-service.ts — /{account,admin/account}/mfa/* (setup/activate/disable/regenerate/status)
  • routes.oauth.ts — /auth/{customer,admin}/oauth/:provider/{start,callback}
  • routes.org.ts — storefront org-admin enforcement
  • routes.admin.ts — platform-admin reset (single/bulk) + org enforcement

Notable decisions

  • TOTP: reuses the existing otpauth dependency (no new dep). New dependency openid-client is for Google/Microsoft OIDC (research §R2).
  • Secret at rest: AES-256-GCM (SecretCipher), key from MFA_SECRET_ENCRYPTION_KEY (base64, 32 bytes). Recovery codes are stored as SHA-256 hashes only.
  • Ephemeral login state: Redis (ChallengeStore) — pending-login challenge, setup ticket, OAuth transaction — all TTL-bounded.
  • Module name mfa: a singular acronym; a documented Principle VI carve-out (see plan Complexity Tracking).
  • Removability (Principle I): login services consult MFA through an injected port; absent ⇒ password-only fallback. The legacy *.two_factor_secret columns are superseded by mfa_enrolments and left dormant (research §R8) — dropping them is tracked tech-debt.

Environment

| Var | Purpose | |---|---| | MFA_SECRET_ENCRYPTION_KEY | base64-encoded 32-byte AES key for TOTP secrets | | MFA_OAUTH_GOOGLE_CLIENT_ID / _SECRET | Google OIDC client | | MFA_OAUTH_MICROSOFT_CLIENT_ID / _SECRET | Microsoft Entra OIDC client | | MFA_OAUTH_*_REDIRECT_URI | per-surface callback URLs |