Registry / auth-security / passji

passji

JSON →
library0.0.2jsnpmunverified

Passji is an OIDC-based authentication service that uses emoji identities and WebAuthn passkeys instead of passwords. Version 0.0.2 is currently available. It provides SDKs for React, Next.js (Auth.js), Better Auth, Express, Hono, and Passport.js. Key differentiators: pseudonymous by default (no email required), AI-native API keys for agents, and emoji-based user identity. It ships TypeScript types and is designed for modern web and AI agent authentication flows.

npm install passji
INSTALL
IMPORT
SIG · PASSJI
P
passji
auth-securityjavascriptv0.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.

createClient
import { createClient } from 'passji/client'
import { createClient } from 'passji'
Browser/client-side SDK is in the /client subpath.
createServer
import { createServer } from 'passji/server'
import { createServer } from 'passji'
Server-side SDK is in the /server subpath. Use this for code exchange and token verification.
PassjiProvider
import { PassjiProvider, usePassji } from 'passji/react'
import { PassjiProvider } from 'passji'
React components are exported from 'passji/react'.
Passji (NextAuth)
import Passji from 'passji/nextauth'
import { Passji } from 'passji/nextauth'
NextAuth provider is a default export from 'passji/nextauth'.
passji (Better Auth)
import { passji } from 'passji/better-auth'
import passji from 'passji/better-auth'
Better Auth helper is a named export 'passji' from 'passji/better-auth'.

Demonstrates client-side authorization URL generation with PKCE, server-side code exchange and ID token verification, and React hooks integration.

import { createClient } from 'passji/client'; import { createServer } from 'passji/server'; import { PassjiProvider, usePassji } from 'passji/react'; // Client-side: generate authorization URL with PKCE const client = createClient({ clientId: process.env.PASSJI_CLIENT_ID ?? '', redirectUri: 'http://localhost:3000/callback' }); const { url, codeVerifier } = await client.createAuthorizationURL(); // Server-side: exchange code for tokens const server = createServer({ clientId: process.env.PASSJI_CLIENT_ID ?? '', clientSecret: process.env.PASSJI_CLIENT_SECRET ?? '', redirectUri: 'http://localhost:3000/callback' }); const tokens = await server.exchangeCode('code', codeVerifier); const user = await server.verifyIdToken(tokens.idToken); console.log(user.emojiId); // React: use PassjiProvider and usePassji function App() { return ( <PassjiProvider clientId={process.env.PASSJI_CLIENT_ID ?? ''} onToken={(token) => fetch('/api/auth', { method: 'POST', body: JSON.stringify({ token }) })}> <LoginButton /> </PassjiProvider> ); } function LoginButton() { const { signIn, user } = usePassji(); if (user) return <span>{user.emojiId}</span>; return <button onClick={signIn}>Sign in</button>; }
Debug
Known issues
breakingImport paths differ by framework: /client, /server, /react, /nextauth, /better-auth, /passport. Importing from 'passji' only gives core types.
fix
Use the correct subpath import for your framework (e.g., 'passji/react' for React).
affects: >=0.0.1
gotchaThe client-side createClient() must be used only in browser environments; it generates PKCE code verifiers. Do not import from 'passji/server' on the client.
fix
Ensure server-side code uses 'passji/server' and client-side uses 'passji/client'.
affects: >=0.0.1
deprecatedNo deprecations known yet for version 0.0.2.
affects: none
gotchaThe React provider requires an onToken callback to send the token to your own API; it does not automatically handle server-side validation.
fix
Implement your own /api/auth endpoint that uses createServer to verify the token.
affects: >=0.0.1
gotchaExpress integration requires express-session to be installed; the package declares it as a peer dependency.
fix
Install express-session: npm install express-session
affects: >=0.0.1
Errors
Common errors & fixes
Cannot find module 'passji/client'
Import from 'passji/client' but the package is not installed or version is old.
fix
Install passji: npm install passji@latest
Passji is not defined (NextAuth)
Importing Passji as default but using named import.
fix
Use: import Passji from 'passji/nextauth' (default import)
Uncaught TypeError: Cannot destructure property 'signIn' of '(0 , ...).usePassji(...)' as it is undefined.
usePassji hook used outside of PassjiProvider.
fix
Wrap your component tree with <PassjiProvider> before using usePassji.
TypeError: client.createAuthorizationURL is not a function
Imported createClient from 'passji' instead of 'passji/client'.
fix
Change import to: import { createClient } from 'passji/client'
Upgrade
Version history
0.0.2latest on npm
Audit
Dependencies
expressoptionalFor Express server integration (server SDK)
express-sessionoptionalRequired for Express session support
honooptionalFor Hono framework integration
nextoptionalFor Next.js integration (nextauth export)
reactoptionalFor React client-side hooks and components
secretdefoptionalUsed for secret definition/schema
Agent activity
9 hits · last 30 days
node
8
OpenAI (training)
1
Resources
passji — npm install passji · libregistry