Navojit Auth

raw JSON →
4.0.0 verified Sat Apr 25 auth: no javascript

Navojit Auth v4.0.0 is a TypeScript-first universal authentication engine supporting Passkeys, Fastify, Mongoose, Drizzle ORM, and cross-language sync. It provides a unified auth layer for Node.js backends with built-in multi-tenancy. Peer dependencies include fastify >=4.0.0, mongoose >=8.0.0, drizzle-orm >=0.30.0, and postgres >=3.4.0. Differentiators: passkey-first design, multi-tenant by default, and cross-language session sync.

error Cannot find module 'navojit-auth' or its corresponding type declarations.
cause Package not installed or ESM-only usage in CJS project.
fix
Install the package: npm install navojit-auth and ensure type: 'module' in package.json.
error TypeError: NavojitAuth is not a constructor
cause Incorrect import using CommonJS `require` in v4.
fix
Change to ESM import: import { NavojitAuth } from 'navojit-auth'.
error Missing required peer dependency: mongoose@>=8.0.0
cause Mongoose not installed or version too low.
fix
Install mongoose v8+: npm install mongoose@8.
breaking ESM-only since v4. CommonJS `require()` will not work.
fix Use `import` syntax or update to ESM.
breaking Peer dependency `mongoose >=8.0.0` is required if using Mongoose integration.
fix Install mongoose v8 or later.
breaking Passkey provider requires `rpID` and `origin` to be configured.
fix Set `rpID` (e.g., 'localhost') and `origin` (e.g., 'http://localhost:3000').
gotcha Session secret must be at least 32 characters long.
fix Set `session.secret` to a string of length >= 32.
npm install navojit-auth
yarn add navojit-auth
pnpm add navojit-auth

Initializes NavojitAuth with passkey provider and generates registration options.

import { NavojitAuth } from 'navojit-auth';
const auth = new NavojitAuth({
  providers: {
    passkey: { rpID: 'localhost', origin: 'http://localhost:3000' },
  },
  session: { secret: process.env.SESSION_SECRET ?? 'change-me' },
});
// Generate passkey registration options
const options = await auth.generateRegistrationOptions({ userId: 'user123' });
console.log('Registration options:', options);