> For the complete documentation index, see [llms.txt](https://nakis-organization.gitbook.io/naki-wallet/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nakis-organization.gitbook.io/naki-wallet/privy-integration.md).

# Privy Integration

## Privy Integration 🔑

### What is Privy? 🤔

Privy is a powerful authentication and wallet infrastructure for Web3 applications that simplifies user onboarding. It enables applications to create embedded wallets for users without requiring them to manage private keys or seed phrases, significantly reducing the barriers to entry for blockchain applications.

### Implementation in Naki Wallet 🛠️

We've deeply integrated Privy throughout Naki Wallet to provide a seamless authentication and wallet management experience:

1. **Email Authentication**:
   * Users verify their identity with just an email
   * One-time verification codes sent via Privy
   * No passwords to remember or reset
2. **Automatic Wallet Creation**:

   ```typescript
   // AutoWalletCreator component in _layout.tsx
   function AutoWalletCreator() {
     const { user, isReady } = usePrivy();
     const wallet = useEmbeddedWallet();
     
     useEffect(() => {
       const setupWallet = async () => {
         if (!isReady || !user) return;
         
         try {
           if (wallet.status === 'not-created') {
             await wallet.create();
           }
           
           // Network setup for Base Testnet
           if (wallet.status === 'connected') {
             // Chain switching logic
           }
         } catch (error) {
           console.error('Error setting up wallet:', error);
         }
       };
       
       setupWallet();
     }, [isReady, user, wallet]);
     
     return null;
   }
   ```
3. **Wallet Management**:
   * Handles key creation, storage, and signing
   * Automatic Base Testnet selection
   * Transaction signing without user complexity
4. **User Management**:
   * User records created and maintained in Privy
   * Authentication session handling
   * User identifiers linked to wallet addresses

### Statistics and Dashboard 📊

Our Privy integration is fully functional, with real users being created during testing and the hackathon. Below is what our Privy dashboard looks like with active user registrations:

<figure><img src="/files/VpTIRDrnZKQuSorKubi2" alt=""><figcaption></figcaption></figure>

The dashboard shows:

* Total number of registered users
* Authentication methods used (all email in our implementation)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://nakis-organization.gitbook.io/naki-wallet/privy-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
