# Wallet

### Architecture Overview

City Protocol's wallet layer is the identity and account-access foundation of every product built on the platform. It is designed to authenticate users, provision or connect wallets, and verify wallet-linked sessions across client and server boundaries using Privy and the City SDK.&#x20;

This module handles the full lifecycle from login to backend-verified identity, ensuring that every downstream product feature, including vault interactions, access-gated flows, and on-chain operations, are anchored to a cryptographically verified wallet session.

> Wallet integration uses **Privy** for client-side authentication and embedded wallet provisioning, and **@cityprotocol/core** for server-side identity verification. The architecture is stateless on the backend and framework-agnostic on the client.

***

### Key Components

<table><thead><tr><th width="124.109375">Component</th><th>Description</th></tr></thead><tbody><tr><td><strong>Privy Provider</strong></td><td>Wraps the React application tree and manages authentication state, login methods, and embedded wallet creation policy.</td></tr><tr><td><strong>Identity Token</strong></td><td>A signed token issued by Privy after authentication. It encodes the user's session and linked wallet, and is the sole credential your backend should trust.</td></tr><tr><td><strong>City SDK Verifier</strong></td><td>A server-side utility (<code>verifyPrivyWallet</code>) exposed by <code>@cityprotocol/core</code> that validates the identity token, extracts the user profile, and returns the associated wallet address.</td></tr><tr><td><strong>Wallet Gate</strong></td><td>A client-side component pattern that conditionally renders UI based on authentication state, and attaches the identity token to outbound API calls.</td></tr></tbody></table>


---

# Agent Instructions: 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://city-protocol.gitbook.io/docs/neofinance-as-a-service/wallet.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.
