For the complete documentation index, see llms.txt. This page is also available as Markdown.

How Encryptor works

How Encryptor holds your encryption key and lets apps compute shared secrets with it.

Status: Maintenance mode. Encryptor is supported for existing users; no new features are planned. Last update: 18 Apr 2024 (version 0.1.0).

Encryptor lets two people share a secret without ever sending it. This page explains the idea and the states Encryptor can be in.

Your encryption key

When you create an Encryptor, the extension generates a random key pair with the ethers library. The key comes from a recovery phrase, which the extension shows once on its "Seed words" screen. The key pair is separate from your Web3 wallet account.

  • The private key stays in the extension. Apps never receive it.

  • The public key can be shared. An app asks Encryptor for it (getPublicKey) and can publish it on the blockchain for others to read. In OCC v1 this is the Users contract, via the SDK's storePublicKey.

The shared secret

Encryption between two users uses ECDH (Elliptic-Curve Diffie-Hellman). Each side combines its own private key with the other side's public key and gets the same shared secret. Nobody has to send that secret to the other person.

  1. The sender's app reads the receiver's public key from the blockchain.

  2. The app asks Encryptor to compute the shared secret (computeSharedSecretKey) with that public key.

  3. The app uses the secret to derive an AES-256-GCM key and encrypts the content.

  4. The receiver does the same with the sender's public key and gets the same secret, so they can decrypt.

Figure: How an app encrypts for another user, with the private key kept inside Encryptor.

Be clear about what crosses the boundary: the app receives the shared secret for that pair of users, not your private key.

Encryption options in OCC v1

Encryptor serves one of three options in OCC v1. See the OCC v1 encryption page for detail.

Figure: The three OCC v1 encryption options; Encryptor serves the AES with ECDH option.

States

Encryptor is always in one of these situations. Apps read them through the SDK.

Figure: Encryptor states, from not installed to unlocked, and back to locked.

Situation
Extension state
SDK check

Extension missing

(no reply)

isInstalled() is false

No key created yet

not-generated

isInitialized() is false

Key exists, password needed

locked

isLocked() is true

Ready

unlocked

isUnlocked() is true

Next: Install Encryptor.

Last updated