#sdk #services #commitment #row #file #generate #zkdoc

zkdoc_sdk

SDK for zkdoc allowing plug and play with any application

2 releases

0.0.1 Feb 9, 2023
0.0.0 Feb 9, 2023

#33 in #commitment


Used in zkdoc_cli

MIT license

115KB
2.5K SLoC

zkdoc_sdk

Usage

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,
  );

}

API documentation

The full api docs is available at doc.rs.

Dependencies

~6–10MB
~184K SLoC