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

@emblemvault/emblem-auth-react

v2.3.17

Published

React hooks and components for Emblem Auth integration

Downloads

486

Readme

@emblemvault/emblem-auth-react

React hooks and components for Emblem wallet authentication.

Installation

npm install @emblemvault/emblem-auth-react

Why Use Emblem Auth React?

This library provides a secure, user-friendly authentication experience for Emblem Vault applications:

  • Better Security: User-controlled wallet authentication instead of embedded API keys
  • Better UX: Modal-based wallet connection flow with session management
  • Auto Token Refresh: Handles JWT lifecycle automatically
  • Ready-to-use Components: Pre-built UI components like ConnectButton and AuthStatus

Migrating from API keys? This library replaces the deprecated apiKey prop pattern used in other Emblem packages. Users connect their own wallets instead of using a shared API key.

Quick Start

import {
  EmblemAuthProvider,
  ConnectButton,
  useEmblemAuth,
} from '@emblemvault/emblem-auth-react';

function App() {
  return (
    <EmblemAuthProvider appId="your-app-id">
      <Header />
      <Content />
    </EmblemAuthProvider>
  );
}

function Header() {
  return <ConnectButton showVaultInfo />;
}

function Content() {
  const { isAuthenticated, walletAddress, vaultId } = useEmblemAuth();

  if (!isAuthenticated) {
    return <p>Please connect to continue</p>;
  }

  return (
    <div>
      <p>Wallet: {walletAddress}</p>
      <p>Vault: {vaultId}</p>
    </div>
  );
}

API Reference

EmblemAuthProvider

Wrap your app to provide authentication context.

<EmblemAuthProvider
  appId="your-app-id"
  authUrl="https://auth.emblemvault.ai"  // optional - auth service for modal, init, bootstrap, refresh
  apiUrl="https://api.emblemvault.ai"    // optional - backend API for vault operations
>
  {children}
</EmblemAuthProvider>

Props:

  • appId (required) - Your registered application ID
  • authUrl (optional) - Auth service URL for authentication flow. Defaults to https://auth.emblemvault.ai
  • apiUrl (optional) - Backend API URL for vault operations. Defaults to https://api.emblemvault.ai
  • debug (optional) - Enable debug logging

useEmblemAuth

Access auth state and actions.

const {
  // State
  isAuthenticated,  // boolean
  isLoading,        // boolean
  error,            // Error | null
  session,          // AuthSession | null
  walletAddress,    // string | null
  vaultId,          // string | null
  authSDK,          // EmblemAuthSDK instance

  // Actions
  openAuthModal,    // () => Promise<void>
  logout,           // () => void
  refreshSession,   // () => Promise<void>
} = useEmblemAuth();

useEmblemAuthOptional

Same as useEmblemAuth but returns null when used outside EmblemAuthProvider instead of throwing an error.

When to use:

  • Components that may render with or without auth context
  • Libraries/packages that support multiple authentication strategies (e.g., user login OR API key)
  • Shared components used across apps with different auth setups
import { useEmblemAuthOptional } from '@emblemvault/emblem-auth-react';

function MyComponent() {
  const auth = useEmblemAuthOptional();

  // Gracefully handle missing provider
  if (!auth) {
    return <p>Auth provider not available</p>;
  }

  if (!auth.isAuthenticated) {
    return <button onClick={auth.openAuthModal}>Connect</button>;
  }

  return <p>Connected: {auth.walletAddress}</p>;
}

Comparison: | Hook | Outside Provider | |------|------------------| | useEmblemAuth() | Throws error | | useEmblemAuthOptional() | Returns null |

ConnectButton

Pre-styled connect/disconnect button.

<ConnectButton
  showVaultInfo    // Show vault dropdown when connected
  className=""     // Additional CSS classes
/>

AuthStatus

Display authentication status.

<AuthStatus
  showVaultInfo   // Show vault ID
  showLogout      // Show logout button
/>

Underlying SDK

This package wraps @emblemvault/auth-sdk for React. The SDK handles:

  • JWT lifecycle and token refresh
  • Wallet connection modal
  • Session management

For advanced usage, access the SDK directly via useEmblemAuth().authSDK.

License

MIT