auths_cli/commands/
verify_helpers.rs1use anyhow::{Context, Result, anyhow};
2
3pub fn parse_witness_keys(keys: &[String]) -> Result<Vec<(String, Vec<u8>)>> {
5 keys.iter()
6 .map(|s| {
7 let last_colon = s
9 .rfind(':')
10 .ok_or_else(|| anyhow!("Invalid witness key format '{}': expected DID:hex", s))?;
11 let did = &s[..last_colon];
12 let pk_hex = &s[last_colon + 1..];
13 let pk_bytes = hex::decode(pk_hex)
14 .with_context(|| format!("Invalid hex in witness key for '{}'", did))?;
15 Ok((did.to_string(), pk_bytes))
16 })
17 .collect()
18}