Crates.io | zkdoc_sdk |
lib.rs | zkdoc_sdk |
version | 0.0.1 |
source | src |
created_at | 2023-02-09 08:47:32.677957 |
updated_at | 2023-02-09 13:23:34.271221 |
description | SDK for zkdoc allowing plug and play with any application |
homepage | |
repository | https://github.com/medi-0/core/tree/main/zkdoc_sdk |
max_upload_size | |
id | 780595 |
size | 112,933 |
zkdoc_sdk
First, add it with cargo like so:
cargo add zkdoc_sdk
Now, you can start using it!
use zkdoc_sdk::services::services::{
generate_proof, get_file_commitment_and_selected_row, get_selected_row, verify_correct_selector,
};
fn main() {
// Generate a commitment, and save it somewhere for verification later
let commitment = get_file_commitment_and_selected_row(
row_titles.to_owned(),
row_contents.to_owned(),
row_selectors.to_owned(),
);
// Generate proofs here
let proof = generate_proof(
row_titles.to_owned(),
row_contents.to_owned(),
row_selectors.to_owned(),
);
// Verify proofs like so
let row_accumulator = get_selected_row(row_title.to_owned(), row_content.to_owned());
let is_valid = verify_correct_selector(
commitment,
row_accumulator,
proof,
);
}
The full api docs is available at doc.rs.