Skip to content

K-Tanish/emotion-aware-hackathon-prototype

Repository files navigation

Mini Emotion Cipher

Emotion-Aware Encryption — Encrypt messages with AES-256-GCM while embedding an emotional fingerprint (EmoTag) inside the ciphertext. Emotions are detected before encryption and recovered after decryption with no external storage.

Built for the UnsaidTalks Hackathon (Theme: AI + NLP + Encryption Logic).

Features

  • Emotion detection — Lexicon-weighted scoring over 8 emotions (Plutchik-style): Joy, Sadness, Anger, Fear, Surprise, Disgust, Trust, Anxiety
  • EmoVault protocol — Custom payload: version + EmoTag byte (primary + secondary emotion nibbles) + AES-256-GCM(iv, authTag, ciphertext)
  • REST APIPOST /api/analyze, POST /api/encrypt, POST /api/decrypt
  • React frontend — Analyze, Encrypt, Decrypt with emotion pills and cipher display

Quick start

# Install root + frontend
npm run install:all

# Start backend (port 3000)
npm start

# In another terminal: frontend dev (port 5173, proxies /api to 3000)
cd frontend && npm run dev

Open http://localhost:5173. For production, build the frontend and serve from the same server:

npm run build
npm start
# Frontend at http://localhost:3000

Project structure

├── server.js           # Express server
├── api/routes.js        # /api/analyze, /encrypt, /decrypt
├── emotion_codec.js     # Emotion labels ↔ EmoTag byte
├── emotion_lexicon.js   # Weighted word → emotion
├── emotion_engine.js    # Lexicon-based emotion detection
├── emovault.js          # AES-256-GCM + steganography
└── frontend/            # Vite + React SPA

API

  • POST /api/analyze — Body: { "text": "..." }. Returns { emotions, scores, primary, secondary, emoTag, confidence }.
  • POST /api/encrypt — Body: { "text": "...", "password": "optional" }. Returns { ciphertextBase64, ivBase64, emotions }.
  • POST /api/decrypt — Body: { "ciphertextBase64": "...", "password": "optional" }. Returns { plaintext, emotions }.

Security note

The default password is default-key when omitted. For real use, require a strong user password and consider a proper key derivation flow (e.g. Argon2) and secure storage.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors