Show HN: Terminal Phone – E2EE Walkie Talkie from the Command Line
235 points
7 hours ago
| 14 comments
| gitlab.com
| HN
TerminalPhone is a single, self-contained Bash script that provides anonymous, end-to-end encrypted voice and text communication between two parties over the Tor network. It operates as a walkie-talkie: you record a voice message, and it is compressed, encrypted, and transmitted to the remote party as a single unit. You can also send encrypted text messages during a call. No server infrastructure, no accounts, no phone numbers. Your Tor hidden service .onion address is your identity.
Pinkert
7 hours ago
[-]
Using a v3 onion address as both the cryptographic identity and the NAT traversal layer is such a clean architectural choice. No STUN/TURN servers, no hole punching, you just boot the script and Tor handles routing.

For those who use Tor regularly for things other than web browsing: how bad is the real-world latency for pushing a ~20KB Opus audio chunk over Tor these days? Are we talking a 2-3 second delay, or is it much worse?

reply
smalltorch
6 hours ago
[-]
The real world delay is about 2-3 seconds your spot on. I initially started with a full duplex version but it was absolutely terrible. Walkie talkie kinda forces the recieve, listen, response from the users so the latency isn't as much of an issue.
reply
ale42
6 hours ago
[-]
Is audio transmitted while it is being recorded or afterwards? Is it played before everything is received or is everything buffered? In the later case, I find it more akin an audio message on Signal or similar, than as a walkie-talkie, which is much more "dynamic".
reply
smalltorch
6 hours ago
[-]
It's not streamed. It gets recorded, compressed, (voice effects if you want), encrypted on device, then piped through, reverse process, auto played on reciever end.

Also, once it's decrypted and played back, the message gets destroyed.

reply
iamnothere
4 hours ago
[-]
Small suggestion, maybe you should send a “key down” notice when you begin recording, that generates a subtle sound on the receiving end. This would act as something like a typing indicator on a text messaging client.
reply
smalltorch
4 hours ago
[-]
Thats a great idea.
reply
bzmrgonz
3 hours ago
[-]
Can you tell us which ai minion(s) helped you with this?
reply
jetbalsa
2 hours ago
[-]
there are ways to help with lag a bit, you can choose the number of hops a HS uses when meeting up. but of course that comes with downsides
reply
nunobrito
5 hours ago
[-]
STUN/TUN are important because of bandwidth. With STUN the bandwidth used is only between the two connected devices, with VPN like Tor there is a bandwidth cost on all the servers where this data is passing. This is a big blocker for anyone hosting the service on a VPS with a few GB of traffic data per month.
reply
idiotsecant
6 hours ago
[-]
Beep boop
reply
iamnothere
5 hours ago
[-]
Very cool, happy to see more IRL applications of onion services as a backend. Arti onion client support should soon be available, which will make Tor embeddable in applications as a Rust library. Hopefully this encourages even more usage.

More applications using the network means more cover traffic as well.

reply
lxgr
6 hours ago
[-]
> 21 curated ciphers are available

Why!? That sounds like approximately 20 too many.

reply
smalltorch
6 hours ago
[-]
The library is openssl and that comes with all these ciphers available. No other reason than because we can!

I wish AES-GCM was available...but openssl can't do it on its own without further dependencies to parse the authentication correctly.

Really this whole layer is complelty redundant actually. It's already E2EE without openssl via Tor. I like that it's encrypted before I hit the network pipe though.

reply
john_strinlai
2 hours ago
[-]
>No other reason than because we can!

great attitude for approximately everything except, perhaps, cryptography.

especially since the initial encryption is mostly redundant, i would encourage that you, at some point, consider reducing the number of ciphers.

reply
inigyou
5 hours ago
[-]
If a library doesn't do what you need, you need a different library, but this is impossible from a short bash script, so it's one of the tradeoffs of your design.
reply
lxgr
5 hours ago
[-]
> No other reason than because we can!

Then maybe your scientists should spend some time to stop and consider whether they should ;)

But seriously, I'd just limit this to one option on the selection side, even if you continue supporting more than that at the protocol level for cryptographic agility.

