How Encryptor works
How Encryptor holds your encryption key and lets apps compute shared secrets with it.
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'sstorePublicKey.
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.
The sender's app reads the receiver's public key from the blockchain.
The app asks Encryptor to compute the shared secret (
computeSharedSecretKey) with that public key.The app uses the secret to derive an AES-256-GCM key and encrypts the content.
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.
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
