OPTXOPTX DOCS
SDK Reference

@jettoptx/auth

553015

X OAuth PKCE + Solana signMessage + Ed25519 JWT for custom xChat Native integrations.

Note: jettoptx.chat (DOJO) uses Privy as its primary auth provider. Use @jettoptx/auth when building custom integrations outside the DOJO product — see JETT Auth.

The @jettoptx/auth package provides dual-mode authentication for xChat Native:

X OAuth 2.0 PKCE ──> X profile (identity verification)
Solana signMessage ──> wallet ownership proof

        Ed25519 JWT (tweetnacl)

        HttpOnly session cookie ("jettauth")

Source: jettoptx-sdk/packages/jettauth

Install

npm install @jettoptx/auth

Peer dependencies: next@^14, react@^18, @solana/web3.js@^1.95, @solana/wallet-adapter-react@^0.15

Exports

Entry PointImportContents
Core@jettoptx/authJWT, X OAuth, Solana auth, session, middleware
React@jettoptx/auth/nextAuthProvider, useAuth, useXOAuth, useSolanaAuth
API@jettoptx/auth/apiNext.js route handlers

Quick Start

Wrap your app

import { AuthProvider } from "@jettoptx/auth/next";

export function Providers({ children }: { children: React.ReactNode }) {
  return <AuthProvider>{children}</AuthProvider>;
}

Use auth hooks

import { useAuth, useXOAuth, useSolanaAuth } from "@jettoptx/auth/next";

function LoginPage() {
  const { isSignedIn, claims, signOut } = useAuth();
  const { startXOAuth } = useXOAuth();
  const { connectAndSign } = useSolanaAuth();
  // ...
}

Wire API routes

import { createXAuthHandler } from "@jettoptx/auth/api";

export const GET = createXAuthHandler({
  clientId: process.env.X_CLIENT_ID!,
  clientSecret: process.env.X_CLIENT_SECRET!,
  redirectUri: `${process.env.NEXT_PUBLIC_APP_URL}/api/auth/x/callback`,
});

JWT Claims

ClaimDescription
subUser identifier
x_handleX/Twitter username
walletSolana public key (if connected)
jtx_balanceCached JTX gate status

See the full API in the SDK repo README.