(value: &str)
| 290 | } |
| 291 | |
| 292 | fn decode_proof_value(value: &str) -> Result<Signature> { |
| 293 | let mut chars = value.chars(); |
| 294 | match chars.next() { |
| 295 | Some(MULTIBASE_BASE58_BTC) => {} |
| 296 | _ => { |
| 297 | return Err(CanonicalError::Proof(format!( |
| 298 | "unsupported multibase prefix in proofValue: {value:.4}…" |
| 299 | ))) |
| 300 | } |
| 301 | } |
| 302 | let body = &value[MULTIBASE_BASE58_BTC.len_utf8()..]; |
| 303 | let bytes = bs58::decode(body) |
| 304 | .into_vec() |
| 305 | .map_err(|e| CanonicalError::Proof(format!("bad base58btc proofValue: {e}")))?; |
| 306 | Signature::from_slice(&bytes).map_err(|e| CanonicalError::Proof(e.to_string())) |
| 307 | } |
| 308 | |
| 309 | #[cfg(test)] |
| 310 | mod tests { |
no test coverage detected