Registry / auth-security / auth-strategy-manager

auth-strategy-manager

JSON →
library2.0.2jsnpmunverified

Meta package for auth-strategy-manager that installs the core package by default. Version 2.0.2 ships bundled TypeScript types, supports Node.js and browser environments with ESM and CJS exports. It provides a unified strategy-based authentication and authorization abstraction layer, simplifying integration of multiple auth providers (e.g., JWT, OAuth, API keys) behind a consistent interface. Key differentiators include zero-config core setup via the meta package, first-class TypeScript support, and a plugin-style strategy architecture that avoids runtime dependencies beyond the core.

npm install auth-strategy-manager
INSTALL
IMPORT
SIG · AUTH-STRATEGY-MANA
A
auth-strategy-manager
auth-securityjavascriptv2.0.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

import 'auth-strategy-manager'
Meta package installs core; importing the meta package triggers side effects only. Use core for explicit members.
AuthStrategyManager
import { AuthStrategyManager } from '@auth-strategy-manager/core'
import { AuthStrategyManager } from 'auth-strategy-manager'
Named exports are from the core package, not the meta package. The meta package has no default export.
Strategy
import { Strategy } from '@auth-strategy-manager/core'
const { Strategy } = require('@auth-strategy-manager/core')
Package is ESM-only since v2. CommonJS require() will fail with dynamic import() required for CJS environments.

Initializes the Auth Strategy Manager, registers a JWT strategy with secret from environment variable, and authenticates a token.

import { AuthStrategyManager } from '@auth-strategy-manager/core'; const manager = new AuthStrategyManager(); // Define a simple JWT strategy manager.use('jwt', { type: 'jwt', secret: process.env.JWT_SECRET ?? 'fallback-secret', verify: async (token) => { // verify logic return { userId: '123' }; } }); // Authenticate a request async function authenticate(token: string) { const result = await manager.authenticate('jwt', token); if (result.success) { console.log('User:', result.payload); } else { console.error('Auth failed:', result.error); } } authenticate('some-token');
Debug
Known issues
breakingv2.0.0 renamed package from 'auth-manager-core' to '@auth-strategy-manager/core'. All imports must be updated.
fix
Replace 'auth-manager-core' with '@auth-strategy-manager/core' in imports and package.json dependencies.
affects: >=1.0.0 <2.0.0
breakingv2.0.0 dropped support for CommonJS (require). Package is ESM-only. Requires Node >=14 or bundler support.
fix
Use import syntax. For CJS environments, use dynamic import: const { AuthStrategyManager } = await import('@auth-strategy-manager/core');
affects: >=2.0.0
deprecatedv1.x strategy options with 'algorithm' property are deprecated in v2. Use 'algorithms' array instead.
fix
Replace 'algorithm: 'HS256'' with 'algorithms: ['HS256']'.
affects: >=2.0.0 <3.0.0
gotchaThe meta package 'auth-strategy-manager' is a side-effects-only package; it does not export any symbols. Attempting to import named exports from it will fail.
fix
Import directly from '@auth-strategy-manager/core' for any symbols.
affects: >=2.0.0
Errors
Common errors & fixes
Cannot find module '@auth-strategy-manager/core' or its corresponding type declarations.
Missing dependency: need to install @auth-strategy-manager/core separately or ensure meta package installs it correctly.
fix
Run: npm install @auth-strategy-manager/core
TypeError: authStrategyManager.use is not a function
Attempting to call .use() on an improperly initialized manager (e.g., using default import from meta package instead of core).
fix
Ensure you import AuthStrategyManager from '@auth-strategy-manager/core', not from 'auth-strategy-manager'.
ERR_REQUIRE_ESM: require() of ES Module not supported
Using require() to import an ESM-only package.
fix
Use import statement or dynamic import: const { AuthStrategyManager } = await import('@auth-strategy-manager/core');
Upgrade
Version history
2.0.2latest on npm
Audit
Dependencies
@auth-strategy-manager/corerequiredMeta package delegates all functionality to the core library; installed automatically.
Agent activity
31 hits · last 30 days
node
28
OpenAI (training)
1
Resources
auth-strategy-manager — npm install auth-strategy-manager · libregistry