Load an explicit Ed25519 signing key file (64 hex characters). CB-7A keeps binding/Anchor signatures on explicit key files only; no default identity is wired (managed signing is CB-12B).
(key_file: &Path)
| 165 | /// CB-7A keeps binding/Anchor signatures on explicit key files only; no |
| 166 | /// default identity is wired (managed signing is CB-12B). |
| 167 | pub(crate) fn load_signing_key(key_file: &Path) -> CliResult<atomic_identity::keypair::KeyPair> { |
| 168 | let text = std::fs::read_to_string(key_file).map_err(|error| { |
| 169 | CliError::Repository(atomic_repository::RepositoryError::InvalidOperation { |
| 170 | message: format!( |
| 171 | "cannot read signing key file '{}': {error}", |
| 172 | key_file.display() |
| 173 | ), |
| 174 | }) |
| 175 | })?; |
| 176 | let hex = text.trim(); |
| 177 | if hex.len() != 64 || !hex.chars().all(|c| c.is_ascii_hexdigit()) { |
| 178 | return Err(CliError::Repository( |
| 179 | atomic_repository::RepositoryError::InvalidOperation { |
| 180 | message: "signing key file must hold exactly 64 hex characters (a 32-byte Ed25519 secret key)" |
| 181 | .to_string(), |
| 182 | }, |
| 183 | )); |
| 184 | } |
| 185 | let mut secret = [0u8; 32]; |
| 186 | for (index, byte) in secret.iter_mut().enumerate() { |
| 187 | *byte = u8::from_str_radix(&hex[index * 2..index * 2 + 2], 16).map_err(|error| { |
| 188 | CliError::Repository(atomic_repository::RepositoryError::InvalidOperation { |
| 189 | message: format!("invalid hex in signing key file: {error}"), |
| 190 | }) |
| 191 | })?; |
| 192 | } |
| 193 | let secret = atomic_identity::keypair::SecretKey::from_bytes(&secret); |
| 194 | Ok(atomic_identity::keypair::KeyPair::from_secret_key(secret)) |
| 195 | } |
| 196 | |
| 197 | /// Assemble the bounded `changes.pack` blob for `ordered` from the |
| 198 | /// repository's own change store (RFC §8.6). Pack records are addressed |
no test coverage detected