pub struct Recovering<'a> { /* private fields */ }Expand description
A recovery under way, which Library::start_recovery began: the new replica, which
nobody knows yet, holds what the backup holds of the personal space, and the keys sealed
to the code there. Recovering::holds_secrets says whether the code holds the
secrets, so that the person is asked how to protect them only then;
Recovering::others lists the person’s other devices, which Recovering::keep
keeps some of; and Recovering::finish does the rest. One dropped before it finishes
removes the new replica.
Implementations§
Source§impl Recovering<'_>
impl Recovering<'_>
Sourcepub const fn holds_secrets(&self) -> bool
pub const fn holds_secrets(&self) -> bool
Whether the code holds the secrets, which Recovering::finish takes then.
Sourcepub fn others(&self) -> Result<Vec<Replica>, NodeError>
pub fn others(&self) -> Result<Vec<Replica>, NodeError>
The replicas of the person’s other devices, which Recovering::finish revokes as
lost, but those that Recovering::keep keeps: every replica of the person’s that
is not revoked yet, but two that it revokes in any case: the one of the library that
no longer unlocks that the recovery reads, if it reads one, and the one that a
recovery cut short left in the same place, which the backup may list.
§Errors
Returns an error if the personal space cannot be read.
Sourcepub fn others_named(&self, target: &str) -> Result<Vec<Replica>, NodeError>
pub fn others_named(&self, target: &str) -> Result<Vec<Replica>, NodeError>
The replicas of Recovering::others that target names, as
Library::replicas_named finds them among them alone: those of a device, by its
name or ID, one replica by its ID, or an AI agent’s by its name.
§Errors
Returns NodeError::WhichDevice if target names none of them, or several, as
the library that the recovery reads, or a device revoked already, and an error if the
personal space cannot be read.
Sourcepub fn keep(&mut self, replicas: &[EntityId]) -> Result<(), NodeError>
pub fn keep(&mut self, replicas: &[EntityId]) -> Result<(), NodeError>
Keeps replicas, of those that Recovering::others lists, in place of those kept
before: Recovering::finish leaves them as they are, rather than revoke them, as
the person still has their devices.
§Errors
Returns NodeError::WhichDevice if one is none of those, or if the library that
no longer unlocks, which the recovery reads, names no replica of its own, which then
may be any of them, and then keeps nothing new; and an error if the personal space
cannot be read.
Sourcepub fn finish(
self,
secrets: Option<&NewProtection<'_>>,
now: &dyn Fn() -> u64,
rng: &mut impl CryptoRng,
) -> Result<(Library, Recovered), NodeError>
pub fn finish( self, secrets: Option<&NewProtection<'_>>, now: &dyn Fn() -> u64, rng: &mut impl CryptoRng, ) -> Result<(Library, Recovered), NodeError>
Finishes the recovery: lists the new replica by the code in the personal space; takes
the person’s other spaces and groups that the code is given, with what the backup holds
of each, and lists it in each, by the code on the person’s record, or through a group in
a space that the person reaches through a group alone; takes the secrets, if the code
holds them, protected as secrets says, unless it is None; then revokes every other
replica of the person’s, whose devices are lost, but those that Recovering::keep
keeps, and updates the backup; in place of a library here that no longer unlocks, sets
aside that library’s replica, as its last step. A recovery that fails removes the new
replica.
§Errors
Returns NodeError::LibraryPassphrase if secrets is the library’s passphrase,
NodeError::BackupBusy if another program updates the backup, and an error if the
source cannot be read, the replica written, or the replica it replaces set aside.