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

Function public_key

atomic-wasm/src/lib.rs:23–28  ·  view source on GitHub ↗
(bytes: &[u8])

Source from the content-addressed store, hash-verified

21use wasm_bindgen::prelude::*;
22
23fn 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
30fn parse(json: &str) -> Result<serde_json::Value, JsError> {
31 serde_json::from_str(json).map_err(|e| JsError::new(&format!("not JSON: {e}")))

Callers 5

prepare_attestationFunction · 0.85
attach_proofFunction · 0.85
verify_attestationFunction · 0.85
did_for_public_keyFunction · 0.85
public_key_base32Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected