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

@phoenix-wallet/privy

v1.0.7

Published

Privy integration for Phoenix Wallet - Embedded wallet support

Downloads

356

Readme

@phoenix-wallet/privy

Privy authentication integration for Phoenix Wallet - seamless embedded wallet and social login support.

Overview

This package provides integration between Phoenix Wallet and Privy, enabling embedded wallets, social logins, and email authentication across multiple blockchains (EVM and Solana).

Features

  • 🔐 Embedded Wallets: Create wallets for users automatically
  • 🌐 Social Login: Google, Twitter, Discord, GitHub, and more
  • 📧 Email Authentication: Passwordless email login
  • ⛓️ Multi-Chain: Support for both EVM and Solana
  • 🔄 Seamless Integration: Works with Phoenix Wallet's universal interface
  • 🎨 Customizable UI: Full control over appearance and branding
  • 🔒 Secure: Industry-standard security with Privy's infrastructure

Installation

# Using pnpm (recommended)
pnpm add @phoenix-wallet/core @phoenix-wallet/privy @privy-io/react-auth

# Using npm
npm install @phoenix-wallet/core @phoenix-wallet/privy @privy-io/react-auth

# Using yarn
yarn add @phoenix-wallet/core @phoenix-wallet/privy @privy-io/react-auth

Quick Start

Basic Setup

import { PhoenixPrivyProvider } from '@phoenix-wallet/privy';

function App() {
  return (
    <PhoenixPrivyProvider
      appId="your-privy-app-id"
      enableEvm={true}
      enableSolana={true}
      privyConfig={{
        appearance: {
          theme: 'light',
          accentColor: '#3a86ff',
          logo: 'https://your-app.com/logo.png'
        },
        loginMethods: ['email', 'wallet', 'google', 'twitter'],
        embeddedWallets: {
          createOnLogin: 'users-without-wallets'
        }
      }}
      evmPrivyConnectorConfig={{
        id: 'privy-evm',
        name: 'Phoenix Auth (EVM)',
        logo: 'https://your-app.com/logo.png',
        dappMetadata: {
          name: 'My DApp',
          url: 'https://your-app.com',
          icon: 'https://your-app.com/icon.png'
        }
      }}
      solanaPrivyConnectorConfig={{
        id: 'privy-solana',
        name: 'Phoenix Auth (Solana)',
        logo: 'https://your-app.com/logo.png',
        dappMetadata: {
          name: 'My DApp - Solana',
          url: 'https://your-app.com',
          icon: 'https://your-app.com/icon.png'
        },
        chainId: 'solana_mainnet'
      }}
    >
      <YourApp />
    </PhoenixPrivyProvider>
  );
}

Using Privy Wallets

import { useWallet } from '@/hooks/useWallet';

function WalletComponent() {
  const { 
    wallet, 
    isConnected, 
    address, 
    connect, 
    disconnect 
  } = useWallet('privy-evm'); // or 'privy-solana'

  const handleConnect = async () => {
    await connect();
  };

  return (
    <div>
      {!isConnected ? (
        <button onClick={handleConnect}>
          Login with Email or Social
        </button>
      ) : (
        <div>
          <p>Connected: {address}</p>
          <button onClick={disconnect}>Logout</button>
        </div>
      )}
    </div>
  );
}

Configuration

Privy App Setup

  1. Create a Privy account at privy.io
  2. Create a new app in the Privy dashboard
  3. Copy your App ID
  4. Configure allowed domains and redirect URIs

Provider Configuration

Basic Configuration

<PhoenixPrivyProvider
  appId="your-privy-app-id"
  enableEvm={true}
  enableSolana={false}
  privyConfig={{
    appearance: {
      theme: 'light',
      accentColor: '#3a86ff'
    }
  }}
/>

Advanced Configuration

