MCPcopy Create free account
hub / github.com/deltadevsde/prism / from_str

Method from_str

crates/keys/src/algorithm.rs:38–47  ·  view source on GitHub ↗
(input: &str)

Source from the content-addressed store, hash-verified

36 type Err = CryptoError;
37
38 fn from_str(input: &str) -> Result<CryptoAlgorithm> {
39 match input.to_lowercase().as_str() {
40 "ed25519" => Ok(CryptoAlgorithm::Ed25519),
41 "secp256k1" => Ok(CryptoAlgorithm::Secp256k1),
42 "secp256r1" => Ok(CryptoAlgorithm::Secp256r1),
43 "eip191" => Ok(CryptoAlgorithm::Eip191),
44 "cosmos_adr36" => Ok(CryptoAlgorithm::CosmosAdr36),
45 _ => Err(SignatureError::AlgorithmError(input.to_string()).into()),
46 }
47 }
48}
49
50impl std::fmt::Display for CryptoAlgorithm {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected