Skip to content

Latest commit

 

History

History
186 lines (149 loc) · 10.6 KB

README.md

File metadata and controls

186 lines (149 loc) · 10.6 KB

nuBox chrome extension

Python 3.6 License

Demo videos

Table of Contents

  1. Who is it for?
  2. API (for developers)
  3. Installation
  4. Popup UI (for users)
  5. GMail support
  6. Dropbox-like support
  7. Debugging issues

Who is it for?

NuCypher is the go-to solution for anyone aiming to build privacy-rich applications on the blockchain. But it lacks a JavaScript library. Moreover, their codebase is written in Python, making it difficult to port over to the web side. nuBox chrome extension can solve these issues without you ever having to know about NuCypher at all! It even has an insanely simple API which it injects onto every website! It even comes with support for IPFS!

Moroever, it now comes with inbuilt GMail support (forget all about the insance email encryption setup and PGP!), and you can even save and share your files without ever having to visit any website!

API:

All API calls are available under nuBox namespace. All of them supports Promises.

isHostRunning

This API call is used to check whether the nuBox chrome extension is running successfully on the client machine. It can fail if the Chrome native host fails to start or has exited.

await nuBox.isHostRunning();
approve

This API call is used to request permission from the user to start using the nuBox APIs (for this web host). On calling this API, it'll open a popup, like shown below. If user hasn't approved this request, you can only use the isHostRunning API.

await nuBox.approve();

encrypt

This API call is used to encrypt a block of plaintext. Due to chrome limitations, it's recommended to keep under 256 KB for the plaintext size.

await nuBox.encrypt(plaintext, label, ipfs);

It expects atleast two arguments: plaintext and label. ipfs is optional (with default value false), and if it's set as true, the encrypted data will be uploaded to Infura IPFS and the IPFS hash will be returned. The encrypted data can be accessed by visiting: https://ipfs.infura.io/ipfs/<hash>/.

decrypt

This API call is used to decrypt a block of encrypted text. Due to chrome limitations, it's recommended to keep under 256 KB for the encrypted size.

await nuBox.decrypt(encrypted, label, ipfs);

It expects atleast two arguments: encrypted and label. ipfs is optional (with default value false), and if it's set as true, the encrypted argument should be the Infura IPFS hash from which the encrypted data will be downloaded.

grant

This API call is used to invoke a grant request waiting for user's permission to approve or reject the request.

await nuBox.grant(label, bek, bvk, expiration, noPopup);

It expects atleast four arguments: label, bek, bvk and expiration.

  • bek is Bob's encrypting key (which is a hex-encoded string). It can be retrieved using getBobKeys API.
  • bvk is Bob's verifying key (which is a hex-encoded string). It can be retrieved using getBobKeys API.
  • expiration is a ISO-8601 formatted datetime string (in the format of YYYY-MM-DD HH:mm:ss. For example, '2019-03-29 22:23:10').
  • noPopup to disable showing the popup. It's default value is false (meaning popup will be shown). This option is only honored if both Alice and Bob (for whom the grant is requested) are running on the same machine. If not, it's ignored.

It'll open up a grant popup for the user to approve. It'll have the sender information and also details about the grant request. If the user approves this request, it'll be send to the NuCypher network for processing.

revoke

This API call is used to invoke a revoke request waiting for user's permission to approve or reject the request.

await nuBox.revoke(label, bvk, noPopup);

It expects aleast two arguments: label and bvk (Bob's verifying key).

  • noPopup to disable showing the popup. It's default value is false (meaning popup will be shown). This option is only honored if both Alice and Bob (for whom the revoke is requested) are running on the same machine. If not, it's ignored.

It'll open up a revoke popup for the user to approve. It'll have the sender information and also details about the revoke request. If the user approves this request, it'll be send to the NuCypher network for processing.

getBobKeys

This API call is used to get Bob's encrypting key and verifying key (both are public keys) that can be used for granting access for Bob to a policy.

await nuBox.getBobKeys();

Installation:

nuBox packages all NuCypher dependencies into docker containers. All the user needs to have is docker, docker-compose and chrome browser (or Brave browser).

Run the below step to install the nuBox chrome host.

$ git clone [email protected]:robin-thomas/nubox-ext
$ cd nubox-ext
$ git submodule init
$ git submodule update --remote --recursive
$ sudo docker-compose build
$ sudo docker-compose up -d
$ ./host/install_chrome.sh

If you want to use it with Brave browser, run the below commands.

$ cd nubox-ext
$ sudo docker-compose build
$ sudo docker-compose up -d
$ ./host/install_brave.sh

nuBox host is written in Python 3.6. It also assumes that the python binary is at the location /usr/bin/python3.6

You'll also need to install the nuBox chrome extension. Since it's not packaged into Chrome Web Store, follow the below steps to install it.

  • Head over to chrome://extensions
  • Turn ON the developer mode
  • Click on "Load unpacked"
  • Select the nuBox extension directory (nubox-ext/extension) and click "Ok"
  • You'll be able to see that nuBox chrome extension has been successfully loaded!

Popup UI

nuBox also comes with a popup UI that the user can use to interact with NuCypher without any of the complexity. It has the following features:

  • It will show the "online" status (online meaning it was able to connect to the NuCypher network). All the below operations are only enabled if "online".

  • Retrieve Bob's encrypting and verifying keys

  • Encrypt a block of text.

  • Decrypt a block of text

  • Grant access for Bob for the label, so that decrypt operation can pass for Bob (can autoload Bob's details).

  • Revoke access for Bob for the label, so that decrypt operation will fail for Bob (can autoload Bob's details).

  • Any errors in the above API calls will alert the error message onto the active tab of the browser.

GMail support

Forget the insane installation setup of encrypted emails and PGP! With nuBox, you can have 1-click encrypt and auto-decrypt! Zero installation setup too!

nuBox auto adds the Encrypt and Decrypt buttons for each gmail compose window. Clicking on Encrypt button will automatically encrypt the email body with NuCypher network and then encode them into emojis! When you try to open the encrypted email, nuBox will automatically decode the emojis and then decrypts it using NuCypher (decrypt will fail if user is not granted permission). Voila!

You can use the nuBox popup UI to grant permissions for multiple recipients. The label used is the email subject.

Dropbox-like support

Forget storing your files on any server! With nuBox, you can securely store your files on IPFS and store the IPFS hashes on Chrome sync, meaning you can even access it from a different machine! Moreover you can share the files with anyone you like, and they can decrypt the files and download it!

Features:
  • No websites or servers!
  • Upload files, encrypt them and save it on IPFS
  • Support large files, by storing splitting the files and storing them in chunks (meaning different IPFS hashes)
  • IPFS hashes are stored in Chrome sync and hence can be accessed on any machine having Chrome browser with nuBox extension.
  • Share files with anyone securely.
  • Extensive Logging facility - see all the requests (inputs, output, timestamp) coming in.
  • Supported file operations - rename, delete, download, share, file info.
  • Check if extension is able to connect to NuCypher network.
  • Supports uploading multiple files of same file name.

Debugging issues

  • nuBox is tested only on version 3.6.0 of Python. Any different version might lead to unexpected outputs.
  • If your Python binary is not stored at /usr/bin/python3.6, make a symmlink to that location so that the host can run.
  • All run-time errors happening in the host will be stored at host/err.log along with the stack trace.
  • If the host crashed because of any of the above reasons, just restart the extension (after fixing the issue).

Known Nucypher issues

Free Software, Hell Yeah!