pub struct Keyring { /* private fields */ }Expand description
Runtime key rotation for one node, from Memberlist::keyring.
Every call acts on this node only. To rotate a cluster, run each step on every node and wait for it to finish everywhere before starting the next:
installthe new key, so every node can read it;use_keyit, so every node sends with it;removethe old key.
A node that falls a step behind looks dead to its peers until it catches up, and they count
what they dropped as decrypt_failures in Stats. A node that runs without encryption
refuses every call with Error::NotEncrypted. Key ids are safe to log; key bytes never are.
A handle is cheap to clone and keeps working only while the node runs: calls on a closed node
fail with Error::Closed.
Implementations§
Source§impl Keyring
impl Keyring
Sourcepub async fn install(&self, key: Key) -> Result<(), Error>
pub async fn install(&self, key: Key) -> Result<(), Error>
Adds key to the keys this node can decrypt with. Does nothing if it is installed.
Sourcepub async fn use_key(&self, key: Key) -> Result<(), Error>
pub async fn use_key(&self, key: Key) -> Result<(), Error>
Makes the installed key the one this node encrypts with. Every installed key still
decrypts. Fails with Error::KeyNotInstalled for a key that was never installed.
Named use_key because use is a Rust keyword; Python spells it use.
Sourcepub async fn remove(&self, key: Key) -> Result<(), Error>
pub async fn remove(&self, key: Key) -> Result<(), Error>
Drops key. Fails with Error::KeyInUse for the key this node encrypts with and
Error::LastKey for the only one; a key that is not installed is already gone.