r/reactnative • • 15d ago

Pear: open-source E2E encrypted P2P messenger for Android (React Native + WebRTC, double ratchet) - feedback welcome

Enable HLS to view with audio, or disable this notification

Hey! I'm a French student and I've been building Pear, a private messaging app for Android, partly as a reaction to the EU "Chat Control" proposals.

Messages go directly phone to phone over WebRTC. Servers are only used to find each other and to wake the app up, and they only ever see encrypted data. Pairing is done via QR code (X25519) with a verification code to compare in person. Messages use a double ratchet, and each file is encrypted with its own key.

Features: photos, videos, voice messages, files, reactions, replies, edit/delete, encrypted backups, in-app updates from GitHub releases.

Stack: React Native/Expo, react-native-webrtc, Firebase (signaling), a small Vercel function for wake-ups, a custom Kotlin module.

Honest notes: it has NOT been security-audited, so don't use it for anything critical. I built it with heavy help from AI coding tools (Claude Code); the design and architecture choices are mine.

I'd love feedback on the crypto design and the UX.

GitHub: https://github.com/Louca90/Pear

7 Upvotes

12 comments sorted by

6

u/xDiablo96 14d ago

Man! These comments... It looks great, don't pay attention to what they r saying

2

u/Aggravating_Ice_1213 14d ago

Thank you 🙏

4

u/Romu1us1408 14d ago

So signal....

https://signal.org/

8

u/Aggravating_Ice_1213 14d ago

Does a personnal project open source needs to be original ? And its like signal but funnier with in app camera and filters (they don't look good atp but i will update them in the future).

2

u/threespire 14d ago

Why are you trying to roll your own cryptography?

What problem does your app solve?

2

u/Aggravating_Ice_1213 14d ago

Hello, i litterly wrote it on the post, the app is against chat control, its like signal but mote fun its just a personal project that i share here.

3

u/threespire 13d ago

My point about crypto was why aren't you just leveraging something like Themis rather than trying to roll your own crypto stack?

1

u/Aggravating_Ice_1213 12d ago

Fair point. To be precise, I'm not rolling

primitives: everything is built on libsodium/ noble. What's custom is the ratchet on top (Signal's Double Ratchet spec, with tests on skipped keys). The reason I didn't use Themis is that Pear sends messages asynchronously (offline, through FCM pushes, sometimes out of order), and as far as I can tell Secure Session is session/handshake-oriented and doesn't cover that. I also couldn't confirm it's usable from React Native. That said, I agree the ratchet is the part I'd rather not own: it's unaudited and labeled as a prototype.

1

u/Aggravating_Ice_1213 11d ago

Update: v1.7.1 and v1.8.0 are out, and a lot of it comes from the feedback in this thread. Thanks to everyone who read the code and commented.

Honest note: all the code is written by Claude. I'm French, I had the app idea in my head but I don't have the skills to code it yet, and I'm going to study to get there. I choose every feature, the UI and the animations. If that doesn't suit someone, they can just pass their way, I'm being upfront about it.

v1.7.1 (your feedback)

  • Honest pending status: "Waiting for contact · last try 14:32", or "Not sent yet · no connection" if nothing could leave the phone.
  • "Retry" button after 5 minutes, no delivery promise. Max 3 tries per hour, and only tries that actually left the device count.
  • Retries never advance the ratchet: the sealed packet is stored at first encryption and re-sent as the exact same bytes with the same id. The receiver recognizes an already-processed packet and only re-sends the ack, so no duplicates and no endless retry after a lost ack.
  • Long texts that don't fit in a push now go through the encrypted relay, then are deleted from it.
  • Skipped message keys with a cap were already there (MAX_SKIP 1000, 200 stored).
  • Doze / silent pushes: I added an optional "quiet" field (normal priority) on the server, but the app doesn't use it yet. In my tests the ack arrived too late, so acks stay on high priority for now.

v1.8.0 (new)

  • Audio and video calls, peer to peer and end-to-end encrypted, over the same WebRTC connection as the messages. No server in the middle.
  • The callee gets an encrypted push to wake the phone, and it rings once the direct connection is up. Known issue: ringing when the phone is locked or the app is closed doesn't work reliably yet, I'll fix it when I have time.
  • No TURN server, so calls fail when a direct connection isn't possible.
  • Both people need 1.8.0 to call each other.

Still a prototype, not independently audited, so don't trust it with anything critical. Feedback and code review welcome. Changelog and APK are in the GitHub releases.

1

u/davidbalbino 13d ago

nice project, and props for the honest notes tbh. On the crypto side, if the double ratchet is hand rolled I think is better to swap it for something already reviewed like libsignal (it has client bindings) or at least vodozemac. A custom ratchet is where the subtle bugs hide, even when the design is right. Also take a look at the battery with the app idle. Keeping the peer connection open in background drains a lot, so imo close it when the app goes to background and just rely on the FCM high priority data message to wake up and reconnect. Gonna try the QR pairing later 🙂

2

u/Aggravating_Ice_1213 13d ago

Merci pour le retour! Tu as raison sur le ratchet : il est fait maison (spec Signal sur libsodium/noble, avec des tests sur les clés sautées), mais il n'est pas audité et je l'annonce comme prototype. Passer sur une implémentation déjà revue comme libsignal ou vodozemac serait plus sûr, je regarde ce que ça demande côté React Native. Pour la batterie, l'app ne garde pas de connexion ouverte en arrière-plan: un push FCM haute priorité réveille l'app, elle se connecte au seul contact concerné puis se rendort. Je vais quand même vérifier que tout se coupe bien au passage en arrière-plan. Et dis-moi ce que ça donne pour le couplage QR.