For the complete documentation index, see llms.txt. This page is also available as Markdown.

Protocol Lifecycle

The DeRec protocol defines a structured lifecycle describing how a Secret is protected and later recovered. This lifecycle describes how an Owner, a set of Helpers, and (optionally) one or more Replicas interact over time through protocol-defined flows. This section is conceptual and non-normative. The formal message structures and state transitions are defined in the Protocol Specification.

Phase 1: Initialization and Pairing

Before shares can be distributed, the Owner must establish a relationship with each Helper. This phase includes identity establishment, configuration exchange, and secure cryptographic communication setup according to the protocol definition.

During this phase:

  • The Owner selects the Helper set.

  • The starting recovery threshold (t) and the Helper set (n) are chosen. The t a publish uses is recorded with the Secret from then on; see The threshold is recorded.

  • Per-channel Shared Keys are derived through the pair handshake — one per Helper channel.

  • Each side's advertised operating-parameter ranges are checked for overlap; disjoint ranges reject the pairing, which the responder reports as PairingRefused.

Every outbound envelope is stamped with the protocol version, but the reference library does not check the version on inbound messages and performs no version negotiation. See Versioning.

The Owner may also pair additional devices as Replicas to extend the Owner identity across more than one device. Replica pairing uses the same cryptographic handshake plus a fingerprint cross-confirmation gate and a shared-key handover into the replica group — see Pairing replicas.

The outcome of this phase is a valid, trusted communication context between the Owner identity (Owner + any paired Replicas) and each Helper.

Phase 2: Protection (Share Distribution)

In this phase, the Owner prepares the Secret for recoverability and distributes it across the Owner identity.

Conceptually:

  • The Owner splits the Secret into n shares using a threshold secret-sharing scheme. Each share carries as many subshares as its Helper's weight (one by default); see Weighted helpers.

  • Each share is transmitted to its corresponding Helper.

  • Helpers validate their assigned share before storing it — its size against their own configured range, its encoding, and its Merkle proof — and refuse one that fails.

  • The Owner keeps a proof of each Helper's share (the exact bytes it sent) to check later verification answers. It deletes a channel's proof when the round settles that channel as failed, and, when a Helper confirms, its proofs other than the round's version and its keepVersion, since the Helper has deleted those shares.

  • In parallel, the full Secret is sent to every paired Replica so the Owner identity stays in sync across all its devices.

Helpers store only their assigned share and associated metadata. The Secret itself is never transmitted to any Helper.

Phase 3: Verification

The protocol may include verification flows that allow the Owner (or any Replica acting on its behalf) to confirm that Helpers:

  • Have correctly stored the share

  • Can participate in recovery

  • Are reachable and operational

Verification typically uses a challenge-response mechanism that allows the requester to confirm share possession without reconstructing the Secret. Verification improves operational assurance while preserving the confidentiality of recovery material.

Each ShareVerified carries the subshares that Helper holds for the version and the version's own t, so the application can judge whether the verified Helpers alone could recover it. See Judging a version's recoverability. Only versions whose round completed have proofs to check against: verifying any other reports VerifySharesFailed with reason NoProof and sends no challenge.

Phase 4: Recovery

Recovery is explicitly initiated by the Owner (or any Replica acting on its behalf) by requesting shares from Helpers and reconstructing the Secret once the threshold is satisfied.

Recovery involves:

  • Establishing a valid recovery session

  • Authenticating with Helpers

  • Requesting stored shares

  • Receiving and validating each response as it arrives

  • Reconstructing the Secret once consistent shares carrying at least t subshares are obtained

  • Restoring operational Owner state from the reconstructed Secret

Each response is judged on its own before it counts:

  • A Helper that answers with a non-OK status — for example UNKNOWN_SHARE_VERSION when it holds no share for the requested version — is reported as RecoveryShareRefused. Nothing is collected and recovery stays open for the other Helpers.

  • A share that is missing, undecodable, bound to another secret or version, bigger than this device's own configured maxShareSize (rejected before being parsed at all), or whose Merkle proof does not open to its own commitment root is set aside and reported as RecoveryShareCorrupted (Malformed or InvalidProof).

  • Only the remaining shares count towards shares_received, one per Helper.

Reconstruction then groups the valid shares by commitment root and ciphertext and tries the largest group first, ties going to the group whose first share arrived earliest; a group of one is never tried. The first group that decrypts wins. Valid shares outside it are reported as RecoveryShareCorrupted with reason Inconsistent, alongside SecretRecovered. A corrupted share therefore cannot block a recovery that the honest Helpers can complete. See Events.