<PhoenixPrivyProvider
  appId="your-privy-app-id"
  enableEvm={true}
  enableSolana={true}
  privyConfig={{
    appearance: {
      theme: 'dark',
      accentColor: '#3a86ff',
      logo: 'https://your-app.com/logo.png',
      landingHeader: 'Welcome to My DApp',
      loginMessage: 'Sign in to continue',
      showWalletLoginFirst: false
    },
    loginMethods: [
      'email',
      'wallet',
      'google',
      'twitter',
      'discord',
      'github',
      'linkedin',
      'apple'
    ],
    embeddedWallets: {
      createOnLogin: 'users-without-wallets',
      requireUserPasswordOnCreate: false,
      noPromptOnSignature: false
    },
    mfa: {
      noPromptOnMfaRequired: false
    }
  }}
  evmPrivyConnectorConfig={{
    id: 'privy-evm',
    name: 'Phoenix Auth',
    logo: 'https://your-app.com/logo.png',
    dappMetadata: {
      name: 'My DApp',
      url: 'https://your-app.com',
      icon: 'https://your-app.com/icon.png'
    }
  }}
  solanaPrivyConnectorConfig={{
    id: 'privy-solana',
    name: 'Phoenix Auth (Solana)',
    logo: 'https://your-app.com/logo.png',
    dappMetadata: {
      name: 'My DApp - Solana',
      url: 'https://your-app.com',
      icon: 'https://your-app.com/icon.png'
    },
    chainId: 'solana_mainnet'
  }}
/>

Login Methods

Email Authentication

privyConfig={{
  loginMethods: ['email'],
  embeddedWallets: {
    createOnLogin: 'all-users'
  }
}}

Social Logins

privyConfig={{
  loginMethods: [
    'google',
    'twitter',
    'discord',
    'github',
    'linkedin',
    'apple'
  ]
}}

Wallet Connect

privyConfig={{
  loginMethods: ['wallet'],
  appearance: {
    showWalletLoginFirst: true
  }
}}

Combined Methods

privyConfig={{
  loginMethods: [
    'email',
    'wallet',
    'google',
    'twitter'
  ]
}}

Embedded Wallets

Auto-Create Wallets

privyConfig={{
  embeddedWallets: {
    createOnLogin: 'all-users', // Create for all users
    // or 'users-without-wallets' // Only for users without external wallets
    // or 'off' // Don't auto-create
  }
}}

Password Protection

privyConfig={{
  embeddedWallets: {
    createOnLogin: 'all-users',
    requireUserPasswordOnCreate: true // Require password for wallet
  }
}}

Signature Prompts

privyConfig={{
  embeddedWallets: {
    noPromptOnSignature: true // Don't prompt for each signature
  }
}}

Multi-Chain Support

EVM Chains

<PhoenixPrivyProvider
  appId="your-privy-app-id"
  enableEvm={true}
  evmPrivyConnectorConfig={{
    id: 'privy-evm',
    name: 'Phoenix Auth (EVM)',
    logo: 'https://your-app.com/logo.png',
    dappMetadata: {
      name: 'My DApp',
      url: 'https://your-app.com'
    }
  }}
/>

Solana

<PhoenixPrivyProvider
  appId="your-privy-app-id"
  enableSolana={true}
  solanaPrivyConnectorConfig={{
    id: 'privy-solana',
    name: 'Phoenix Auth (Solana)',
    logo: 'https://your-app.com/logo.png',
    dappMetadata: {
      name: 'My DApp - Solana',
      url: 'https://your-app.com'
    },
    chainId: 'solana_mainnet' // or 'solana_devnet', 'solana_testnet'
  }}
/>

Both EVM and Solana

<PhoenixPrivyProvider
  appId="your-privy-app-id"
  enableEvm={true}
  enableSolana={true}
  evmPrivyConnectorConfig={{ /* ... */ }}
  solanaPrivyConnectorConfig={{ /* ... */ }}
/>

Using with Phoenix Wallet

Universal Wallet Hook

import { useWallet } from '@/hooks/useWallet';

function MyComponent() {
  // Use Privy EVM wallet
  const evmWallet = useWallet('privy-evm');
  
  // Use Privy Solana wallet
  const solanaWallet = useWallet('privy-solana');
  
  return (
    <div>
      <button onClick={() => evmWallet.connect()}>
        Connect EVM
      </button>
      <button onClick={() => solanaWallet.connect()}>
        Connect Solana
      </button>
    </div>
  );
}

