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

Function decode_proof_value

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

Source from the content-addressed store, hash-verified

192}
193
194fn 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)]
212mod tests {

Callers 1

verify_valueFunction · 0.85

Calls 2

ProofClass · 0.85
nextMethod · 0.45

Tested by

no test coverage detected