use crate::types::ShakrsConfig;
#[expect(
clippy::type_complexity,
reason = "serde_json::Error is the honest serialization-failure type for a JSON crate; aliasing it would hide the error source."
)]
pub fn canonicalize(config: &ShakrsConfig) -> Result<Vec<u8>, serde_json::Error> {
let value = serde_json::to_value(config)?;
let mut bytes = serde_json::to_vec_pretty(&value)?;
bytes.push(b'\n');
Ok(bytes)
}
#[expect(
clippy::type_complexity,
reason = "Mirrors canonicalize's signature; serde_json::Error is the honest serialization-failure type."
)]
pub fn scaffold_default() -> Result<Vec<u8>, serde_json::Error> {
canonicalize(&ShakrsConfig::default())
}