Skip to content
Β 
Β 

Latest commit

Β 

History

22 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ†” GigID β€” Decentralized Identity for Gig Workers

Hackathon Project β€” A privacy-preserving digital identity platform that enables India's 150M+ gig workers to access financial services without traditional credit history.


🎯 What is GigID?

GigID gives gig workers a self-sovereign, verifiable digital identity by aggregating their income from multiple platforms (Uber, Swiggy, Upwork, etc.), hashing each credential with SHA-256, and allowing selective, consent-based sharing with banks and NBFCs.


πŸ—οΈ Architecture

GigID/
β”œβ”€β”€ backend/          # Node.js + Express API
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ routes/   # auth, profile, credentials, sharing, verification
β”‚   β”‚   β”œβ”€β”€ utils/    # crypto (DID + SHA-256 + ZKP), scoring (ML rules)
β”‚   β”‚   └── server.js
β”‚   β”œβ”€β”€ .env
β”‚   └── supabase_schema.sql
└── frontend/         # React + Vite + Tailwind CSS
    └── src/
        β”œβ”€β”€ pages/    # Landing, Auth, Worker, Bank, SharedProfile
        β”œβ”€β”€ components/
        β”œβ”€β”€ context/  # AuthContext
        └── lib/      # api.js, storage.js (offline cache)

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • A Supabase project (free tier works)

1. Clone & Setup

cd GigID

2. Supabase Setup

  1. Create a project at supabase.com
  2. Go to SQL Editor and run backend/supabase_schema.sql
  3. Copy your Project URL and service_role key from Settings β†’ API

3. Backend Setup

cd backend
cp .env.example .env
# Edit .env with your Supabase credentials
npm install
npm run dev

Backend runs on: http://localhost:5000

4. Frontend Setup

cd frontend
npm install
npm run dev

Frontend runs on: http://localhost:5173

5. WhatsApp Chatbot Setup (Twilio + Google Translate)

  1. Create a Twilio account and open the WhatsApp Sandbox.
  2. In Sandbox settings, set the webhook URL to:
    • https://<your-public-domain>/whatsapp/webhook
    • For local development, expose backend with ngrok or Cloudflare Tunnel.
  3. Create a Google Cloud service account with Cloud Translation API access.
  4. Set GOOGLE_APPLICATION_CREDENTIALS in backend/.env to the JSON key path.
  5. Restart backend and message the Twilio sandbox number.

πŸ”‘ Environment Variables

Backend .env

PORT=5000
JWT_SECRET=your_secret_here
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_SERVICE_KEY=your_service_role_key
FRONTEND_URL=http://localhost:5173

# Twilio WhatsApp
TWILIO_ACCOUNT_SID=your_twilio_account_sid
TWILIO_AUTH_TOKEN=your_twilio_auth_token
TWILIO_WHATSAPP_NUMBER=whatsapp:+14155238886
TWILIO_VALIDATE_SIGNATURE=false
TWILIO_WEBHOOK_URL=https://your-public-url/whatsapp/webhook

# Google Cloud Translation
GOOGLE_TRANSLATE_ENABLED=true
GOOGLE_CLOUD_PROJECT_ID=your_google_cloud_project_id
GOOGLE_APPLICATION_CREDENTIALS=C:/path/to/google-service-account.json

# PDF Authentication (LangChain + Gemini + optional pyHanko)
GOOGLE_API_KEY=your_google_ai_studio_api_key
GOOGLE_GENAI_MODEL=gemini-1.5-flash
PDF_LANGCHAIN_ENABLED=true
PYHANKO_ENABLED=false
PYHANKO_BIN=pyhanko
QPDF_BIN=qpdf
PDFINFO_BIN=pdfinfo
TESSERACT_BIN=tesseract
TESSERACT_LANG=eng
DOCTR_OCR_SCRIPT=
LAYOUTLMV3_ENABLED=true
LAYOUTLMV3_SCRIPT=scripts/layoutlmv3_extract.py
ISOFOREST_PYTHON_ENABLED=false
PYTHON_BIN=python

Optional Python packages for full LayoutLMv3 path:

  • pip install transformers torch pdf2image pytesseract
  • Install Poppler for pdf2image and Tesseract OCR on system PATH.

🧠 Core Features

