passji
v0.0.2
Published
Passji - Auth for the AI era
Maintainers
Readme
passji
Your emoji is your identity. passji.com
Add "Continue with Passji" to your app. Users pick 3-7 emoji, authenticate with Face ID / fingerprint, done.
- No passwords — Passkeys only (Face ID, fingerprint, YubiKey)
- No email required — Pseudonymous by default
- Standard OIDC — Works with any OAuth library
- AI-native — API keys for agents, delegated tokens for human+agent flows
Install
npm install passjiNext.js / Auth.js
import NextAuth from "next-auth";
import Passji from "passji/nextauth";
export default NextAuth({
providers: [
Passji({
clientId: process.env.PASSJI_CLIENT_ID!,
clientSecret: process.env.PASSJI_CLIENT_SECRET!,
}),
],
});Better Auth
import { betterAuth } from "better-auth";
import { passji } from "passji/better-auth";
export const auth = betterAuth({
socialProviders: {
passji: passji({
clientId: process.env.PASSJI_CLIENT_ID!,
clientSecret: process.env.PASSJI_CLIENT_SECRET!,
}),
},
});React
import { PassjiProvider, usePassji } from "passji/react";
function LoginButton() {
const { signIn, user } = usePassji();
if (user) return <span>{user.emojiId}</span>;
return <button onClick={signIn}>Sign in</button>;
}
// Token validated by your API (which has the secret)
<PassjiProvider
clientId="your_client_id"
onToken={(token) =>
fetch("/api/auth", {
method: "POST",
body: JSON.stringify({ token }),
})
}
>
<LoginButton />
</PassjiProvider>;Server-side (Express, etc.)
import { createClient } from "passji/client";
import { createServer } from "passji/server";
// Client: generate auth URL with PKCE
const client = createClient({
clientId: "your_client_id",
redirectUri: "https://yourapp.com/callback",
});
const { url, codeVerifier } = await client.createAuthorizationURL();
// Server: exchange code for tokens
const server = createServer({
clientId: "your_client_id",
clientSecret: "your_client_secret",
redirectUri: "https://yourapp.com/callback",
});
const tokens = await server.exchangeCode(code, codeVerifier);
const user = await server.verifyIdToken(tokens.idToken);All Exports
| Export | Description |
| -------------------- | ------------------------- |
| passji | Core types |
| passji/client | Browser/client-side SDK |
| passji/server | Server-side SDK |
| passji/react | React hooks & components |
| passji/nextauth | NextAuth/Auth.js provider |
| passji/better-auth | Better Auth helper |
| passji/passport | Passport.js config |