reply
Bender
4 hours ago
[-]
I would rather avoid cipher fixation. Give me thousands of protocol / cipher / mac / mode combinations. Fixation only benefits nations wanting to crack something.
reply
Bender
4 hours ago
[-]
I think that's great. Cipher fixation is a vulnerability as the enemy knows what to attack.
reply
lxgr
1 hour ago
[-]
This understanding of cryptography is so outdated that we don't even have a color photograph of the person first refuting it: https://en.wikipedia.org/wiki/Kerckhoffs%27s_principle
reply
aitchnyu
4 hours ago
[-]
Tangential, did Gitlab become faster than a while back or is it an illusion from their lazy loading?
reply
rustyhancock
7 hours ago
[-]
> Exclude Countries -- Exclude specific countries from your Tor circuits. Presets for Five Eyes, Nine Eyes, and Fourteen Eyes alliances, or enter custom country codes. Uses ExcludeNodes with StrictNodes in the torrc.

Interesting that people do this, I wonder how much it improves security? Afterall, any serious surveillance would involve running relays and exits in foreign lands.

reply
smalltorch
6 hours ago
[-]
This was another one of those things I built in because we can. I really don't know... But the Tor developers built this in as an option on the torrc so there must be something to it. We know there are definitely compromised nodes...I think it's just neat that you can have that level of control regardless if it's effective.
reply
kortilla
6 hours ago
[-]
It might not help for controlled nodes, but it does help avoid ISPs controlled by said governments from seeing it
reply
marcosqanil
7 hours ago
[-]
I love this. In your view, how would users go about securely swapping credentials ? PGP over email ?
reply
smalltorch
7 hours ago
[-]
Thanks! My realistic use case is that I am already speaking to someone who I know and trust, so ideally exchange credentials in person. A preferred out of band secure messanger of choice is probably fine.
reply
deadbabe
6 hours ago
[-]
What do you guys talk about?
reply
smalltorch
6 hours ago
[-]
I have my wife's phone set up on autolisten running in the background, so I just pop in and ask how her days going and crack jokes.
reply
clouedoc
3 hours ago
[-]
That's funny but it must absolutely drain the battery of her phone, no?
reply
smalltorch
3 hours ago
[-]
So far it's lasted all week with maybe 10% -15% loss per day. It's not her main, actually just a old phone I had laying around.

I think it's a pretty light background process.

reply
chasd00
3 hours ago
[-]
Forgive my ignorance, but can this be setup for a group like how a group can all be on the same frequency with walkie talkies? Or it is strictly one to one. Either way, it’s a really cool concept.
reply
smalltorch
3 hours ago
[-]
It's strickly 1 on 1 for now but I do plan on exploring the group call scenario.
reply
bzmrgonz
3 hours ago
[-]
I don't think E2EE works that way.
reply
smalltorch
3 hours ago
[-]
It actually can since its just symmetric encryption. Any key holder could decrypt the payload. In fact, the channel could simply be the shared secret.

Let's say we have 10 people in a call, 5 share a key and the other 5 share a different key. Without the shared key audio simply will not decrypt. You could have two private channels with one host.

reply
cl3misch
3 hours ago
[-]
I think it does? How would Whatsapp or Signal group chats work then?
reply
decker_dev
5 hours ago
[-]
The walkie-talkie model is a smart design choice given Tor's latency profile. Real-time bidirectional audio has pretty unforgiving requirements (~150ms round-trip max before it feels awkward), and Tor typically adds 50-200ms per hop. Going store-and-forward sidesteps the whole problem—you're not fighting the network's characteristics, you're designing around them.

Curious what codec you're using for the audio compression. Opus would be the obvious choice for speech but the tradeoffs change a bit when you're not doing real-time streaming.

reply
smalltorch
3 hours ago
[-]
Yes it's encoding in opus, and optionally you can configure encoding quality from 6kbs to 64kbs.

I was really surprised at the intelligability even at 6kbs.

The caviot is if your on termux we have to use the seperate termux API application to pipe audio to termux, and ffmpeg to convert MP4 to opus. Unfortunately termux cannot activate the mic on its own.