Reconstructing the Secret recovers the user-facing data, but a freshly recovering device is not yet an operational Owner: it drove recovery over throwaway channels and holds no committed snapshot. A distinct restore step turns it back into a full Owner — it re-establishes the canonical channels to every Helper and Replica named in the recovered Secret, commits the Secret snapshot at the recovered version, and retires the temporary recovery channels.

Where the application asks the user

SecretRecovered writes nothing. It hands the recovered Secret to the application, which shows it to the user, or asks them whether to adopt it, before calling restore. Only restore commits it to the device.

The same pause is where the application decides between restore and join. The recovered Secret carries the roster's replica group (secret.replicas: its members and the group channel). When a member other than the lost device is still live, restore is the wrong path: the application tells the user and offers to join the existing group as a new replica, pairing with a live member and catching up. Neither path gives the new device the proofs of earlier versions, so it cannot verify them: restore writes none, and every push or catch-up a joining device receives carries the share map of a single version. The live members keep the proofs they hold. A restored device also cannot publish, or answer a member's catch-up, until it is configured with a replica_id the roster names, and taking the lost device's id puts a second device in that member's role. Joining adds it as a new member instead. See Restore or join after recovery.

What restore does

  • Validation first. Every key, id, and role in the recovered roster — including entries that will be skipped — is validated before any store is written. The snapshot write is the commit point: nothing is removed before it succeeds.

  • Peers without endpoints are skipped. A roster entry with no endpoint gets no channel and is reported as PeerNotRestored with reason NoTransports; the rest of the roster is restored. The peer itself is untouched — a Helper still holds its share — and pairing with it again is what makes it reachable.

  • Weights and t come back. restore writes each Helper's roster weight into the channel it creates, and the roster's t into the snapshot, so the device publishes with the same weights and threshold the Secret was protected with.

  • Teardown is reported. Retiring the recovery channels emits Unpaired for each, plus UnpairFailed when the unpair request could not be sent. restore returns events, and the application handles them like any other.

After a restore

  • No identity is adopted. restore does not take on a replica identity from the roster: claiming a lost device's identity is a takeover with its own convergence rules. When the recovered Secret carries a replica group, the next publish needs a configured replica_id that the roster names; without one it fails with ReplicaIdNotConfigured and no share reaches any Helper.

  • Verification needs one publish first. restore writes no owner-side tracking shares, so verification at the recovered version sends no challenge and reports every channel as VerifySharesFailed with reason NoProof. One ProtectSecret publishes recovered_version + 1 and writes the tracking shares that make verification work from then on. Pass the stored weights unchanged (a Helper left out of the map returns to weight 1) and no threshold, so the restored ones stand.

A Replica that holds a current snapshot of the Secret does not need to drive this flow — it already has the user-facing data locally. The Helper-quorum recovery path remains available as a fallback when the cached Secret is stale or absent. See Recovery transitivity for the three paths a Replica can use.

Once restore has rebuilt the operational Owner, running a fresh round of Sharing is the expected next step: it bumps the Secret to the next version, re-syncs every Replica, restores verification, and is a natural point to prune Helpers that are no longer responsive. restore re-establishes the channels; the follow-up Sharing round refreshes the material on them. This assumes the recovered group has no live Replica; when it has one, the device joins the group instead of restoring, so it never takes the lost device's place. See Restore or join after recovery.

Phase 5: Reconfiguration (Optional)

Over time, the Owner may:

  • Add or remove Helpers

  • Add or remove Replicas

  • Change the recovery threshold (an explicit threshold on ProtectSecret) or the Helpers' weights

  • Rotate recovery material

Each of these changes increments the Secret's version and produces a new snapshot, which is then redistributed — a fresh share to every paired Helper and the full updated Secret to every paired Replica. See Secret for the version-bump rule and Secret synchronization for the wire mechanics.

This phase ensures long-term flexibility without weakening threshold guarantees.

Lifecycle Properties

The protocol lifecycle ensures:

  • Recovery authority is distributed across independent Helpers

  • No unilateral recovery is possible from a single Helper share

  • Protection, verification, and recovery occur through explicit protocol flows

  • Threshold guarantees are preserved throughout configuration changes

  • Every device under the Owner identity stays consistent with the current Secret state

The lifecycle model provides a structured mental model for implementers before examining the normative protocol flows.

Last updated