New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@parsrun/auth

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@parsrun/auth

Passwordless-first, multi-runtime authentication for Pars framework

latest
Source
npmnpm
Version
0.2.12
Version published
Maintainers
1
Created
Source

@parsrun/auth

Passwordless-first, multi-runtime authentication for Pars framework.

Features

  • Passwordless-First: OTP (Email/SMS), Magic Links, WebAuthn/Passkeys
  • OAuth Providers: Google, Microsoft, GitHub, Apple with PKCE support
  • Multi-Runtime: Node.js, Deno, Cloudflare Workers, Bun
  • Multi-Tenant: Built-in tenant management and resolution
  • Security: Rate limiting, account lockout, CSRF protection
  • Session Management: JWT with key rotation, token blocklist

Installation

pnpm add @parsrun/auth

Quick Start

import { createAuth } from '@parsrun/auth';

const auth = createAuth({
  secret: process.env.AUTH_SECRET,
  adapter: myDatabaseAdapter,
  providers: {
    otp: {
      email: {
        send: async (to, code) => {
          await sendEmail(to, `Your code is: ${code}`);
        },
      },
    },
  },
});

await auth.initialize();

// Request OTP
await auth.requestOTP({ identifier: 'user@example.com', type: 'email' });

// Sign in
const result = await auth.signIn({
  provider: 'otp',
  identifier: 'user@example.com',
  credential: '123456',
  data: { type: 'email' },
});

API Overview

Core

ExportDescription
createAuth(config)Create auth instance
ParsAuthEngineMain auth engine class

Providers

ExportDescription
OTPProviderEmail/SMS OTP authentication
MagicLinkProviderMagic link authentication
GoogleProviderGoogle OAuth
MicrosoftProviderMicrosoft OAuth
GitHubProviderGitHub OAuth
AppleProviderApple Sign In
TOTPProvider2FA with authenticator apps
WebAuthnProviderPasskeys/WebAuthn

Middleware (Hono)

import {
  createAuthMiddleware,
  requireRole,
  requirePermission,
  requireTenant,
  requireAdmin,
} from '@parsrun/auth';

const authMiddleware = createAuthMiddleware({ auth });

app.get('/admin', authMiddleware, requireAdmin(), handler);
app.get('/users', authMiddleware, requireRole('admin', 'manager'), handler);
app.get('/data', authMiddleware, requirePermission('data:read'), handler);

Session Management

ExportDescription
JwtManagerJWT token management with rotation
SessionBlocklistToken revocation
extractBearerToken()Extract token from header

Storage Adapters

ExportDescription
createStorage()Auto-detect runtime storage
MemoryStorageIn-memory (development)
RedisStorageRedis/Upstash
CloudflareKVStorageCloudflare KV
DenoKVStorageDeno KV

Security

ExportDescription
RateLimiterRequest rate limiting
LockoutManagerAccount lockout
CsrfManagerCSRF protection
AuthorizationGuardRole/permission checks

Exports

import { ... } from '@parsrun/auth';           // Main exports
import { ... } from '@parsrun/auth/storage';   // Storage adapters
import { ... } from '@parsrun/auth/session';   // Session management
import { ... } from '@parsrun/auth/security';  // Security utilities
import { ... } from '@parsrun/auth/providers'; // Auth providers
import { ... } from '@parsrun/auth/adapters';  // Framework adapters

License

MIT

Keywords

pars

FAQs

Package last updated on 02 Feb 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts