Skip to main content
This page demonstrates browser-side cryptography with the prebuilt WASM binding. It does not call the Everabyte REST API from the browser. Everabyte API-key headers are not allowed by the API’s CORS policy, and a secret API key embedded in browser code would be exposed to every user. Use your own authenticated backend to relay ciphertext and envelope data to Everabyte; that backend must never receive the UMK, DEK, or recovery phrase. See Requests and CORS and the Node.js quickstart for a server-side API example.

1. Install the browser binding

The WASM binding is in the public everabyte/crypto-sdk repository: bindings/wasm/pkg is the browser/bundler build; bindings/wasm/pkg-node is for Node.js.

2. Create and enroll an account key

Generate the UMK in the browser. Register only its public keys and recovery-wrapped copy through your authenticated application backend. Obtain the step-up token using the account’s supported step-up flow; do not put the Everabyte secret API key in this browser code.
/api/everabyte/... is an example route in your application, not an Everabyte endpoint. Implement authorization, CSRF protection, request validation and API-key storage on that backend. The backend forwards the registration request to POST /e2ee/keys/register without ever seeing the unwrapped UMK or recovery phrase. Show the recovery phrase once and store it outside Everabyte. If every enrolled device and the phrase are lost, the files cannot be recovered by support.

3. Encrypt a browser-selected file

The whole-buffer WASM helpers take the complete file and return the complete encrypted payload. For large files, account for that memory use; this binding does not expose the Rust streaming API.
Send only payload, wireName, encryptedName, and the envelope to your backend (for example, as a multipart file plus a JSON metadata part). Never send dek, umk, or mnemonic. The backend uploads the ciphertext to POST /files/upload/{bucketId} and attaches the envelope using POST /e2ee/files/by-path/envelope. It must check both responses and retain the resulting file identifier. The encrypted display name is optional for backward compatibility in the API, but include it for new files when the original name must be restored. On an attach timeout, reconcile before cleanup. After a confirmed failure, resolve the uploaded row by bucket and opaque wire name, confirm it has no envelope, and hard-delete it through the file API as required by the E2EE upload contract. Handle retention blocks explicitly.

4. Download and decrypt locally

Have your backend authorize the request and return the stored ciphertext plus the caller’s envelope. The browser then unwraps the DEK locally and opens the payload:
The response data from your backend must contain ciphertext and envelope only. Do not return secret API credentials to the browser.

Next steps