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

Function decode_proof_value

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

Source from the content-addressed store, hash-verified

243}
244
245fn 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)]
263mod tests {

Callers 1

verify_valueFunction · 0.85

Calls 2

ProofClass · 0.85
nextMethod · 0.45

Tested by

no test coverage detected