Skip to content

Replace [vrf] crate with pure Rust impl for use in WASM assembly #153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Mar 3, 2022

Conversation

slawlor
Copy link
Contributor

@slawlor slawlor commented Feb 25, 2022

This PR replaces the [vrf] crate which depends on OpenSSL with a more pure-Rust implementation. This is necessary to

  1. Lean out the code in it's dependency tree
  2. OpenSSL doesn't compile to WASM (WebAssembly)

Due to an error with the MAC version of clippy crashing, I am unable to verify clippy warnings so they may be flagged in this PR.

Additionally there are changes related to the way dependencies are handled in the core AKD crate. We're moving more towards conditional compilation with Cargo.toml enabled features rather than having all dependencies required all the time.

For example, from the updated docs

The akd crate supports multiple compilation features

serde: Will enable serde serialization support on all public structs used in storage & transmission operations. This is helpful in the event you wish to directly serialize the structures to transmit between library <-> storage layer or library <-> clients. If you’re also utilizing VRFs (see (2.) below) it will additionally enable the serde feature in the ed25519-dalek crate.

vrf (on by-default): Will enable support of verifiable random function (VRF) usage within the library. See [ecvrf.rs] for documentation about the VRF functionality being utilized within AKD. This functionality is added protection so auditors don’t see user identifiers directly and applies a level of user-randomness (think hashing) in the node labels such that clients cannot trivially generate node labels themselves for given identifiers, however they can verify that a label is valid for a given identitifier. Transitively will add dependencies on crates [curve25519-dalek] and [ed25519-dalek]. You can disable the VRF functionality by adding the no-default-features flags to your cargo dependencies.

public-tests: Will expose some internal sanity testing functionality, which is often helpful so you don’t have to write all your own unit test cases when implementing a storage layer yourself. This helps guarantee the sanity of a given storage implementation. Should be used only in unit testing scenarios by altering your Cargo.toml as such

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 25, 2022
@kevinlewi
Copy link
Contributor

Nice!!

@slawlor slawlor marked this pull request as ready for review February 26, 2022 11:52
@slawlor
Copy link
Contributor Author

slawlor commented Feb 28, 2022

Blocked on #155 fixing the error in the MySQL tests infra

@slawlor slawlor requested review from kevinlewi and eozturk1 March 1, 2022 17:59
Copy link
Contributor

@eozturk1 eozturk1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work bringing in the EC VRF implementation @slawlor! :)

@slawlor slawlor merged commit 9273fd9 into main Mar 3, 2022
@slawlor slawlor deleted the slawlor/vrf branch March 3, 2022 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Differentiate between private and non-private mode Adding VRF-based computation of labels
4 participants