Skip to content

sonmessia/walrus-vault

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

6 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ” WalrusVault

A decentralized encrypted file vault built on Sui + Walrus + zkLogin.

๐ŸŒŸ Features

  • Zero-Knowledge Authentication: Login with Google using zkLogin (no passwords!)
  • End-to-End Encryption: Files are encrypted client-side before upload
  • Decentralized Storage: Files stored on Walrus (decentralized blob storage)
  • On-Chain Metadata: File metadata secured on Sui blockchain
  • Secure Sharing: Share encrypted files with other users via Sui addresses

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Frontend  โ”‚ (React + TypeScript + Tailwind)
โ”‚  (zkLogin)  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚
       โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
       โ”‚             โ”‚
       โ–ผ             โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Walrus     โ”‚ โ”‚  Sui Chain   โ”‚
โ”‚  (Storage)  โ”‚ โ”‚  (Metadata)  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿš€ Quick Start

Prerequisites

1. Clone & Install

cd walrus-vault/frontend
npm install

2. Configure Environment

Create .env file:

VITE_ZKLOGIN_CLIENT_ID=your-google-client-id
VITE_ZKLOGIN_REDIRECT_URI=http://localhost:5173/auth/callback
VITE_SUI_NETWORK=testnet
VITE_SUI_PACKAGE_ID=<deployed-package-id>
VITE_WALRUS_API_URL=https://publisher.walrus-testnet.walrus.space
VITE_WALRUS_AGGREGATOR_URL=https://aggregator.walrus-testnet.walrus.space

3. Deploy Move Contract

cd ../move
sui client switch --env testnet
sui move build
sui client publish --gas-budget 100000000

Copy the published package ID to .env as VITE_SUI_PACKAGE_ID.

4. Run Frontend

cd ../frontend
npm run dev

Visit http://localhost:5173

๐Ÿ“– How It Works

1. Authentication (zkLogin)

  • User clicks "Continue with Google"
  • Google OAuth flow generates JWT
  • JWT + ephemeral keypair โ†’ Sui address (deterministic)
  • User's keypair stored in session

2. File Upload

  • File encrypted with AES-256-GCM (symmetric key)
  • Symmetric key encrypted with user's public key
  • Encrypted file โ†’ uploaded to Walrus โ†’ returns CID
  • Metadata (CID, encrypted key, URI) โ†’ stored on Sui

3. File Download

  • Fetch metadata from Sui (by object ID)
  • Download encrypted file from Walrus (by CID)
  • Decrypt symmetric key with user's private key
  • Decrypt file with symmetric key
  • Download to browser

4. File Sharing

  • Owner re-encrypts symmetric key with recipient's public key
  • Call add_grantee() on Sui with recipient address + re-encrypted key
  • Recipient can now decrypt the file

๐Ÿ” Security Model

  • Client-Side Encryption: Files never leave device unencrypted
  • Zero-Knowledge Login: No passwords stored anywhere
  • Key Derivation: User keys derived from JWT + PIN (optional)
  • Access Control: On-chain verification of file ownership & sharing

๐Ÿงช Testing

  1. Login via zkLogin (Google)
  2. Upload a file (e.g., test.pdf)
  3. Verify metadata on Sui Explorer
  4. Download the file (decrypts automatically)
  5. Share with another Sui address
  6. Recipient can download & decrypt

๐Ÿ“ฆ Tech Stack

Frontend

  • React 18 + TypeScript
  • Vite (build tool)
  • Tailwind CSS (styling)
  • @mysten/dapp-kit (Sui wallet integration)
  • @mysten/zklogin (authentication)
  • TweetNaCl (encryption)

Backend (On-Chain)

  • Sui Move (smart contracts)
  • Walrus (decentralized storage)

๐Ÿ› ๏ธ Project Structure

walrus-vault/
โ”œโ”€โ”€ frontend/
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/      # React components
โ”‚   โ”‚   โ”œโ”€โ”€ hooks/           # Custom hooks
โ”‚   โ”‚   โ”œโ”€โ”€ utils/           # Encryption, Walrus, Sui utils
โ”‚   โ”‚   โ”œโ”€โ”€ types/           # TypeScript types
โ”‚   โ”‚   โ””โ”€โ”€ App.tsx
โ”‚   โ””โ”€โ”€ package.json
โ””โ”€โ”€ move/
    โ”œโ”€โ”€ sources/
    โ”‚   โ””โ”€โ”€ walrus_vault.move
    โ””โ”€โ”€ Move.toml

๐Ÿ› Troubleshooting

zkLogin Issues

  • Ensure VITE_ZKLOGIN_CLIENT_ID is correct
  • Check redirect URI matches Google OAuth settings
  • Clear browser cache & localStorage

Walrus Upload Fails

  • Check network (testnet/mainnet)
  • Verify Walrus endpoints are reachable
  • Ensure file size is within limits

Sui Transaction Fails

  • Check gas balance (sui client gas)
  • Verify package ID is correct
  • Check transaction on Sui Explorer

๐Ÿ”ฎ Future Enhancements

  • Support multiple OAuth providers (GitHub, Discord)
  • File versioning & history
  • Folder organization
  • Public/private file links
  • File expiration (time-locked encryption)
  • Mobile app (React Native)

๐Ÿ“„ License

MIT

๐Ÿค Contributing

PRs welcome! Please open an issue first to discuss changes.


Built with โค๏ธ on Sui + Walrus

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors