(bytes: &[u8])
| 21 | use wasm_bindgen::prelude::*; |
| 22 | |
| 23 | fn public_key(bytes: &[u8]) -> Result<PublicKey, JsError> { |
| 24 | let bytes: &[u8; 32] = bytes |
| 25 | .try_into() |
| 26 | .map_err(|_| JsError::new("an Ed25519 public key is 32 bytes"))?; |
| 27 | PublicKey::from_bytes(bytes).map_err(|e| JsError::new(&e.to_string())) |
| 28 | } |
| 29 | |
| 30 | fn parse(json: &str) -> Result<serde_json::Value, JsError> { |
| 31 | serde_json::from_str(json).map_err(|e| JsError::new(&format!("not JSON: {e}"))) |
no outgoing calls
no test coverage detected