EcoCloud
← trust layer
// kernel · key sharding

Shamir secret sharing

Split a secret into n shares over GF(256) so that any k reconstruct it — and fewer than k reveal nothing about it. Zero dependencies, deterministic under an injected RNG, and reconstruction fails closed on wrong, mixed, or tampered shares. Apache-2.0, running live in your browser right now.

Honest scope. This is the building block under "threshold custody" — published so the property is testable, not so we can borrow its glow. EcoCloud's signing keys are not sharded today: they are single-operator custody, stated plainly on the Trust Center. We will claim k-of-n custody only when independent parties actually hold shares — a committee whose nine shares live in one operator's account is theater, and we don't ship theater.

Try it — split, lose shares, tamper

self-test: running…

Use it

<script src="https://ecoclouddev.com/kernel/flowdesk-shamir-kernel.js"></script>
const { split, reconstruct } = OperantShamir;          // or require() in Node

const s = split(new TextEncoder().encode("my secret"), 3, 5);
// s.shares → [{x:1,y:"…hex…"}, …]  — hand each to a different party

const r = reconstruct([s.shares[0], s.shares[3], s.shares[4]]);
// r.ok → true, r.secretText → "my secret"
// wrong / tampered / too-few shares → { ok:false, reason } — never a wrong secret
Details that matter: arithmetic is GF(256) with the AES polynomial; a deterministic FNV-1a checksum rides inside the payload so reconstruction fails closed (it detects corruption and mixed share-sets — it is an integrity check, not authentication; pair with signatures for authenticity). Pass bytes (TextEncoder) to avoid the hex-string convenience parsing. 23-assertion test suite ships in the repo and runs in CI.