Skip to content

Commit f275a05

Browse files
committed
Document all items
1 parent db64078 commit f275a05

File tree

4 files changed

+54
-3
lines changed

4 files changed

+54
-3
lines changed

Cargo.lock

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vrf/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ edition = "2024"
55

66
[dependencies]
77
digest = "=0.11.0-pre.10"
8-
signature = "2.3.0-pre.7"
8+
signature = "3.0.0-rc.1"

vrf/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# [RustCrypto]: Verifiable Random Functions
22

3+
Traits which provide generic, object-safe APIs for [verifiable random functions].
4+
35
## SemVer Policy
46

57
- All on-by-default features of this library are covered by SemVer
6-
- MSRV is considered exempt from SemVer as noted above
8+
- MSRV is considered exempt from SemVer
79

810
## License
911

@@ -20,3 +22,7 @@ Unless you explicitly state otherwise, any contribution intentionally submitted
2022
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
2123
dual licensed as above, without any additional terms or conditions.
2224

25+
[//]: # (links)
26+
27+
[verifiable random functions]: https://en.wikipedia.org/wiki/Verifiable_random_function
28+
[RustCrypto]: https://github.com/RustCrypto/

vrf/src/lib.rs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,58 @@
1+
#![no_std]
2+
#![doc = include_str!("../README.md")]
3+
#![doc(
4+
html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/8f1a9894/logo.svg",
5+
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/8f1a9894/logo.svg"
6+
)]
7+
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
8+
#![forbid(unsafe_code)]
9+
#![warn(
10+
clippy::mod_module_files,
11+
clippy::unwrap_used,
12+
missing_docs,
13+
rust_2018_idioms,
14+
unused_lifetimes,
15+
missing_debug_implementations,
16+
unused_qualifications
17+
)]
18+
19+
//! # Design
20+
//!
21+
//! Traits are defined to match the functionality of verifiable random functions in
22+
//! [RFC9381](https://www.rfc-editor.org/rfc/rfc9381.pdf).
23+
//!
24+
//! ## Verifying Proofs
25+
//!
26+
//! Trait based proof verification is delegated to the [`signature::Verifier`] trait, defined in
27+
//! the `signature` crate and re-exported here. The message corresponds to the `alpha` or
28+
//! `alpha_string` in RFC9381 (see section 1.2), and the signature corresponds to the [`Proof`].
29+
130
use digest::{Output, OutputSizeUser};
231

332
pub use signature::Verifier;
433

34+
35+
/// A VRF Proof, denoted `pi` or `pi_string` in RFC9381. See RFC9381 section 1.2 for details.
536
pub trait Proof<H>
637
where
738
H: OutputSizeUser,
839
{
40+
/// Get the hash of the VRF proof.
41+
///
42+
/// Defined as `VRF_proof_to_hash` in RFC9381 section 2.
943
fn to_hash(&self) -> Output<H>;
1044
}
1145

46+
/// A cryptographic key that has the capability to generate VRF proofs.
1247
pub trait Prover<H>
1348
where
1449
H: OutputSizeUser,
1550
{
51+
/// Proofs generated by this algorithm.
1652
type Proof: Proof<H>;
1753

54+
/// Generate a proof from the given alpha value.
55+
///
56+
/// defined as `VRF_proof` in RFC9381 section 2.
1857
fn prove(&self, alpha: &[u8]) -> Self::Proof;
1958
}

0 commit comments

Comments
 (0)