(value: &str)
| 243 | } |
| 244 | |
| 245 | fn decode_proof_value(value: &str) -> Result<Signature> { |
| 246 | let mut chars = value.chars(); |
| 247 | match chars.next() { |
| 248 | Some(MULTIBASE_BASE58_BTC) => {} |
| 249 | _ => { |
| 250 | return Err(CanonicalError::Proof(format!( |
| 251 | "unsupported multibase prefix in proofValue: {value:.4}…" |
| 252 | ))) |
| 253 | } |
| 254 | } |
| 255 | let body = &value[MULTIBASE_BASE58_BTC.len_utf8()..]; |
| 256 | let bytes = bs58::decode(body) |
| 257 | .into_vec() |
| 258 | .map_err(|e| CanonicalError::Proof(format!("bad base58btc proofValue: {e}")))?; |
| 259 | Signature::from_slice(&bytes).map_err(|e| CanonicalError::Proof(e.to_string())) |
| 260 | } |
| 261 | |
| 262 | #[cfg(test)] |
| 263 | mod tests { |
no test coverage detected