Feature Implementation
Decentralized ID UUID + SHA-256 β†’ did:gigid:... format
Credential Hashing SHA-256 per credential, stored + verifiable
Selective Sharing Toggle income/ratings/skills/platforms per share link
ZKP Simulation Prove "income > β‚Ή20K" without revealing actual amount
Risk Scoring Rule-based: income stability + amount + rating + platforms
Federated Learning Score computed locally, only score sent to server
Offline Support localStorage cache β€” profile loads without internet
WhatsApp Sharing One-click share link via WhatsApp
Multilingual WhatsApp Bot Twilio webhook + Google Translate auto language detection/reply
Bank Dashboard Search workers, verify DIDs, view credit profiles, loan decisions

πŸ“‘ API Reference

Auth

POST /auth/signup    β€” Create account (worker or bank)
POST /auth/login     β€” Login, get JWT

Profile

GET  /profile        β€” Get worker profile
POST /profile        β€” Create/update profile
PUT  /profile        β€” Partial update

Credentials

POST /credentials              β€” Add income credential (auto-hashed)
GET  /credentials              β€” List all credentials (with hash verification)
DELETE /credentials/:id        β€” Revoke credential
POST /credentials/parse-statement β€” Parse bank statement (mock)

Sharing

POST /sharing/settings         β€” Update sharing toggles
GET  /sharing/settings         β€” Get current settings
POST /sharing/generate-link    β€” Generate 7-day share token
GET  /sharing/:token           β€” Public: view shared profile

Verification

GET  /verify/verify/:did       β€” Verify a DID + all credentials
GET  /verify/risk-score-me     β€” Get your own risk score
GET  /verify/risk-score/:userId β€” Bank: get user risk score
POST /verify/zkp-proof         β€” Generate ZKP boolean proof
GET  /verify/credit-profile/:did β€” Bank: full credit profile
GET  /verify/search-workers    β€” Bank: search worker database
POST /verify/pdf-authenticate  β€” Worker: layered PDF authentication pipeline

PDF Authenticate Example

curl -X POST http://localhost:5000/verify/pdf-authenticate \
    -H "Authorization: Bearer <JWT_TOKEN>" \
    -F "statement=@demo/bank-statement-clean.pdf" \
    -F "smsMatchRatio=0.8"

Pipeline order returned by POST /verify/pdf-authenticate:

  1. Signature Check (pyHanko)
  2. Metadata + Structure (qpdf/pdfinfo)
  3. Text Extraction (DocTR/Tesseract + LayoutLMv3 assist)
  4. LangChain Extraction (LLM fallback -> JSON)
  5. Rule Engine + IsolationForest
  6. Decision (ACCEPT / REVIEW / REJECT)

WhatsApp Bot

POST /whatsapp/webhook         β€” Twilio WhatsApp webhook (multilingual auto-reply)
GET  /whatsapp/health          β€” Bot health check

🎨 Pages

Worker Flow

  1. / β€” Landing page with features + CTA
  2. /signup β€” Create GigID (worker or bank)
  3. /dashboard β€” Overview: score, credentials, share link
  4. /credentials β€” Add/manage income credentials
  5. /sharing β€” Toggle data fields + generate shareable link
  6. /risk-score β€” Full credit score + ZKP panel + income chart
  7. /profile β€” Edit personal profile

Bank Flow

  1. /bank β€” Dashboard with worker analytics
  2. /bank/search β€” Search by name or verify DID
  3. /bank/worker/:did β€” Full credit profile + loan decision panel

Public

  • /share/:token β€” Public shared profile (consent-gated data)

πŸ” Privacy & Security

  • SHA-256 hashing β€” Every credential is hashed; tampering is detectable
  • Selective disclosure β€” Workers control which fields are shared
  • ZKP simulation β€” Boolean proofs without revealing raw data
  • JWT auth β€” 7-day tokens, role-based access control
  • Revocation β€” Any credential can be revoked; new version created
  • Offline-first β€” LocalStorage cache for low-connectivity areas

πŸ† Hackathon Judging Criteria

Criterion How GigID Excels
Innovation DID + ZKP simulation + federated scoring
Impact 150M gig workers β†’ financial inclusion
Feasibility Bank statements + manual input β†’ works today
Privacy SHA-256 + selective sharing + ZKP proofs
Technical Clean REST APIs + modular architecture
UX Mobile-first, inclusive, step-by-step flows

πŸ“± Demo Accounts

After running the schema and starting the backend, register via the UI:

  • Worker: Sign up at /signup with role "Gig Worker"
  • Bank: Sign up at /signup with role "Bank / NBFC"

Built with ❀️ for India's gig economy

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages