#NostrNovember is continuing, and so are the projects being built on it. The latest is Nostr Terminal. Noster Terminal allows you to connect to any computer terminal remotely from the browser, and it's NAT traversal powered by Nostr.
Let's be honest, frens. Tor has been a pain as of late. But leave it to the builders of Nostr to find a solution. Nostr Terminal allows you to bypass tor entirely using a Nostr Relay as the outgoing connection of a WebSocket to make a connection to your node at home. This requires no complicated NAT rules or ssh port forwarding on your firewall at home. This is entirely done using WebSockets.
The WebSocket API is an advanced technology that makes it possible to open a two-way interactive communication session between the user's browser and a server. With this API, you can send messages to a server and receive event-driven responses without having to poll the server for a reply.
WebSockets creates a two-way connection that requires no firewall configuration on either side of a firewall. It provides full-duplex communication channels over a single TCP connection, similar to NAT traversal. NAT routing techniques are required for many network applications, such as peer-to-peer file sharing, Voice over IP, etc...
How to Setup
On your computer:
## Clone the repository and navigate inside. git clone <this repo> cd nostr-terminal ## Start the terminal server using a package manager. yarn start || npm start ## You can also start the server directly, and provide arguments. ./nostrTerm.js <wss://relay.url.here> <optionalcustomsecret> ## If you want to specify your own defaults, ## create an .env file with the following: RELAY_URL=<wss://relay.url.here> SECRET_KEY=<optionalcustomsecret>
The app will give you a base64 encoded connection string to copy/paste into the browser client. This string includes the relay url and connection secret, so keep it safe!
If you do not provide a secret, the server will generate a random secret for you. This is the safest option!
On your browser:
## Navigate to the browser client (hosted on github): https://cmdruid.github.io/nostr-terminal/web ## Or host your own web client! The files are here: nostr-terminal/web
How to Use
The browser client will connect to your terminal server, using the same user account running the server. Be careful running this app as a sudo or administartor user!
There are two modes for the terminal:
buff mode or
live mode. You can toggle modes by clicking the
[ mode ] button located near the top-right of the terminal window.
Most keyboard input is buffered locally, then sent to your machine when you press enter. This is the fastest mode, plus it prevents flooding the relay with every keystroke. Certain features do not work in this mode, such as Up/Down (for scrolling command history) and Tab (for auto-completion). I'm looking to implement them in the future!
All keyboard input is streamed in real-time. This is nessecary when using a text editor (like vim or nano), but it will flood the relay with traffic. This app uses ephemeral events, so we are flooding in the most friendly way possible. However not all relays may handle this traffic properly, so please use this mode wisely and consider running your own relay if you plan to use it frequently.
Nostr Terminal is a demo project that opens a remote terminal connection into your machine. The connection is end-to-end encrypted with a secret, and uses a modern cryptography library (webcrypto) with best-practices. That being said, please review the code being used (NostrEmitter is just 500 lines), and take your own precautions!
"nostr" stands for "Notes and Other Stuff Transmitted by Relays" and is an open protocol for censorship-resistant global networks created by @fiatjaf. The greatest thing about all this is the interoperability with the nostr protocol, and it's game-changing!