reply
encom
2 hours ago
[-]
By MP4 I assume you mean AAC in MP4. I'm a bit confused by this. What emits AAC that then needs transcoding to Opus? Not that transcoding losses really matter for this application, but the pipeline is not clear to me?

Very interesting project, by the way.

reply
smalltorch
2 hours ago
[-]
So this is only for termux compatibility. On a standard distro it skips this step entirely and goes straight from raw pcm to opus.

On termux 'termux-microphone-record' is a wrapper around androids 'mediarecorder'. It doesn't support raw pcm output. It records AAC in m4a wrapper and then the extra ffmpeg package converts this to rawpcm so it can follow the same pipeline.

reply
kgwxd
1 hour ago
[-]
I love it for the same reason I love email and text communication. Think about what you want to say before you say it. Exclude the useless tangents: formalities, movie quotes, humble brags, cliches, etc. A few second delay is enough to get even the worst offenders to get to the point.
reply
sailorganymede
4 hours ago
[-]
I worked on text chat ages ago over TOR. Honestly so happy to see that the ecosystem is still going!
reply
smalltorch
3 hours ago
[-]
You may like this one then. It's kinda the same thing, but text only and multiple people can connect at once. It's setup so anyone can be a host, or a client.

Basically IRC, but for Tor.

https://gitlab.com/here_forawhile/torch

reply
oybng
7 hours ago
[-]
Looks fun, I've yet to test it but I did skim it.

'|| true' 76 matches 'echo ""' 50 matches ' [ ' 261 matches '=$(' 90 matches

reply
nebezb
2 hours ago
[-]
Oh I’m curious. Love bash, and learning new things about it.

I can understand why [ is not ideal. Can you explain the rest to me? I use || true for custom error handling often (with the right set -euo pipefail of course)

reply
Tepix
5 hours ago
[-]
Interesting to implement this as a shell script.

Still: Using a line based protocol and base64 encoding the audio data? Not my first choice.

The README doesn't mention it, but I assume both parties have to be online at the same time?

Regarding encryption - what's the point? When communicating with a tor hidden service, the data is already encrypted.

Only starting the sending audio data after the speaker has stopped talking means much longer delays than necessary. Imagine someone talking for a minute.

reply
smalltorch
4 hours ago
[-]
To expound on the other questions.

To receive a call, you either need to be online and actively listening for calls, or optionally, you can enable auto listening. When another user calls you it will automatically put you in the call. On end call you will be put back in listening mode. I'm not really sure a great way to get around this without overly complicating it.

I believe because of the small overhead that's added there is just no reason not to layer encryption. At the end of the day I just wanted to see the bits I'm sending over the wire with my own eyes for assurance it's protected regardless of the fact that tor is protecting the data.

The streaming would be a nice improvement for latency. I would have to look into how this would work for the optional audio processing. Having one set file for transport also simplifys the some of the flow with encryption like salting and optional hmac authentication as these are derived from the sum of the entire file, not a portion of it.

reply
smalltorch
5 hours ago
[-]
The base64 encoding adds about 30% overhead. It's not ideal but it was a limitation of bash. Passing raw binary does not work in bash (or I couldn't get it to work).
reply
extraduder_ire
4 hours ago
[-]
What exactly was the problem you ran into? I've run binary through pipes just fine before.
reply
Bender
4 hours ago
[-]
the data is already encrypted

by the spooks that wrote it. no harm in having another turtle in the stack.

reply
ProofHouse
3 hours ago
[-]
This is rad
reply
sourcegrift
4 hours ago
[-]
Sorry for hijacking but I came across a firefox send replacement which worked in linux command line. Anyone know what it was? (It was online though, as in no storage for later)
reply
mrexcess
5 hours ago
[-]
Looks awesome in many ways. The use of a shared secret instead of PKI limits the real-world applications pretty severely, but adding PKI support doesn't seem too difficult. If the PKI key was only used to establish the session "shared secret", virtually no changes would be needed in the main code.

Thanks for contributing!

reply