Trusted Device Sync

Your encrypted pastes, across your devices.

PasteDB uses trusted devices to securely transfer your account encryption key to a new device without sending your plaintext encryption key to the server.

Why does a new device need approval?

End-to-end encryption means PasteDB cannot simply give your encryption key to every device that logs into your account.

๐Ÿ”

Your first device has the KEK

During registration, your device generates a random account encryption key. The key is kept on the trusted device and is used to decrypt your encrypted pastes.

๐Ÿ“ฑ

A new device does not have it

When you sign in on another device, that device generates its own cryptographic identity. It can authenticate your account, but it cannot immediately decrypt your existing E2EE pastes.

What does the KEK actually do?

The KEK is an important part of the E2EE decryption process, but it does not directly decrypt the paste itself.

๐Ÿ” The KEK is part of the decryption chain

PasteDB uses a layered encryption system. The account KEK is used to decrypt or unlock the PEK, and the PEK is then used to decrypt the encrypted paste. In simple terms:

KEK Used to unlock the PEK
โ†“
PEK Used to decrypt the paste
โ†“
Encrypted Paste Becomes readable

Therefore, saying that the KEK is used to decrypt E2EE pastes means that the KEK participates in the decryption process indirectly. The KEK unlocks the key needed to decrypt the actual paste.

The trusted-device flow

A device that already has your account KEK can authorize another device.

๐Ÿ’ป

Device 1

Trusted device
Has account KEK

โ†’
๐Ÿ”‘

Encrypt KEK

Wrapped using Device 2's public key

โ†’
๐Ÿ“ฑ

Device 2

Uses its private key to decrypt the KEK

Manage trusted devices

Your devices page shows which devices are already trusted and which ones are waiting for approval.

Your devices

โ— E2EE enabled
๐Ÿ’ป
Windows Laptop
Trusted ยท Has account KEK
Approved
๐Ÿ“ฑ
Android Phone
Waiting for trusted-device approval
Pending

What happens internally?

The trusted-device system uses public-key cryptography to transfer the account KEK.

1

A device creates an RSA key pair

When a device registers, it generates a public key and private key. The public key can be shared with the server, while the private key remains on the device.

2

The public key is registered

The device sends its public key to PasteDB. The server associates that device with the user's account.

3

Device 2 appears as pending

A trusted device can see the new device in the account's device management page.

4

The trusted device generates a QR link

The trusted device takes the new device's public key and uses it to encrypt the account KEK.

5

The encrypted KEK is stored on the server

The server stores the wrapped KEK associated with the target device. The QR code contains a link that identifies this transfer.

6

Device 2 scans the QR code

The link opens the transfer page. The page requests the encrypted KEK associated with that device.

7

Device 2 decrypts the KEK locally

Device 2 uses its private key to decrypt the encrypted KEK. The resulting KEK is then stored locally for decrypting the account's E2EE pastes.

The cryptographic handoff

The important idea is that the trusted device does not need to expose the plaintext KEK to the server.

๐Ÿ”

Account KEK

The key used to decrypt your encrypted pastes.

๐Ÿ”‘

Device 2 Public Key

Used by the trusted device to wrap the KEK for the new device.

๐Ÿ›ก๏ธ

Device 2 Private Key

Remains on Device 2 and is used locally to unwrap the KEK.

QR-based device approval

The QR code is simply a convenient way to transfer the approval link from one device to another.

Scan from the new device

QR

The QR contains a PasteDB transfer URL. It does not contain the plaintext account KEK.

๐Ÿ›ก๏ธ Why this works with end-to-end encryption

PasteDB can store the device public key and the encrypted KEK required for a trusted-device transfer. The target device's private key remains local and is required to decrypt the wrapped KEK. This allows a trusted device to authorize another device without simply handing the account encryption key to the server.