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

vorld-auth-react

v0.2.2

Published

React SDK for Vorld Auth - Email OTP, OAuth, and Wallet authentication

Readme

vorld-auth-react

React SDK for Vorld Auth — passwordless authentication with Email OTP, OAuth, and Solana wallet support.

npm version

Installation

npm install vorld-auth-react

For wallet authentication (optional):

npm install @solana/web3.js

Quick Start

1. Wrap your app with the provider

"use client";

import { VorldAuthProvider } from "vorld-auth-react";
import { useMemo } from "react";

function useDeviceId() {
  return useMemo(() => {
    if (typeof window === "undefined") return undefined;
    const key = "vorld_device_id";
    let id = localStorage.getItem(key);
    if (!id) {
      id = crypto.randomUUID();
      localStorage.setItem(key, id);
    }
    return id;
  }, []);
}

export function Providers({ children }: { children: React.ReactNode }) {
  const deviceId = useDeviceId();

  return (
    <VorldAuthProvider
      appId="your-app-id"
      authUrl="https://auth.thevorld.com"
      deviceId={deviceId}
      onSessionExpired={() => {
        // Handle session expiry
      }}
    >
      {children}
    </VorldAuthProvider>
  );
}

2. Use the auth hook

"use client";

import { useState } from "react";
import { useVorldAuth } from "vorld-auth-react";

export function LoginPage() {
  const {
    user,
    isAuthenticated,
    isLoading,
    sendOTP,
    verifyOTP,
    signInWithGoogle,
    logout,
  } = useVorldAuth();

  const [email, setEmail] = useState("");
  const [otp, setOtp] = useState("");
  const [otpSent, setOtpSent] = useState(false);

  if (isLoading) return <div>Loading...</div>;

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

  return (
    <div>
      {!otpSent ? (
        <>
          <input
            type="email"
            value={email}
            onChange={(e) => setEmail(e.target.value)}
            placeholder="Enter your email"
          />
          <button onClick={() => { sendOTP(email); setOtpSent(true); }}>
            Send OTP
          </button>
          <button onClick={() => signInWithGoogle()}>
            Sign in with Google
          </button>
        </>
      ) : (
        <>
          <input
            type="text"
            value={otp}
            onChange={(e) => setOtp(e.target.value)}
            placeholder="Enter OTP"
          />
          <button onClick={() => verifyOTP(email, otp)}>Verify</button>
        </>
      )}
    </div>
  );
}

Provider Props

| Prop | Type | Required | Description | |--------------------|--------------------------------|----------|--------------------------------------------------| | appId | string | Yes | Your Vorld App ID | | authUrl | string | No | Auth server URL (default: https://auth.thevorld.com) | | deviceId | string | No | Device ID for token binding (recommended) | | platform | string | No | Platform identifier (default: "web") | | debug | boolean | No | Enable debug logging | | onAuthStateChange| (user: User \| null) => void | No | Called when auth state changes | | onSessionExpired | () => void | No | Called when session expires |

Hooks

useVorldAuth

const {
  user,              // User | null
  isAuthenticated,   // boolean
  isLoading,         // boolean
  error,             // string | null
  
  // Email OTP
  sendOTP,           // (email: string) => Promise<void>
  verifyOTP,         // (email: string, otp: string) => Promise<void>
  
  // OAuth
  signInWithGoogle,  // (returnTo?: string) => Promise<void>
  signInWithDiscord, // (returnTo?: string) => Promise<void>
  signInWithTwitter, // (returnTo?: string) => Promise<void>
  
  // Wallet
  signInWithWallet,  // () => Promise<void>
  
  // Session
  logout,            // () => Promise<void>
  refreshSession,    // () => Promise<void>
} = useVorldAuth();

useWallet

const {
  wallets,           // Wallet[]
  defaultWallet,     // Wallet | null
  isConnecting,      // boolean
  connectWallet,     // (nickname?: string) => Promise<void>
  disconnectWallet,  // (walletId: string) => Promise<void>
  signMessage,       // (message: string) => Promise<string>
  setDefaultWallet,  // (walletId: string) => Promise<void>
} = useWallet();

useSession

Lightweight hook for read-only session state:

const { user, isAuthenticated, isLoading, error } = useSession();

Components

import { OTPInput, GoogleButton, WalletButton } from "vorld-auth-react/components";

// OTP input with auto-submit
<OTPInput length={6} onComplete={(otp) => verifyOTP(email, otp)} />

// OAuth buttons
<GoogleButton onSuccess={() => router.push("/dashboard")} />

// Wallet button
<WalletButton onSuccess={() => router.push("/dashboard")} />

Supported Wallets

Phantom, Solflare, Backpack, Glow, Coin98

Requirements

  • React 18+ or 19
  • Node.js 18+

Links