npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@futureverse/next-auth

v1.0.6

Published

Provides an OAuth authentication provider for FuturePass with Next-Auth (Auth.js). This package enables server-side authentication in Next.js applications.

Readme

Futureverse Next Auth

Provides an OAuth authentication provider for FuturePass with Next-Auth (Auth.js). This package enables server-side authentication in Next.js applications.

Installation

npm:

npm install @futureverse/next-auth next-auth@beta --save
npm install wagmi viem @tanstack/react-query

yarn:

yarn add @futureverse/next-auth next-auth@beta
yarn add wagmi viem @tanstack/react-query

Usage

1. Configure Next-Auth

auth.ts

import NextAuth from 'next-auth';
import Futureverse from '@futureverse/next-auth/provider';
import { createNextAuthClient } from '@futureverse/next-auth';
import { QueryClient } from '@tanstack/react-query';

const clientId = '<your-futureverse-client-id>';

// Optional configuration
const authorizationUrl = 'https://login.passonline.cloud'; // Optional - defaults to production
const signerURL = 'https://signer.passonline.cloud'; // Optional - defaults to production  
const issuer = 'https://login.futureverse.cloud'; // Optional - defaults to production

export const { auth, handlers, signIn, signOut } = NextAuth({
  providers: [
    Futureverse({
      clientId,
      authority: authorizationUrl, // Optional
      issuer, // Optional
    }),
  ],
  session: {
    strategy: 'jwt',
  },
  secret: process.env.AUTH_SECRET, // Required - add to your .env file
  callbacks: {
    async jwt({ token, profile }) {
      // On first sign in, profile exists
      if (profile) {
        token.eoa = profile.eoa;
        token.custodian = profile.custodian;
        token.chainId = profile.chainId;
        token.futurepass = profile.futurepass;
        token.sub = profile.sub ?? undefined;
        token.profile = profile.profile;
      }
      return token;
    },
    async session({ session, token }) {
      session.user.eoa = token.eoa;
      session.user.custodian = token.custodian;
      session.user.chainId = token.chainId;
      session.user.futurepass = token.futurepass;
      session.user.sub = token.sub;
      session.user.profile = token.profile;
      return session;
    },
  },
});

// Create the Futureverse Next Auth client for client-side operations
export const authClient = createNextAuthClient({
  clientId,
  authorizationURL: authorizationUrl, // Optional
  signerURL, // Optional
  issuer, // Optional
  chainId: 7672, // Optional - defaults to TRN Mainnet
  hostWeb3SigningDomain: 'localhost:3000',
});

// Create query client
export const queryClient = new QueryClient();

2. Setup API Route

app/api/auth/[...nextauth]/route.ts

import { handlers } from '@/auth';

export const { GET, POST } = handlers;

3. Using Authentication

Server Components

import { auth } from '@/auth';

export default async function Page() {
  const session = await auth();
  
  if (!session) {
    return <div>Not authenticated</div>;
  }
  
  return (
    <div>
      <p>Welcome {session.user.futurepass}</p>
      <p>EOA: {session.user.eoa}</p>
    </div>
  );
}

Client Components

'use client';

import { useSession } from 'next-auth/react';
import { signIn, signOut } from 'next-auth/react';

export default function AuthButton() {
  const { data: session } = useSession();
  
  if (session) {
    return (
      <button onClick={() => signOut()}>
        Sign out
      </button>
    );
  }
  
  return (
    <button onClick={() => signIn('futureverse')}>
      Sign in with FuturePass
    </button>
  );
}

Session Types

The session object includes FuturePass-specific fields:

interface Session {
  user: {
    email?: string | null;
    name?: string | null;
    image?: string | null;
    eoa?: string;
    custodian?: string;
    chainId?: number;
    futurepass?: string;
    sub?: string;
    profile?: any;
  };
}

Environment Variables

Add to your .env.local:

AUTH_SECRET=your-auth-secret-here

Generate a secret using:

openssl rand -base64 32

Integration with Auth UI

For a complete authentication UI experience, use @futureverse/auth-ui which provides pre-built authentication components and flows for both Web3 wallets and FuturePass custodial authentication.

Learn More