coven/member_keys.rs
1//! Replacing a member's signing and sealing pair on an open handle (E9).
2
3use super::*;
4
5impl CovenHandle {
6 /// Replace this member's signing and sealing pair (§10, §12.3). App writes
7 /// return `DbError::MemberKeysChanging` until it finishes; this
8 /// installation's queued writes and entries are confirmed first. A fresh
9 /// pair is kept in identity custody before its key copies and the entry
10 /// signed by the current pair are published. Returns once its slot binds
11 /// the pair and custody hold the new pair, returning its restore code.
12 /// A failure keeps both pairs and the attempt for retry;
13 /// a rejection is returned and never
14 /// overridden. Other installations holding the old pair report
15 /// `MemberKeysReplaced` and need the current keys.
16 pub async fn replace_member_keys(&self) -> Result<SecretText, SyncError> {
17 self.storage.replace_member_keys().await
18 }
19 /// Publishes a prepared public pair for another active member, in a
20 /// write of its own (`CovenWrite::replace_member_keys_for`).
21 pub async fn replace_member_keys_for(
22 &self,
23 member: &MemberId,
24 keys: MemberPublicKeys,
25 ) -> Result<Option<OperationId>, SyncError> {
26 let member = *member;
27 self.write(move |write| write.replace_member_keys_for(&member, keys)).await
28 }
29}