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 moment, spelled one way and rounded up to 10 seconds: 2030-01-01T00:00:00Z.
  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/<moment>
The user secret key for <moment> once it has passed, as raw bytes; before that, the text It is not the time. Keys are issued every 10 seconds, for one spelling: YYYY-MM-DDTHH:MM:SSZ in UTC. Any other date Date.parse accepts is a 301 to that moment rounded up (/at/2030-01-01 → /at/2030-01-01T00:00:00Z), so a key is never released early. Encrypt for that spelling: the client's timeId() gives it. An unparseable date is 400.

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

Use it

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

const server = "https://time-sign.kbn.one";
const id = timeId("2030-01-01"); // "2030-01-01T00:00:00Z"

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

// after the moment has passed
const usk = new Uint8Array(
  await (await fetch(server + `/at/${id}`)).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.