wiktor-k / sw-crypto

Decrypts encrypted files on the fly using WebCrypto in a Service Worker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Service Worker auto decryptor

Decrypts AES-GCM encrypted files using keys embedded in URL fragments.

This kind of URLs is generated by Conversations when uploading files in encrypted chat sessions.

Putting this Service Worker on HTTP Upload host allows users to open encrypted files in their browsers without transmitting encryption keys.

Running

Start a server:

python -m SimpleHTTPServer

Go to root page:

http://localhost:8000

This will register Service Worker and allow decrypting files, such as this one:

http://localhost:8000/leaf-veins.jpg#492fc2ba53dd27a4f4a6a250310609f0c6c82267073eb9967390796a2d770e0a89d3f95c650d1f533e60b7e51a96cacf

Installing Service Worker

Service worker is installed only on explicit call from JavaScript or when a Link header is inserted in response headers:

Link: </worker.js>; rel="serviceworker"; scope="/"

To check this version use:

python server.py

Unfortunately the initial request will not be processed by the Worker so the first file will not be decrypted.

See A header-based SW installation for more details.

About

Decrypts encrypted files on the fly using WebCrypto in a Service Worker

License:Apache License 2.0


Languages

Language:JavaScript 51.7%Language:HTML 31.0%Language:Python 17.3%