Anonymous file transfer with WebRTC

Anonymous file transfer with WebRTC

Back in 2016, I’ve worked on an application called ShareTC that allowed users to share their files through their web browser using the WebRTC technology.

Back in 2016, I’ve worked on an application called ShareTC that allowed users to share their files through their web browser *using the WebRTC technology. The application was working well but the promise was to be able to *share files without any server. The first version used PeerJS, a library allowing you to implement WebRTC data channel for file sharing easily with a drawback, it needs a server for what is called the signaling process. Thus, I’ve made some improvement to the project to allow user to share their files without even using a signaling server.

For those who are not interested by the technical implementation you can directly have a look to the demo on GitHub.

Migration

Originally, the project was barebone native JavaScript but I decided to upgrade the project to Angular 8, because exchanging the signaling configuration is a little complex, I needed some framework for easy DOM manipulation.

Because this is a side project, I didn’t want to recreate a component library so I used the @angular/material library for the forms and user feedbacks.

I also used @angular/flex-layout to easily define the layout, knowing that the application design is really basic as it is not the primary intent of the demonstration.

How it works

So, the interesting part now, the application will try to create a data channel between the sender and the receiver, using WebRTC. The protocol needs to know to whom it should send the data, this is named peer discovery, and it can be done automatically through what is called a signaling server, a server where you exchange your configuration to begin the communication and this is the component that I wanted to remove. For the manual configuration we use the Session Description Protocol (or SDP).

Image for post

Session Description Protocol

But because the networks are complex, in some cases, you’ll need a Session Traversal Utilities for NAT (or STUNserver. This is used when you’re exchanging a file from behind a Network Address Translation (or NATfirewall. There are some public servers available for this like:

— stun.services.mozilla.com

— stun.l.google.com:19302

Image for post

Session Traversal Utilities for NAT

In some other cases the communication channel will be blocked by firewalls. In this case you can eventually use a Traversal Using Relays around NAT (or TURN) *server *that will work as a Data relay between you and the peer. They are expensive and only necessary if you’re behind a blocking firewall so I didn’t integrate a solution for that 😊

Image for post

Traversal Using Relays around NAT

webrtc angular stun

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Install Angular - Angular Environment Setup Process

Install Angular in easy step by step process. Firstly Install Node.js & npm, then Install Angular CLI, Create workspace and Deploy your App.

Basics of Angular: Part-1

What is Angular? What it does? How we implement it in a project? So, here are some basics of angular to let you learn more about angular. Angular is a Typesc

Angular Sass: How To Use Sass In Angular 9 Tutorial

Sass in Angular is an extension of CSS that allows you to use things like variables, nested rules, inline imports. Angular supports Sass, CSS, and Less.

Angular 11 Facebook Social Login Example

Angular 11 login with facebook. In this tutorial, you will learn how to login with facebook in angular 8/9/10/11 app.

Angular 11 Google Social Login Example Tutorial

Angular 11 google login example. In this tutorial, you will learn how to integrate google social login in angular 11 app.