add circuit parameter export endpoint for wasm

This commit is contained in:
kilic 2020-11-17 13:51:21 +03:00
parent fefbed2958
commit ae5f8859c6
2 changed files with 11 additions and 1 deletions

3
.gitignore vendored
View File

@ -4,4 +4,5 @@
node_modules node_modules
*.key *.key
Cargo.lock Cargo.lock
.cargo .cargo
tmp_wasm

View File

@ -102,6 +102,15 @@ impl RLNWasm {
.expect("failed to write verifier key"); .expect("failed to write verifier key");
Ok(output) Ok(output)
} }
#[wasm_bindgen]
pub fn export_circuit_parameters(&self) -> Result<Vec<u8>, JsValue> {
let mut output: Vec<u8> = Vec::new();
self.circuit_parameters
.write(&mut output)
.expect("failed to write verifier key");
Ok(output)
}
} }
#[cfg(test)] #[cfg(test)]