Cipher 0.2 is here — see the new code blocks.
Sign up

Quickstart

From zero to first encrypted payload in under two minutes.

~ 1 min read

You’ll need a sandbox API key. Grab one at example.com/signup.

1. Install

npm
bash
npm install @example/cipher
bun
bash
bun add @example/cipher
pnpm
bash
pnpm add @example/cipher

2. Encrypt

ts
import { Cipher } from "@example/cipher";

const cipher = new Cipher({ apiKey: process.env.CIPHER_KEY });
const sealed = await cipher.encrypt({ payload: "secret note" });

sealed is a string-encoded envelope. Stash it anywhere — Postgres, S3, a cookie.

3. Decrypt

ts
const { payload } = await cipher.decrypt(sealed);
console.log(payload); // "secret note"

That’s it.

Last updated Edit this page
↑↓ navigate open esc close