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

Threshold and availability model

The DeRec protocol uses a threshold-based recovery model to balance security and availability. This model defines how many Helpers participate in protection and how many must cooperate for recovery to succeed.

Parameters

Let:

  • n = total number of Helpers in the Helper Set

  • t = recovery threshold, counted in subshares

A share is what one Helper holds: its subshares, the encrypted Secret, the Merkle commitment and the Merkle path. A subshare is one Shamir (x, y) pair, y = f(x).

Each Helper's share carries one or more subshares. By default every Helper carries exactly one, so t and n coincide with a plain count of Helpers; an Owner may give a more-trusted Helper additional subshares (see Weighted helpers below), in which case t no longer equals a simple Helper count. Recovery succeeds only if the subshares carried by valid, mutually consistent shares obtained from distinct Helpers sum to at least t. Refused and corrupted responses do not count.

Condition for recovery:

t ≤ subshares carried by valid shares ≤ total subshares in the Helper Set

Security condition:

subshares carried by valid shares < t → reconstruction of the Secret is impossible

These guarantees derive from the underlying threshold secret-sharing scheme used by the protocol.

Weighted helpers

An Owner who trusts one Helper more than the others can give it more than one subshare, so that Helper plus fewer others can recover, while no single Helper ever holds enough subshares to recover alone: every weight must satisfy 1 ≤ weight < t. With t = 3, a Helper at weight 2 plus any one other Helper can recover, while any two of the remaining Helpers still cannot.

The weights are the weights map on DeRecFlow::ProtectSecret, and the map is the full assignment, not a patch: a paired Helper the map does not name gets one subshare, so an empty map resets every Helper to 1.

Weights are sticky. Each round writes the weight it resolved for every paired Helper to that Helper's channel record (HelperChannel.weight) before anything is sent. From then on:

  • The user chooses them. Before start(ProtectSecret), the application reads each paired Helper's stored weight from its own channel store, shows it to the user, and passes the user's final choice as the whole map. There is no getter or setter; weights change only through start(ProtectSecret).

  • Every other publish the application makes passes the stored weights unchanged — a republish after editing the secrets, the publish after restore. A Helper left out returns to 1, which silently undoes the user's choice.

  • Publishes the library starts on its own (after a Helper pairing completes, after a fingerprint is confirmed) reuse the stored weights. A newly paired Helper starts at 1.

  • The roster carries them. Each Helper's weight travels in the recovered Secret (helpers[].weight), and restore and replica hydration write it back into the channel records they create, so a recovered or replica device publishes with the same weights.

ProtectSecretStarted and ProtectSecretFailed report, per Helper, the weight sent (or meant to be sent) that round, which is also the weight now stored.

Validation runs in start, before anything is sent or a version is consumed: every key must be a currently paired Helper channel of the Secret, and every weight must satisfy 1 ≤ weight < t. An invalid entry fails with SharingError::InvalidWeight (invalid_weight). The check covers stored weights too: if t is lowered to or below a stored weight, the next publish — explicit or library-initiated — fails with InvalidWeight and zero messages sent, until a start(ProtectSecret) with valid weights publishes.

Below the threshold

The split runs only when the paired Helpers' total weight is ≥ t. Below that, no Helper receives anything and no ProtectSecretStarted / ProtectSecretFailed is emitted for any of them; Replicas still receive their copy of the Secret, and the version still advances and the snapshot is saved as latest. With no Replica paired, start returns no events at all. It is not an error.

Weights make this more reachable. Two Helpers at weight 2 against t = 3 (total 4) drop to a total of 2 if a publish leaves both out of the map, resetting each to 1 — a restore follow-up publish that does not pass the stored weights is the typical case. An application can detect it before calling, by summing the weights it is about to assign (or the stored ones) against t, or after, by counting the returned Helper events.

SharingComplete.threshold_met is judged the same way: the confirmed Helpers' combined weight against the round's t, not their count.

Capping the total subshares

A round also holds at most 128 shares, one per Helper: the Merkle commitment has one leaf per share and a fixed depth of 7.

The threshold is recorded

t is data, like the weights. The t a round splits at is, in order:

  1. the threshold passed on DeRecFlow::ProtectSecret, when given;

  2. otherwise the t stored with the Secret's latest snapshot (UserSecrets.threshold);

  3. otherwise the builder's with_threshold, which is only the starting t for a Secret with nothing stored.

Every publish records the t it used on its own snapshot, and the roster carries it (Secret.threshold). restore and replica hydration put it back, so a recovered device keeps splitting at the same t whatever its own configuration says. Publishes the library starts on its own never pass a threshold, so they use the stored one. Changing t is an explicit start(ProtectSecret) with a new threshold. The resolved t must be at least 2, above every resolved weight, and no greater than a with_max_subshares cap; every check runs before a version is chosen, so a failing round writes and sends nothing. A round that fails before its snapshot is saved leaves the previous t in place.

Each owner-side share also records the t of its version, so verifying an old version reports that version's own t, not the current one.

Judging a version's recoverability

Verification tells the Owner which Helpers still hold a version. Each ShareVerified carries subshares, the subshares that Helper holds for the version, and threshold, the t the version was split with; both come from the Owner's stored share for that channel and version. The version is recoverable from the verified Helpers when the sum of their subshares is ≥ threshold.

