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

Function attach_proof

atomic-wasm/src/lib.rs:72–82  ·  view source on GitHub ↗
(
    document: &str,
    public_key_bytes: &[u8],
    signature: &[u8],
)

Source from the content-addressed store, hash-verified

70/// bytes) and check it verifies. Returns the attested document (JSON).
71#[wasm_bindgen(js_name = attachProof)]
72pub fn attach_proof(
73 document: &str,
74 public_key_bytes: &[u8],
75 signature: &[u8],
76) -> Result<String, JsError> {
77 let pk = public_key(public_key_bytes)?;
78 let sig = Signature::from_slice(signature).map_err(|e| JsError::new(&e.to_string()))?;
79 let attested = proof::attach_proof(parse(document)?, &pk, &sig);
80 proof::verify_value(&attested, &pk).map_err(|e| JsError::new(&e.to_string()))?;
81 Ok(attested.to_string())
82}
83
84/// Check an attested document (JSON) against a public key.
85#[wasm_bindgen(js_name = verifyAttestation)]

Calls 3

public_keyFunction · 0.85
verify_valueFunction · 0.85
parseFunction · 0.70