feat(sea): add SEA.timelock - time-locked encryption & dead-man's switch - #1425
Open
ABsUP wants to merge 1 commit into
Open
feat(sea): add SEA.timelock - time-locked encryption & dead-man's switch#1425ABsUP wants to merge 1 commit into
ABsUP wants to merge 1 commit into
Conversation
…witch
Encrypts data with a key that is the endpoint of a sequential SHA-256
hash chain of length opt.rounds; only the chain's starting seed is
published. Unlocking requires recomputing the chain (rounds sequential
hashes), which is inherently non-parallelizable, so rounds is a real
lower bound on unlock time - no trusted party or time oracle needed.
Dead-man's switch: set opt.until and re-publish a fresh capsule on each
heartbeat; when heartbeats stop, the last capsule becomes unlockable
after until passes. Opt-in signing ({pub, sig}) over a canonical
pipe-joined payload makes capsule metadata tamper-evident. opt.max on
unlock guards against malicious capsules with absurd rounds (anti-DoS).
8 tests: roundtrip, object data, no key-material leak, tamper blocking,
wrong-seed blocking, signed/forged metadata, opt.max, callback style.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat(sea): add
SEA.timelock— time-locked encryption & dead-man's switchAdds a pure-crypto time-lock primitive with no trusted party and no time oracle — built only on WebCrypto SHA-256.
How it works
SEA.timelock(data, pair, opt)encrypts the payload with a key that is the endpoint of a sequential SHA-256 hash chain of lengthopt.rounds(default 100 000 ≈ a few seconds):seedis published in the capsule:{ until, rounds, salt, seed, c }.SEA.timelock.unlock(capsule, cb, opt)recomputes the chain —roundssequential hashes — then decrypts. Hash chains are inherently non-parallelizable, soroundsis a real lower bound on unlock time. The creator pays the cost once at lock time; everyone else (including the creator, who keeps no shortcut) must pay it to unlock.Dead-man's switch
Set
opt.untilto a future timestamp and re-publish a fresh capsule (newuntil, newseed) on each heartbeat. When heartbeats stop, the last published capsule becomes unlockable by anyone once itsuntilpasses.untilis advisory metadata consumed by executor/release agents; the cryptographic time-lock isrounds.Security properties
rounds.cfails AES-GCM auth →undefined.pairto get{ pub, sig }over a canonical pipe-joined payload — forgeduntil/rounds/salt/seedis then detected before the expensive puzzle is solved.unlock(capsule, cb, { max })refuses capsules whoseroundsexceedmax.Example
Tests
8 new tests in
test/sea/sea.js(roundtrip, object data, no key-material leak, tamper blocking, wrong-seed blocking, signed/forged metadata,opt.maxenforcement, callback style). Full SEA suite: 43 passing / 1 pending / 0 failing.