44
55## Project Overview
66
7- ** rektSafe** is a decentralized dead man's switch application for crypto and data inheritance. It uses threshold signature schemes (TSS) to securely pass digital assets to beneficiaries.
7+ ** rektSafe** is a decentralized dead man's switch application for crypto and data inheritance. It uses threshold signature schemes (TSS) to securely pass digital assets to beneficiaries, and now includes private transfers via zkSend .
88
99- ** Stack** : Next.js 15 + React 19 + TypeScript + Tailwind CSS
10- - ** Crypto** : Web Crypto API (Ed25519, AES-256-GCM, SHA-256)
10+ - ** Crypto** : Web Crypto API (Ed25519, AES-256-GCM, SHA-256), Privacy Cash SDK
1111- ** Theme** : Dark cypherpunk with neon accents
1212- ** Architecture** : Client-side only, static export (no SSR)
1313
@@ -19,12 +19,14 @@ rektsafe/
1919│ ├── vault/ # Crypto vault (TSS app)
2020│ │ ├── page.tsx # Vault page component
2121│ │ └── metadata.ts # Page-specific metadata
22+ │ ├── zksend/ # Private transfers (zkSend)
23+ │ │ ├── page.tsx # Main zkSend page
24+ │ │ ├── components/ # Shield/Send/Unshield/History sections
25+ │ │ ├── hooks/ # useBalances hook
26+ │ │ ├── lib/ # Privacy Cash SDK wrapper
27+ │ │ └── context/ # Transaction context
2228│ ├── privacy/ # Privacy policy page
23- │ │ ├── page.tsx
24- │ │ └── metadata.ts
2529│ ├── terms/ # Terms of service page
26- │ │ ├── page.tsx
27- │ │ └── metadata.ts
2830│ ├── globals.css # Cypherpunk theme variables
2931│ ├── layout.tsx # Root layout with navbar/footer
3032│ ├── page.tsx # Landing page
@@ -34,24 +36,25 @@ rektsafe/
3436│ ├── footer.tsx # Minimal footer
3537│ ├── hero.tsx # Animated hero section
3638│ ├── features.tsx # Feature cards
37- │ ├── how-it-works.tsx # Process steps
38- │ ├── tech-stack.tsx # Technology showcase
39- │ ├── cta.tsx # Call to action
39+ │ ├── how-it-works.tsx # Process steps with tabs
4040│ ├── wallet-provider.tsx # Wallet connection provider
41- │ ├── wallet-guard.tsx # Wallet auth guard for vault
41+ │ ├── wallet-session-provider.tsx # Session management
42+ │ ├── wallet-guard.tsx # Wallet auth guard
4243│ └── ui/ # shadcn/ui components
4344├── hooks/ # Custom React hooks
4445│ └── use-sns-name.ts # SNS domain resolution
45- ├── lib/
46+ ├── lib/ # Utilities and polyfills
47+ │ ├── browser-polyfills/ # Node.js polyfills
48+ │ │ ├── hasher-wasm-init.ts # WASM initialization
49+ │ │ ├── node-localstorage.ts # localStorage polyfill
50+ │ │ └── path.ts # Path polyfill
51+ │ ├── wallet-session.ts # Wallet session management
4652│ └── utils.ts # Utility functions (cn, etc.)
47- ├── public/ # Static assets
48- │ ├── favicon.svg # Main favicon
49- │ ├── favicon-32x32.svg # Small favicon
50- │ ├── apple-touch-icon.svg # Apple touch icon
51- │ ├── og-image.svg # Open Graph image
52- │ ├── site.webmanifest # PWA manifest
53- │ ├── robots.txt # SEO robots
54- │ └── sitemap.xml # SEO sitemap
53+ ├── public/wasm/ # WASM files for ZK proofs
54+ │ ├── light_wasm_hasher_bg.wasm
55+ │ ├── hasher_wasm_simd_bg.wasm
56+ │ ├── rektsafe.wasm
57+ │ └── rektsafe.zkey
5558├── .github/workflows/ # GitHub Actions
5659│ └── deploy.yml # Deploy to GitHub Pages
5760├── dist/ # Build output (excluded from git)
@@ -71,6 +74,8 @@ rektsafe/
7174| Animation | Framer Motion |
7275| Icons | Lucide React |
7376| Crypto | Web Crypto API |
77+ | Privacy | Privacy Cash SDK |
78+ | ZK Proofs | @lightprotocol/hasher .rs |
7479| Wallet | Reown AppKit + Solana |
7580
7681## Theme Colors
@@ -92,6 +97,19 @@ pnpm dev # Start dev server (http://localhost:3000)
9297pnpm build # Build static site to /dist
9398```
9499
100+ ## Environment Variables
101+
102+ ``` bash
103+ # Required: Get from https://cloud.reown.com
104+ NEXT_PUBLIC_REOWN_PROJECT_ID=your_project_id
105+
106+ # Required: Helius RPC for Solana
107+ NEXT_PUBLIC_HELIUS_RPC=https://mainnet.helius-rpc.com/? api-key=your_key
108+
109+ # Optional: Fallback Solana RPC
110+ NEXT_PUBLIC_SOLANA_RPC=https://api.mainnet-beta.solana.com
111+ ```
112+
95113## Deployment
96114
97115### GitHub Pages (Automated)
@@ -157,6 +175,7 @@ const nextConfig = {
157175| -------| -------------|
158176| ` / ` | Landing page |
159177| ` /vault/ ` | Crypto vault - TSS app |
178+ | ` /zksend/ ` | Private transfers - zkSend app |
160179| ` /privacy/ ` | Privacy policy |
161180| ` /terms/ ` | Terms of service |
162181
@@ -165,9 +184,11 @@ const nextConfig = {
165184Static files are generated in ` /dist/ ` :
166185- ` index.html ` - Home page
167186- ` vault/index.html ` - Crypto vault
187+ - ` zksend/index.html ` - Private transfers
168188- ` privacy/index.html ` - Privacy page
169189- ` terms/index.html ` - Terms page
170190- ` _next/ ` - JS/CSS assets
191+ - ` wasm/ ` - WASM files for ZK proofs
171192
172193** Note** : ` dist/ ` is excluded from git (see .gitignore)
173194
@@ -193,12 +214,18 @@ Static files are generated in `/dist/`:
193214- No API routes (client-side only)
194215- All dynamic routes must be pre-rendered
195216
217+ ### WASM loading errors
218+ - Ensure WASM files are in ` public/wasm/ `
219+ - Check ` keyBasePath ` in SDK calls uses correct path
220+ - For GitHub Pages, path resolution happens in ` hasher-wasm-init.ts `
221+
196222## Security Considerations
197223
198224- All crypto happens client-side via Web Crypto API
199225- No keys or data sent to servers
200226- Users responsible for key management
201227- Uses standard, audited algorithms only
228+ - Privacy Cash SDK for ZK-based privacy
202229
203230## Wallet Integration
204231
@@ -209,67 +236,104 @@ Reown AppKit (formerly WalletConnect) is integrated for Solana wallet connection
209236- Solflare (browser extension)
210237- Other wallets via WalletConnect QR
211238
212- ### Environment Variables
239+ ### Wallet Session
213240
214- ``` bash
215- # Required: Get from https://cloud.reown.com
216- NEXT_PUBLIC_REOWN_PROJECT_ID=your_project_id
241+ The app uses a wallet session system for zkSend:
217242
218- # Optional: Custom Solana RPC endpoint
219- NEXT_PUBLIC_SOLANA_RPC=https://api.mainnet-beta.solana.com
220- ```
221-
222- For production deployment, set ` NEXT_PUBLIC_REOWN_PROJECT_ID ` in GitHub repository secrets. See ` .env.example ` for reference.
243+ 1 . User connects wallet → signs message once
244+ 2 . Signature derives encryption key via ` EncryptionService `
245+ 3 . Session persists across navigation (in-memory)
246+ 4 . No need to sign again for shield/send/unshield operations
223247
224- ### Vault Access Control
225-
226- The ` /vault/ ` route is protected by ` WalletGuard ` component:
227- - Users must connect a Solana wallet before accessing vault features
228- - Wallet address is displayed in the navbar when connected
229- - Direct browser extension connection (no QR code modal for installed wallets)
230- - Shows "Install" button if wallet extension is not detected
231- - ** SNS Support** : If wallet has a .sol domain, it displays the domain name instead of address
248+ ** Signing Message:**
249+ ```
250+ Welcome to RektSafe. For Cypherpunks, By Cypherpunks
251+ ```
232252
233253### Components
234254
235255| Component | Purpose |
236256| -----------| ---------|
237257| ` wallet-provider.tsx ` | Initializes AppKit with Solana adapter |
238- | ` wallet-guard.tsx ` | Blocks vault access until wallet connected |
258+ | ` wallet-session-provider.tsx ` | Manages wallet session state |
259+ | ` wallet-guard.tsx ` | Blocks access until wallet connected & session initialized |
239260
240261### Hooks
241262
242263| Hook | Purpose |
243264| ------| ---------|
244265| ` useSnsName(address) ` | Resolves wallet address to SNS (.sol) domain name |
245- | ` useAppKitWallet ` | Direct wallet connection from ` @reown/appkit-wallet-button/react ` |
246-
247- ### Wallet Connection Implementation
248-
249- The wallet connection uses ` useAppKitWallet ` hook:
250- - Single hook instance handles all wallet connections
251- - Detects wallet installation via ` window.phantom ` and ` window.solflare `
252- - Direct connection to browser extensions without modal
253- - Falls back to WalletConnect QR code for "Other Wallets" option
266+ | ` useWalletSession() ` | Access wallet session state and initialization |
254267
255268### Usage in Components
256269
257270``` tsx
258271import { useAppKitAccount } from " @reown/appkit/react" ;
259- import { useSnsName } from " @/hooks/use-sns-name " ;
272+ import { useWalletSession } from " @/components/wallet-session-provider " ;
260273
261274function MyComponent() {
262275 const { isConnected, address } = useAppKitAccount ();
263- const { snsName , isLoading } = useSnsName ( address );
276+ const { isInitialized , isLoading } = useWalletSession ( );
264277
265- if (isConnected ) {
266- return <div >Connected: { snsName || address } </div >;
278+ if (isConnected && isInitialized ) {
279+ return <div >Ready for private transfers </div >;
267280 }
268281
269282 return <Button >Connect Wallet</Button >;
270283}
271284```
272285
286+ ## Privacy Cash SDK Integration
287+
288+ ### Overview
289+ The app integrates ` privacycash ` SDK for private transactions on Solana.
290+
291+ ### Supported Tokens
292+ - ** SOL** - Native Solana
293+ - ** USDC** - ` EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v `
294+ - ** USDT** - ` Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB `
295+
296+ ### SDK Wrapper
297+ Located at ` app/zksend/lib/privacy-cash-sdk.ts ` :
298+
299+ ``` typescript
300+ // Initialize with signature
301+ await privacyCashSDK .initializeWithSignature (signature );
302+ privacyCashSDK .setWalletAddress (address );
303+ privacyCashSDK .setTransactionSigner (signTransaction );
304+
305+ // Operations
306+ await privacyCashSDK .deposit (lamports );
307+ await privacyCashSDK .withdraw (lamports , recipient );
308+ await privacyCashSDK .getPrivateBalance ();
309+ ```
310+
311+ ### Required WASM Files
312+ - ` light_wasm_hasher_bg.wasm ` - Hasher for ZK proofs (SISD)
313+ - ` hasher_wasm_simd_bg.wasm ` - Hasher for ZK proofs (SIMD)
314+ - ` rektsafe.wasm ` - Circuit for proof generation
315+ - ` rektsafe.zkey ` - Proving key
316+
317+ ### Browser Polyfills
318+
319+ The SDK requires Node.js modules that need polyfills:
320+
321+ | Module | Polyfill Location |
322+ | --------| -------------------|
323+ | ` path ` | ` lib/browser-polyfills/path.ts ` |
324+ | ` node-localstorage ` | ` lib/browser-polyfills/node-localstorage.ts ` |
325+ | ` fs ` , ` os ` , etc. | ` fallback: false ` in webpack config |
326+
327+ ### Key Components
328+
329+ | Component | Purpose |
330+ | -----------| ---------|
331+ | ` shield-section.tsx ` | Deposit SOL into privacy pool |
332+ | ` send-section.tsx ` | Send private transfers |
333+ | ` unshield-section.tsx ` | Withdraw from privacy pool |
334+ | ` balance-card.tsx ` | Display public/private balances |
335+ | ` history-section.tsx ` | Transaction history |
336+
273337---
274338
275- Last updated: January 2026
339+ Last updated: February 2026
0 commit comments