(value: &str)
| 192 | } |
| 193 | |
| 194 | fn decode_proof_value(value: &str) -> Result<Signature> { |
| 195 | let mut chars = value.chars(); |
| 196 | match chars.next() { |
| 197 | Some(MULTIBASE_BASE58_BTC) => {} |
| 198 | _ => { |
| 199 | return Err(CanonicalError::Proof(format!( |
| 200 | "unsupported multibase prefix in proofValue: {value:.4}…" |
| 201 | ))) |
| 202 | } |
| 203 | } |
| 204 | let body = &value[MULTIBASE_BASE58_BTC.len_utf8()..]; |
| 205 | let bytes = bs58::decode(body) |
| 206 | .into_vec() |
| 207 | .map_err(|e| CanonicalError::Proof(format!("bad base58btc proofValue: {e}")))?; |
| 208 | Signature::from_slice(&bytes).map_err(|e| CanonicalError::Proof(e.to_string())) |
| 209 | } |
| 210 | |
| 211 | #[cfg(test)] |
| 212 | mod tests { |
no test coverage detected