/// Buffer time before key expiry to trigger rotation. This ensures we rotate slightly before the
/// C-tor uses 3 hours for the link/auth key and 1 day for the signing key. Let's use 3 hours here,
fn build_proto_identities(now: SystemTime, keymgr: &KeyMgr) -> anyhow::Result<RelayIdentities> {
let cert_id_sign_ed = gen_signing_cert(&ed_id_kp, &kp_relaysign_id, now + KEY_DURATION_30DAYS)?;
/// If the key already exists, the error is ignored as this could happen if the system time drifts
fn generate_key<K>(keymgr: &KeyMgr, spec: &dyn KeySpecifier) -> Result<(), tor_keymgr::Error>
/// Returns `(removed, min_remaining)` where `removed` indicates whether any entry was deleted and
/// Attempt to generate a key and cert using the given [`KeyCertificateSpecifier`] which is signed
/// [`RelaySigningKeyCert`]. Note that identity keys are NOT generated within this function, it is
/// Returns the minimum valid until value if a key was generated. Else, a None value indicates that
fn try_generate_all(now: SystemTime, keymgr: &KeyMgr) -> anyhow::Result<Option<SystemTime>> {
/// Return (`removed`, `next_expiry`) where the `removed` indicates if at least one key has been
/// removed because it was expired. The `next_expiry` is the minimum value of all valid_until which