MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / decode_proof_value

Function decode_proof_value

atomic-canonical/src/proof.rs:292–307  ·  view source on GitHub ↗
(value: &str)

Source from the content-addressed store, hash-verified

290}
291
292fn 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)]
310mod tests {

Callers 2

proof_signatureFunction · 0.85
verify_valueFunction · 0.85

Calls 4

ProofClass · 0.85
into_vecMethod · 0.80
decodeFunction · 0.50
nextMethod · 0.45

Tested by

no test coverage detected