Transaction Signing

// EVM transaction
const evmWallet = useWallet('privy-evm');
if (evmWallet.wallet) {
  const txHash = await evmWallet.wallet.sendTransaction({
    to: '0x...',
    value: '0.1',
    data: '0x'
  });
}

// Solana transaction
const solanaWallet = useWallet('privy-solana');
if (solanaWallet.wallet) {
  const signature = await solanaWallet.wallet.sendTransaction(transaction);
}

Customization

Theme Customization

privyConfig={{
  appearance: {
    theme: 'dark', // or 'light'
    accentColor: '#3a86ff',
    logo: 'https://your-app.com/logo.png',
    landingHeader: 'Welcome!',
    loginMessage: 'Sign in to get started',
    showWalletLoginFirst: false
  }
}}

Custom Styling

privyConfig={{
  appearance: {
    theme: 'light',
    accentColor: '#3a86ff',
    // Add custom CSS
    walletList: {
      paddingTop: '20px',
      paddingBottom: '20px'
    }
  }
}}

Security Features

Multi-Factor Authentication

privyConfig={{
  mfa: {
    noPromptOnMfaRequired: false // Prompt users to enable MFA
  }
}}

Session Management

Privy handles session management automatically with secure token storage and refresh.

API Reference

PhoenixPrivyProvider Props

interface PhoenixPrivyProviderProps {
  appId: string;
  enableEvm?: boolean;
  enableSolana?: boolean;
  privyConfig?: PrivyClientConfig;
  evmPrivyConnectorConfig?: EvmPrivyConnectorConfig;
  solanaPrivyConnectorConfig?: SolanaPrivyConnectorConfig;
  children: React.ReactNode;
}

PrivyClientConfig

Full configuration options from @privy-io/react-auth. See Privy documentation for details.

Best Practices

  1. App ID Security: Keep your Privy App ID public-safe (it's designed to be client-side)
  2. Domain Whitelisting: Always configure allowed domains in Privy dashboard
  3. Embedded Wallets: Use users-without-wallets for best UX with external wallet users
  4. Error Handling: Always handle authentication errors gracefully
  5. Session Persistence: Privy handles this automatically, but test logout flows

Examples

Complete Integration Example

import { PhoenixPrivyProvider } from '@phoenix-wallet/privy';
import { WalletProvider } from '@phoenix-wallet/core';
import { useWallet } from '@/hooks/useWallet';

function App() {
  return (
    <PhoenixPrivyProvider
      appId={process.env.NEXT_PUBLIC_PRIVY_APP_ID}
      enableEvm={true}
      enableSolana={true}
      privyConfig={{
        appearance: {
          theme: 'light',
          accentColor: '#3a86ff',
          logo: '/logo.png'
        },
        loginMethods: ['email', 'google', 'wallet'],
        embeddedWallets: {
          createOnLogin: 'users-without-wallets'
        }
      }}
      evmPrivyConnectorConfig={{
        id: 'privy-evm',
        name: 'Phoenix Auth',
        logo: '/logo.png',
        dappMetadata: {
          name: 'My DApp',
          url: window.location.origin
        }
      }}
    >
      <Dashboard />
    </PhoenixPrivyProvider>
  );
}

function Dashboard() {
  const { wallet, connect, disconnect, isConnected } = useWallet('privy-evm');
  
  return (
    <div>
      {!isConnected ? (
        <button onClick={connect}>Login</button>
      ) : (
        <div>
          <p>Welcome! {wallet?.address}</p>
          <button onClick={disconnect}>Logout</button>
        </div>
      )}
    </div>
  );
}

TypeScript Support

Full TypeScript support with type definitions:

import type {
  PhoenixPrivyProviderProps,
  EvmPrivyConnectorConfig,
  SolanaPrivyConnectorConfig
} from '@phoenix-wallet/privy';

Related Packages

Resources

License

MIT

Support

For issues and questions, please visit our GitHub repository.