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 🙏

© 2026 – Pkg Stats / Ryan Hefner

pr0d-sdk

v1.0.34

Published

Authentication SDK for email, social, passkeys, and wallets.

Readme

pr0d SDK

A comprehensive React authentication SDK supporting multiple authentication methods including email, social OAuth, passkeys, and wallet connections.

Installation

npm install pr0d-sdk

Peer Dependencies

Install the required peer dependencies:

npm install @rainbow-me/rainbowkit@^2.0.0 @tanstack/react-query@^5.81.5 react@^18.0.0 react-dom@^18.0.0 viem@^2.31.7 wagmi@^2.15.6

Quick Start

import { Pr0dProvider, usePr0d } from 'pr0d-sdk';

function App() {
  return (
    <Pr0dProvider appId="your-app-id">
      <AuthComponent />
    </Pr0dProvider>
  );
}

function AuthComponent() {
  const { isAuthenticated, user, login, logout } = usePr0d();

  if (!isAuthenticated) {
    return (
      <div>
        <button onClick={login.withGoogle}>Login with Google</button>
        <button onClick={login.withPasskey}>Login with Passkey</button>
        <button onClick={() => login.withEmail('[email protected]', '123456')}>
          Login with Email
        </button>
      </div>
    );
  }

  return (
    <div>
      <h1>Welcome, {user?.email?.email}</h1>
      <button onClick={logout}>Logout</button>
    </div>
  );
}

Authentication Methods

Email Authentication

const { login, link } = usePr0d();

// Send email code
await login.sendEmailCode('[email protected]');

// Login with email code
await login.withEmail('[email protected]', '123456');

// Link email to existing account
await link.sendEmailCode('[email protected]');
await link.email('[email protected]', '123456');

Social OAuth

const { login, link } = usePr0d();

// Login with social providers
await login.withGoogle();
await login.withDiscord();
await login.withGithub();
await login.withX();

// Link social providers to existing account
await link.google();
await link.discord();
await link.github();
await link.x();

Passkey Authentication

const { login, link, helpers } = usePr0d();

// Check if passkeys are supported
if (helpers.isPasskeySupported) {
  // Login with passkey
  await login.withPasskey();
  
  // Link passkey to existing account
  await link.passkey();
}

Wallet Authentication

const { login, link, helpers } = usePr0d();

// Get available wallet connectors
const connectors = helpers.connectors;

// Login with wallet (auto-selects connector)
await login.withWallet();

// Login with specific wallet connector
await login.withWallet(connectors[0]);

// Link wallet to existing account
await link.wallet(connectors[0]);

TOTP (Time-based One-Time Password)

const { link, renderQRCode } = usePr0d();

// Generate TOTP QR code
const qrElement = document.getElementById('qr-code');
const { secret } = await renderQRCode(qrElement, '');

// Link TOTP with verification code
await link.totp('123456');

User Management

Check Authentication Status

const { isAuthenticated, user, ready } = usePr0d();

if (!ready) {
  return <div>Loading...</div>;
}

if (!isAuthenticated) {
  return <LoginComponent />;
}

return <Dashboard user={user} />;

Manage Authentication Methods

const { user, helpers, unlink } = usePr0d();

// Check which methods are linked
const linkedMethods = helpers.getLinkedMethods();
const hasEmail = helpers.hasLinked('email');
const hasWallet = helpers.hasLinked('wallet');

// Unlink methods
await unlink.email();
await unlink.wallet('0x1234...');
await unlink.passkey('credential-id');
await unlink.google();

Trigger Authentication Setup

const { 
  triggerMfaSetup, 
  triggerPasskeySetup, 
  triggerEmailLink, 
  triggerWalletLink 
} = usePr0d();

// Show MFA setup popup
const handleSetupMFA = () => {
  triggerMfaSetup();
};

// Show passkey setup popup
const handleSetupPasskey = () => {
  triggerPasskeySetup();
};

// Show email linking popup
const handleLinkEmail = () => {
  triggerEmailLink();
};

// Show wallet linking popup
const handleLinkWallet = () => {
  triggerWalletLink();
};

Session Management

const { sessions, logout } = usePr0d();

// Manual session refresh
await sessions.refreshSession();

// Logout (clears all tokens)
logout();

Error Handling

const { login } = usePr0d();

try {
  await login.withEmail('[email protected]', '123456');
} catch (error) {
  if (error.response?.status === 401) {
    console.error('Invalid credentials');
  } else {
    console.error('Login failed:', error.message);
  }
}

TypeScript Support

The SDK provides full TypeScript support with exported types:

import { User, AppConfig, usePr0d } from 'pr0d-sdk';

interface CustomUser extends User {
  customField?: string;
}

const { user } = usePr0d();
const typedUser = user as CustomUser;

API Reference

usePr0d Hook

Returns an object with the following properties:

Authentication State

  • isAuthenticated: boolean - Whether user is authenticated
  • user: User | null - Current user object
  • ready: boolean - Whether SDK is initialized
  • accessToken: string | null - Current access token

Login Methods

  • login.withEmail(email: string, code: string): Promise<void>
  • login.withGoogle(): Promise<void>
  • login.withDiscord(): Promise<void>
  • login.withGithub(): Promise<void>
  • login.withX(): Promise<void>
  • login.withPasskey(): Promise<void>
  • login.withWallet(connector?: any): Promise<void>
  • login.sendEmailCode(email: string): Promise<any>

Link Methods

  • link.email(email: string, code: string): Promise<void>
  • link.google(): Promise<void>
  • link.discord(): Promise<void>
  • link.github(): Promise<void>
  • link.x(): Promise<void>
  • link.passkey(): Promise<void>
  • link.wallet(connector?: any): Promise<void>
  • link.totp(code: string): Promise<void>
  • link.sendEmailCode(email: string): Promise<any>

Unlink Methods

  • unlink.email(): Promise<void>
  • unlink.google(): Promise<void>
  • unlink.discord(): Promise<void>
  • unlink.github(): Promise<void>
  • unlink.x(): Promise<void>
  • unlink.passkey(credentialID: string): Promise<void>
  • unlink.wallet(address: string): Promise<void>
  • unlink.totp(): Promise<void>

Helpers

  • helpers.isPasskeySupported: boolean
  • helpers.isConnected: boolean
  • helpers.address: string | undefined
  • helpers.hasLinked(method): boolean
  • helpers.getLinkedMethods(): string[]
  • helpers.getAvailableLoginMethods(): string[]
  • helpers.connectors: readonly any[]

Session Management

  • sessions.refreshSession(): Promise<void>
  • logout(): void

Utilities

  • renderQRCode(element: HTMLElement, data: string): Promise<{ secret: string }>
  • updateUser(): Promise<void>

Configuration

The SDK is configured at the app level through your pr0d dashboard. Available authentication methods are determined by your app configuration.

License

MIT