Build with LOCKRA.
Timelock in a few lines.
Add capsules that nobody can open before a date to any app, bot or dApp with lockra-sdk. Give AI agents the same power with lockra-mcp. Open source, zero servers, zero API keys, and every capsule opens on lockra.buzz.
import { seal, open } from 'lockra-sdk';
// Lock it until June 1st 2027
const capsule = await seal('BTC 150k by summer', {
unlockAt: '2027-06-01T00:00:00Z',
label: 'My call',
});
console.log(capsule.link);
// https://lockra.buzz/#l=My+call&c=...
const r = await open(capsule.link);
// before the date → { status: 'sealed', secondsLeft }
// after the date → { status: 'opened', message }
What you get
For developers
A JavaScript and TypeScript library. Seal messages and files, open them, verify wallet signatures. Works in Node.js 20+ and every modern browser.
npm install lockra-sdk
lockra-mcp
For AI agents
A Model Context Protocol server. Claude, Cursor and any MCP client can seal and open capsules on their own, with one line of setup.
npx -y lockra-mcp
.lockra files work both ways.- 1
Install it
Requires Node.js 20 or newer, or any modern browser bundler (Vite, Next.js, webpack…). ESM only.
terminalnpm install lockra-sdk - 2
Import what you need
Everything is a named export with full TypeScript types.
jsimport { seal, open, inspect, sealFile, openFile } from 'lockra-sdk'; - 3
No keys, no accounts
There is nothing to configure. Encryption runs locally and the SDK only talks to the public drand relays when you open a capsule.
Seal & open
const capsule = await seal('I will ship v2 before March', {
unlockAt: '2027-03-01T00:00:00Z', // or a Date, or epoch ms
// unlockIn: 3600, // …or seconds from now
label: 'Promise', // public title, tamper-proof
by: '@lockra', // public author, tamper-proof
});
capsule.link; // share this
capsule.unlockAt; // Date
capsule.round; // drand round that unlocks itconst r = await open(capsule.link); // a link, a token or the capsule object
if (r.status === 'sealed') {
console.log(`Still sealed, ${r.secondsLeft}s left`);
} else {
console.log(r.message, r.sealedAt);
}
// Or wait until it unlocks
const opened = await open(capsule.link, { wait: true, timeoutMs: 60_000 });inspect(link);
// { round, unlockAt, unlocked, label, by, wallet }unlockAtUnlock time: a Date, an ISO 8601 string or epoch milliseconds.unlockInOr: seconds from now. Pass exactly one of the two.labelPublic title shown before opening, up to 80 characters.byPublic author name, up to 40 characters.waitOn open(): keep waiting until the capsule unlocks.Messages can be up to 10,000 characters. The label and author are bound to the encryption: change one character and the capsule refuses to open.
Sealed files
up to 25 MBimport { readFile, writeFile } from 'node:fs/promises';
import { sealFile, openFile } from 'lockra-sdk';
const { capsule, file } = await sealFile(await readFile('report.pdf'), {
name: 'report.pdf',
type: 'application/pdf',
unlockAt: '2027-01-01T00:00:00Z',
});
await writeFile('report.pdf.lockra', file);
// Later
const r = await openFile(await readFile('report.pdf.lockra'));
if (r.status === 'opened') await writeFile(r.file.name, r.file.data);Wallet signatures
Prove which wallet sealed a capsule. The SDK never touches private keys: sign the message with your own wallet library and attach the signature.
import { walletMessage, attachSignature } from 'lockra-sdk';
const signature = await signer.signMessage(walletMessage(capsule));
const signed = attachSignature(capsule, {
address: await signer.getAddress(),
signature,
});
signed.link; // shows "Wallet-signed by 0x…" on lockra.buzzErrors
Every error is a LockraError with a stable code, so you can handle each case cleanly.
INVALID_CAPSULENot a LOCKRA link, token or .lockra file.INVALID_ARGUMENTA parameter is missing or out of range.TAMPEREDThe capsule, its label, author or file was changed.BAD_SIGNATUREA signature does not match this capsule.BEACON_UNREACHABLENo drand relay could be reached. Retry later.TIMEOUTopen({ wait: true }) gave up before the unlock.import { open, LockraError } from 'lockra-sdk';
try {
await open(link);
} catch (err) {
if (err instanceof LockraError && err.code === 'TAMPERED') {
console.warn('Someone edited this capsule.');
}
}Connect LOCKRA to Claude, Cursor or any MCP client and just ask, in plain words:
claude mcp add lockra -- npx -y lockra-mcp{
"mcpServers": {
"lockra": {
"command": "npx",
"args": ["-y", "lockra-mcp"]
}
}
}{
"mcpServers": {
"lockra": { "command": "npx", "args": ["-y", "lockra-mcp"] }
}
}npx -y lockra-mcpseal_capsuleEncrypts a message until a date or for a number of seconds, and returns the link.open_capsuleOpens a capsule, or says how long is left. Can wait up to 5 minutes.inspect_capsuleShows the unlock time, label, author and wallet without opening it.Requires Node.js 20+. Protocol versions 2025-06-18, 2025-03-26 and 2024-11-05.
What to build
The message is encrypted locally with a fresh AES-256-GCM key.
The key is locked to a future drand round with identity-based encryption on BLS12-381.
The key to open it doesn't exist yet. The League of Entropy publishes it at the scheduled time.
The SDK checks the beacon signature against drand's public key, then decrypts.
- Zero dependencies. The SDK bundles the audited noble cryptography, the same code that runs on lockra.buzz.
- Untrusted relays. Every drand signature is verified before use, so no server can fake an unlock.
- Signed builds. Packages are published from GitHub Actions with npm provenance, so anyone can check where they came from.
- Links are the secret. After the unlock time, anyone with the link can read the capsule. Share accordingly.
FAQ
Does it cost anything or need $LOCKRA?
No. The SDK and the MCP server are free and open source. No wallet, no gas, no API key.
Does it run in the browser?
Yes. It uses the standard Web Crypto API, so it works in every modern browser and in Node.js 20+.
Can I open a capsule early if I sealed it?
No. Nobody can, including the author and LOCKRA. The key simply doesn't exist until the drand round is published.
What if drand is down when I open?
The SDK tries several public relays. If none answers you get BEACON_UNREACHABLE; retry later, the capsule stays valid forever.
Is it audited?
The cryptography libraries it uses (noble-curves and noble-hashes) are independently audited. The SDK itself is open source and covered by automated tests, including live tests against drand.