If either value is None on any of those events, the result is unknown. A None count is not 0 or 1: shares stored before 0.0.9 carry neither value, and the library never backfills them.

Protocol-enforced floor: t ≥ 2

Implementations MUST reject thresholds below 2. A threshold of 0 is meaningless; a threshold of 1 collapses the scheme to a single-share secret and lets any single Helper unilaterally reconstruct the Secret, defeating the entire point of threshold sharing. Two is the minimum value that preserves confidentiality against a single compromised Helper.

The protocol enforces this floor wherever t enters: building a protocol instance with with_threshold below 2 is rejected before any flow can be initiated, a threshold below 2 on ProtectSecret fails with SharingError::InvalidThreshold before anything is sent, and a roster carrying a threshold below 2 is malformed.

Security vs Availability Trade-off

The choice of threshold directly affects both resilience and recoverability.

Higher threshold (t close to n):

  • Stronger resistance to collusion

  • Lower tolerance for Helper unavailability

Lower threshold (t much smaller than n):

  • Higher availability

  • Lower resistance to collusion

The protocol does not mandate a specific threshold beyond the t ≥ 2 floor above. Within that constraint, t is configured by the Owner based on risk tolerance and Helper independence.

Availability Model

Availability depends on the Helpers that are reachable and operational at recovery time, counted by the subshares they hold.

  • Recovery succeeds if — subshares held by available Helpers ≥ t

  • Recovery fails if — subshares held by available Helpers < t

With every Helper at weight 1, this means the system can tolerate up to:

  • n - t unavailable Helpers

With weights, which Helpers can be lost depends on which ones they are: losing a heavier Helper costs more subshares.

Example (every Helper at weight 1):

If n = 5 and t = 3:

  • Up to 2 Helpers may be offline

  • At least 3 must be available for recovery

Collusion Model

Security assumes that fewer than t Helpers collude. If t or more Helpers combine their shares independently of the Owner, reconstruction of the Secret becomes possible.

Therefore:

  • Increasing t increases resistance to collusion

  • Decreasing t reduces collusion resistance

Each share goes to a different Helper

n counts Helpers, not channels, and the guarantees above hold only if each share goes to a different Helper: compromising one Helper must yield at most one share. The protocol hands out one share per channel per version and every pairing produces its own channel, but it cannot tell whether two channels lead to the same party.

Failure Scenarios

The threshold model behaves predictably under common failure conditions.

  • Single Helper compromise — Security preserved if t > 1. The protocol-enforced floor of t ≥ 2 guarantees this baseline holds for every configuration the library will accept.

  • Partial Helper compromise — Security preserved as long as compromised Helpers < t.

  • Helper outages — Recovery possible if available Helpers ≥ t.

  • Malicious Helper responses — Invalid or manipulated shares are detected and set aside, never used. A share that is malformed or whose Merkle proof fails is rejected on arrival; one that verifies on its own but belongs to a different split is identified at reconstruction, which groups shares by commitment root and ciphertext and uses the first group that decrypts. Each is reported as RecoveryShareCorrupted and does not count towards t. A Helper that declines (for example, it holds no share for the requested version) is reported as RecoveryShareRefused and likewise does not count. Recovery succeeds as long as t honest Helpers answer.

  • Threshold misconfiguration — Security or availability may be weakened due to operational choices, not protocol failure.

Practical Configuration Examples

n
t
Tolerates Offline Helpers
Collusion Resistance

3

2

1

1 compromised Helper

5

3

2

2 compromised Helpers

7

4

3

3 compromised Helpers

The optimal configuration depends on:

  • Trust distribution across Helpers

  • Operational reliability of Helpers

  • Risk tolerance for collusion

  • Desired recovery reliability

Replicas and the threshold model

The threshold model is defined entirely in terms of the Helper Set. Replicas — additional devices under the same Owner identity that hold a synchronized copy of the Secret — do not participate in threshold sharing and do not lower the threshold required for recovery from Helpers.

Replicas add an availability layer on top of the threshold model: a device that holds a current snapshot of the Secret already has the user-facing data and does not need to drive a recovery flow at all. The threshold-recovery path remains available as a fallback when no Replica has a fresh enough Secret. See Replicas for the full discussion.

Operating parameters beyond the threshold

t and n define the recovery guarantee, but they are not the only configurable parameters. Each pairing also carries a set of operating parameters that govern day-to-day behaviour rather than the threshold itself:

  • bounds on share size,

  • how often the Owner re-verifies a Helper,

  • how often shares are refreshed,

  • how long an unresponsive Helper is tolerated before it is deactivated or removed.

At pairing time each party advertises the range of values it supports for these parameters (0 means no bound), and the handshake is refused with INCOMPATIBLE_PARAMETER_RANGE if the two parties' ranges do not overlap or the peer's range is malformed — so two peers can never pair with irreconcilable expectations. The responder reports the refusal as PairingRefused; the initiator's pairing fails with the refusal's status. Note that the threshold t is not one of these negotiated parameters; it is chosen by the Owner and recorded with the Secret (see The threshold is recorded).

Design Implication

The threshold model is the core security mechanism of DeRec. It ensures that recovery authority is distributed and that no single Helper can unilaterally enable reconstruction.

Availability and security are not fixed properties of the protocol. They are configuration outcomes determined by the chosen values of n and t, as well as the operational independence of Helpers.

Last updated