MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / rotate

Method rotate

nodedb/src/control/security/keystore/vault.rs:197–212  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

195 }
196
197 async fn rotate(&self) -> Result<Zeroizing<[u8; 32]>> {
198 let old_ciphertext = self.read_ciphertext_blob()?;
199
200 // Rewrap with Vault (no plaintext leaves Vault during rewrap).
201 let new_ciphertext = self.rewrap_with_vault(&old_ciphertext).await?;
202 self.write_ciphertext_blob(&new_ciphertext)?;
203
204 // Decrypt the new ciphertext to get the new plaintext key.
205 let key = self.decrypt_with_vault(&new_ciphertext).await?;
206 info!(
207 mount = %self.mount,
208 key_name = %self.key_name,
209 "Vault transit key rotated successfully"
210 );
211 Ok(key)
212 }
213}
214
215fn decode_32_byte_b64(b64: &str) -> Result<Zeroizing<[u8; 32]>> {

Callers 1

Calls 4

rewrap_with_vaultMethod · 0.80
decrypt_with_vaultMethod · 0.80
read_ciphertext_blobMethod · 0.45
write_ciphertext_blobMethod · 0.45

Tested by

no test coverage detected