Skip to main content

resolve_service_signing_key

Function resolve_service_signing_key 

Source
pub fn resolve_service_signing_key(
    secrets_dir: &Path,
    service_name: &str,
    profile: SecretsProfile,
) -> Result<SigningKey>
Expand description

Resolve the Ed25519 signing key a service process should use to sign its own RPC responses in --ipc (multi-process) deployment.

§PolicyService is special

PolicyService’s identity IS the root/CA key, not an independent per-service key: bootstrap_manager::do_bootstrap registers bootstrap_pubkeys["policy"] = root_key.verifying_key() (the same value persisted flat at secrets_dir/signing-key), rather than generating a secrets_dir/policy/signing-key like every other service gets.

Resolving “policy” via the generic per-service path (load_or_generate_service_signing_key) reads/generates a different file ({secrets_dir}/policy/signing-key) that bootstrap never populated — so on first --ipc startup it silently mints a fresh, unrelated key. Every peer that resolves “policy” from the trust store (seeded from bootstrap-pubkeys) still expects root_key.verifying_key(), so PolicyService’s actual responses fail verification with “Response signed by unexpected key” (#759) — a sibling gap to the CA-derivation fallback #441 already removed from resolve_service_key.

  • SecretsProfile::PerServiceScoped: the credential provider already scopes secrets_dir to that one service, so the flat top-level file is correct for every service, policy included.
  • SecretsProfile::SharedDirectory: secrets_dir is shared across every spawned service process, so non-policy services use a {service_name}/ subdirectory to avoid collisions — but policy must still resolve to the flat root/CA key, matching what bootstrap registered.