Send a message to the future.

time-sign is a time-lock encryption server. Anyone can encrypt data for a date with its public key — without asking the server — and the key that decrypts it is published only once that date has passed.

Try the demo

How it works

  1. The server holds an identity-based encryption (IBE) master key pair. The identity is a date string, such as 2030-01-01.
  2. You encrypt locally with the master public key and the date. Only the ciphertext leaves your hands — and it never has to reach this server.
  3. After the date, the server hands out the user secret key for that identity. Before it, it refuses.

The scheme is CGW-KV, an identity-based KEM; the data itself is encrypted with AES-CBC under the encapsulated key.

API

GET /master_pk
The master public key, as raw bytes.
GET /at/<date>
The user secret key for <date> (any string Date.parse accepts) once it has passed, as raw bytes. Before that, the text It is not the time. An unparseable date is 400.

CORS is open: any origin may call the API from a browser.

Use it

import { decrypt, encrypt } from "https://raw.githubusercontent.com/kbn-one/time-sign/main/client/mod.ts";

const server = "https://time-sign.kbn.one";
const time = "2030-01-01";

const mpk = new Uint8Array(
  await (await fetch(server + "/master_pk")).arrayBuffer(),
);
const enc = await encrypt(mpk, time, new TextEncoder().encode("secret"));

// after `time` has passed
const usk = new Uint8Array(
  await (await fetch(server + `/at/${time}`)).arrayBuffer(),
);
console.log(new TextDecoder().decode(await decrypt(usk, enc)));

In the browser, /time-sign.js is the same client bundled as one ES module (the WebAssembly is inlined).

Trust

The master key pair is generated inside a GitHub Actions job. The secret key goes straight from that job to the server and is never committed, printed or stored in GitHub; the public key is published with a signed build provenance attestation, so you can check the key this server hands out was produced by that workflow:

curl -sSo master_pk.bin https://time-sign.kbn.one/master_pk
gh attestation verify master_pk.bin -R kbn-one/time-sign \
  --signer-workflow kbn-one/time-sign/.github/workflows/keygen.yml

Read the source on GitHub.