Tesseras

Phase 4: Heir Key Recovery with Shamir's Secret Sharing

2026-02-15

What happens to your memories when you die? Until now, Tesseras could preserve content across millennia — but the private and sealed keys died with their owner. Phase 4 continues with a solution: Shamir's Secret Sharing, a cryptographic scheme that lets you split your identity into shares and distribute them to the people you trust most.

The math is elegant: you choose a threshold T and a total N. Any T shares reconstruct the full secret; T-1 shares reveal absolutely nothing. This is not "almost nothing" — it is information-theoretically secure. An attacker with one fewer share than the threshold has exactly zero bits of information about the secret, no matter how much computing power they have.

What was built

GF(256) finite field arithmetic (tesseras-crypto/src/shamir/gf256.rs) — Shamir's Secret Sharing requires arithmetic in a finite field. We implement GF(256) using the same irreducible polynomial as AES (x^8 + x^4 + x^3 + x + 1), with compile-time lookup tables for logarithm and exponentiation. All operations are constant-time via table lookups — no branches on secret data. The module includes Horner's method for polynomial evaluation and Lagrange interpolation at x=0 for secret recovery. 233 lines, exhaustively tested: all 256 elements for identity/inverse properties, commutativity, and associativity.

ShamirSplitter (tesseras-crypto/src/shamir/mod.rs) — The core split/reconstruct API. split() takes a secret byte slice, a configuration (threshold T, total N), and the owner's Ed25519 public key. For each byte of the secret, it constructs a random polynomial of degree T-1 over GF(256) with the secret byte as the constant term, then evaluates it at N distinct points. reconstruct() takes T or more shares and recovers the secret via Lagrange interpolation. Both operations include extensive validation: threshold bounds, session consistency, owner fingerprint matching, and BLAKE3 checksum verification.

HeirShare format — Each share is a self-contained, serializable artifact with:

Shares are serialized in two formats: MessagePack (compact binary, for programmatic use) and base64 text (human-readable, for printing and physical storage). The text format includes a header with metadata and delimiters:

--- TESSERAS HEIR SHARE ---
Format: v1
Owner: a1b2c3d4e5f6a7b8 (fingerprint)
Share: 1 of 3 (threshold: 2)
Session: 9f8e7d6c5b4a3210
Created: 2026-02-15

<base64-encoded MessagePack data>
--- END HEIR SHARE ---

This format is designed to be printed on paper, stored in a safe deposit box, or engraved on metal. The header is informational — only the base64 payload is parsed during reconstruction.

CLI integration (tesseras-cli/src/commands/heir.rs) — Three new subcommands:

Secret blob format — Identity keys are serialized into a versioned blob before splitting: a version byte (0x01), a flags byte (0x00 for Ed25519-only), followed by the 32-byte Ed25519 secret key. This leaves room for future expansion when X25519 and ML-KEM-768 private keys are integrated into the heir share system.

Testing — 20 unit tests for ShamirSplitter (roundtrip, all share combinations, insufficient shares, wrong owner, wrong session, threshold-1 boundary, large secrets up to ML-KEM-768 key size). 7 unit tests for GF(256) arithmetic (exhaustive field properties). 3 property-based tests with proptest (arbitrary secrets up to 5000 bytes, arbitrary T-of-N configurations, information-theoretic security verification). Serialization roundtrip tests for both MessagePack and base64 text formats. 2 integration tests covering the complete heir lifecycle: generate identity, split into shares, serialize, deserialize, reconstruct, verify keypair, and sign/verify with reconstructed keys.

Architecture decisions

What comes next

With Shamir's Secret Sharing, Tesseras closes the last critical gap in long-term preservation. Your memories survive infrastructure failures through erasure coding. Your privacy survives quantum computers through hybrid encryption. And now, your identity survives you — passed on to the people you chose, requiring their cooperation to unlock what you left behind.