Key objects
The DeRec protocol is built around a small set of core objects that define how protection and recovery operate. These objects are referenced throughout the protocol flows, message schemas, and reference implementations.
Secret
The Secret is the central protocol-level object an Owner identity protects. It carries everything the Owner identity needs in order to operate the protocol: the user-facing data the application is protecting, the roster of paired Helpers (with the per-Helper shared keys), the roster of paired Replicas (with the replica-group shared key) and a version that increments whenever any of this changes.
The protocol has two views of it:
At the primitives level, a Secret is an opaque bag of bytes — the sharing scheme encrypts it under a fresh key and splits only that key into shares.
At the protocol level, a Secret is a self-contained structured object:
{
"secret_id": "...",
"version": "...",
"secret": {
"helpers": [
{
"channel_id": "...",
"transports": [{ "uri": "https://helper.example/derec", "protocol": 0 }],
"shared_key": "...",
"communication_info": {}
}
],
"secrets": [
{ "id": "...", "name": "...", "data": "..." }
],
"replicas": {
"channel_id": "...",
"shared_key": "...",
"members": [
{
"replica_id": "...",
"transports": [{ "uri": "https://phone.example/derec", "protocol": 0 }],
"role": "Source",
"communication_info": {}
}
]
}
}
}replicas is absent when the Owner identity has no replica group. Every member entry carries a role; exactly one member is the Source.
The user-facing data lives inside secret.secrets. Examples of what an application might place there:
Wallet seed phrases
Private signing keys
Credentials
Encrypted backup material
Helpers never receive the Secret itself — they receive shares of it. Only the Owner — and any Replica devices under the same Owner identity — hold the full Secret.
Shared Key
A Shared Key is a symmetric key that authenticates and encrypts every message exchanged on a channel between two participants. Every message — pair handshakes excepted — is sealed under a Shared Key; without it, an inbound envelope cannot be decrypted.
How a Shared Key is obtained:
Through the pair handshake. When two participants pair for the first time, the cryptographic handshake (a hybrid ECIES + ML-KEM key agreement) yields a handshake key: the ML-KEM shared secret XOR the ECDH shared secret. Both sides then derive the channel key from it and the 32-byte fingerprint nonce the contact creator committed to and revealed in the pair response:
SHA-256("DeRec channel key v1" ‖ handshakeKey ‖ nonce). The channel's fingerprint and its rotated long-term channel id are both derived from this key. See Fingerprint commitment and channel key.Through inheritance, for Replicas joining an existing group. A new Replica pairs with one existing member and derives a pairing key from that handshake. Its first copy of the Secret arrives on the pairing channel, under the pairing key, and carries the group's channel and Shared Key. The joiner then moves onto the group channel, acknowledges there under the group key, and drops the pairing channel.
How a Shared Key is used:
Per-Helper Shared Key. Each Owner ↔ Helper channel has its own Shared Key, established at pairing. It encrypts every protocol message on that channel. Because the key lives inside the Secret's
secret.helpersroster, every Replica synced with the Owner also holds it, and can talk to that Helper as the Owner identity.Replica-group Shared Key. All Replicas in the same group communicate among themselves under a single shared key, on a single shared channel. Both live on the Secret's
secret.replicascomposite alongside the member roster — they are group-level, not per-member. A device that holds the current Secret holds them by construction.
Secret Identifier (secret_id)
Each protected Secret is assigned a Secret Identifier (secret_id). The secret_id uniquely identifies a Secret within the protocol and is fixed for the lifetime of the Owner identity. It is used to coordinate every protocol flow that touches that Secret — share storage, verification, recovery, replica synchronization.
An application may run multiple independent protocol instances within the same environment, each managing its own Secret with its own secret_id.
Secret Version (version)
The Secret's version is a monotonic counter that increments once per publish round. Every ProtectSecret publishes a new version, and so do the publishes the library runs on its own after a Helper pairs and after a fingerprint confirmation makes a channel usable (when there is something to publish). Typical reasons for a new version:
User secrets are added, removed, or rotated
Helpers are added to or removed from the Helper Set
Replicas are added to or removed from the replica group
The threshold or a Helper's weight changes, through an explicit
ProtectSecret
The threshold each version was split with is recorded with that version and carried in the Secret; changing the builder's configured threshold publishes nothing on its own.
Each publish round sends a fresh share to every paired Helper and the full updated Secret to every other replica group member. If the paired Helpers' total weight is below t, no split runs and the Helpers receive nothing for that version. The (secret_id, version) pair uniquely identifies a specific protected state of the Secret.
Shares
Shares are produced by verifiable secret sharing. The Secret is encrypted with AES-256-GCM under a fresh key, and that key is split with Shamir's threshold scheme into subshares, each one (x, y) pair. A share is what one Helper holds: one or more subshares — its weight, one by default — plus the ciphertext and the commitment material described below. If t is the threshold, counted in subshares, then:
Any set of valid shares carrying at least
tsubshares can reconstruct the key, and so decrypt the Secret.Any set carrying fewer than
tsubshares provides no information about the key.
Every weight stays below t, so no single Helper can reconstruct alone. With every Helper at weight 1, t is simply a count of shares. Helpers store one share for each (secret_id, version) they have been distributed. See Weighted helpers.
Committed Shares
In the DeRec protocol, shares are transmitted and stored together with cryptographic commitments that allow their correctness to be verified.
A committed share contains:
The share itself (its subshares plus ciphertext)
A commitment: the root of a SHA-256 Merkle tree over all shares of the version, one leaf per share, with leaves and internal nodes hashed under distinct tags
Proof material: the share's Merkle authentication path, which must have exactly the tree's depth
Committed shares enable the requester (the Owner, or any Replica acting on its behalf) to detect invalid or malicious shares during recovery. A share that fails its proof, or disagrees with the others, is reported and set aside; it never blocks recovery from the honest shares.
Threshold (t)
The Threshold defines the minimum number of subshares, carried by valid shares, required to reconstruct the encryption key.
Recovery condition:
Security guarantee:
The threshold is chosen by the Owner and determines the balance between availability and resistance to collusion. The builder's threshold (default 3) is only the starting value: each publish records the t it used, the Secret carries it, and later publishes reuse it until a ProtectSecret passes a new one. A threshold below 2 is rejected, because it would let a single Helper reconstruct the key. See The threshold is recorded.
Helper Set
The Helper Set is the collection of Helpers selected by the Owner for a given protection configuration. It is defined by:
Total number of Helpers (
n)Threshold (
t)Communication and pairing parameters
Replica
A Replica is an additional device under the same Owner identity that holds a synchronized copy of the Secret. Replicas extend the Owner's reach across multiple devices without requiring each device to pair separately with every Helper.
Key properties:
All Replicas share the Owner's trust boundary — see Roles.
The members of a group share one channel and one key. Exactly one member holds the
Sourcerole.Each published version reaches the other members best-effort. A member that missed one catches up with
ReplicaDiscovery.Once synced, any Replica can act toward the Helpers on the same footing as the Owner.
See Replicas in the Concepts chapter for the pair handshake, the synchronization mechanics, and the security implications.
Recovery Session
A Recovery Session is the protocol-governed process during which a participant (the Owner, or any Replica under the same Owner identity) retrieves shares from Helpers and reconstructs the Secret. It includes:
Establishment of valid protocol sessions
Share requests
Validation of responses
Reconstruction of the Secret from the recovered shares
restore(), which commits the recovered Secret to the device's stores and makes the device operational again
Reconstruction ends with a SecretRecovered event, which writes nothing. The application shows the recovered secret or asks the user to confirm it, then calls restore(). Until then the device holds only throwaway recovery channels.
Protocol Messages
Protocol Messages are structured data objects exchanged between participants. They are defined using message schemas (e.g., protobuf) and encode:
Share storage operations
Verification flows
Recovery requests and responses
Secret synchronization between Replicas
Error conditions
Object Relationship Overview
The object model ensures that the Secret is never sent to any Helper, that Helpers store only the minimal information required to enable threshold-based recovery, and that any participant under the Owner identity can drive recovery without depending on any specific device.
Last updated