Skip to content

adityaxp/secure-chat

Repository files navigation

secure-chat

P2P chat app built with Expo + React Native.

Supports two uplink modes:

  • Online chat: peer discovery/signaling over WebSocket + P2P data channel
  • Local chat: Bluetooth Low Energy (BLE) chat using react-native-ble-plx

Setup

npm install

Create .env in project root:

EXPO_PUBLIC_SIGNALING_URL=ws://<your-ip>:8080
# or
# EXPO_PUBLIC_SIGNALING_WS_URL=ws://<your-ip>:8080

The app reads either variable from services/env.ts.

Run

npx expo start

Expo Go not supported as BLE and WebRTC use native modules make a custom dev build. Use expo-prebuild or eas-cli to build.

Build and run on device/emulator:

npx expo run:android
# or
npx expo run:ios

Run lint:

npm run lint

Signaling Server

Check out secure-chat-signaling

BLE Notes

  • BLE requires Bluetooth enabled and runtime permissions.
  • For best reliability, test on two physical devices nearby.
  • Current BLE service uses UART-like UUIDs inside services/chatSessionBluetooth.ts.
  • If your peer peripheral uses different service/characteristic UUIDs, update:
    • CHAT_SERVICE_UUID
    • CHAT_TX_CHAR_UUID
    • CHAT_RX_CHAR_UUID

Project Scripts

  • npm run android - build + run Android
  • npm run ios - build + run iOS
  • npm run web - web preview (limited for native features)
  • npm run lint - lint project

Folder structure

  • app/ - routes/screens (onboarding, user, chat)
  • services/chatSession.ts - internet/WebRTC session logic
  • services/chatSessionBluetooth.ts - BLE session logic
  • store/ - Zustand stores for user/chat/session state
secure-chat.mp4

About

Real-time peer-to-peer chat application featuring end-to-end encryption, WebRTC, and BLE. Built with Expo + React Native.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors