Fix some documentation issues.
This commit is contained in:
parent
295e42954a
commit
4ef9496776
|
@ -10,7 +10,7 @@ type Msg = String;
|
|||
|
||||
// The database schema that validator nodes use to store messages they receive from users.
|
||||
// Messages are first indexed numerically by user ID then alphabetically by message. Each message
|
||||
// is mapped to its list of valdidator signatures.
|
||||
// is mapped to its list of validator signatures.
|
||||
type MsgDatabase = BTreeMap<UserId, BTreeMap<Msg, Vec<NodeSignature>>>;
|
||||
|
||||
// An append-only list of chat message "blocks". Each block contains the user ID for the user who
|
||||
|
|
20
src/lib.rs
20
src/lib.rs
|
@ -299,6 +299,10 @@ impl Default for SecretKey {
|
|||
}
|
||||
|
||||
impl Distribution<SecretKey> for Standard {
|
||||
/// Creates a new random instance of `SecretKey`. If you do not need to specify your own RNG,
|
||||
/// you should use the [`SecretKey::random()`](struct.SecretKey.html#method.random) constructor,
|
||||
/// which uses [`rand::thread_rng()`](https://docs.rs/rand/0.6.1/rand/fn.thread_rng.html)
|
||||
/// internally as its RNG.
|
||||
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> SecretKey {
|
||||
SecretKey(Box::new(rng.gen04()))
|
||||
}
|
||||
|
@ -353,10 +357,12 @@ impl SecretKey {
|
|||
}
|
||||
|
||||
/// Creates a new random instance of `SecretKey`. If you want to use/define your own random
|
||||
/// number generator, you should use the constructor: `SecretKey::rand()`. If you do not need
|
||||
/// to specify your own RNG, you should use the `SecretKey::random()` constructor, which uses
|
||||
/// [`rand::thead_rng()`](https://docs.rs/rand/0.6.1/rand/fn.thread_rng.html) internally as
|
||||
/// its RNG.
|
||||
/// number generator, you should use the constructor:
|
||||
/// [`SecretKey::sample()`](struct.SecretKey.html#impl-Distribution<SecretKey>). If you do not
|
||||
/// need to specify your own RNG, you should use the
|
||||
/// [`SecretKey::random()`](struct.SecretKey.html#method.random) constructor, which uses
|
||||
/// [`rand::thread_rng()`](https://docs.rs/rand/0.6.1/rand/fn.thread_rng.html) internally as its
|
||||
/// RNG.
|
||||
pub fn random() -> Self {
|
||||
rand::random()
|
||||
}
|
||||
|
@ -406,6 +412,8 @@ impl SecretKey {
|
|||
#[derive(Clone, PartialEq, Eq, Default)]
|
||||
pub struct SecretKeyShare(SecretKey);
|
||||
|
||||
/// Can be used to create a new random instance of `SecretKeyShare`. This is only useful for testing
|
||||
/// purposes as such a key has not been derived from a `SecretKeySet`.
|
||||
impl Distribution<SecretKeyShare> for Standard {
|
||||
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> SecretKeyShare {
|
||||
SecretKeyShare(rng.gen())
|
||||
|
@ -633,7 +641,7 @@ impl From<Poly> for SecretKeySet {
|
|||
|
||||
impl SecretKeySet {
|
||||
/// Creates a set of secret key shares, where any `threshold + 1` of them can collaboratively
|
||||
/// sign and decrypt. This constuctor is identical to the `SecretKey::try_random()` in every
|
||||
/// sign and decrypt. This constructor is identical to the `SecretKeySet::try_random()` in every
|
||||
/// way except that this constructor panics if the other returns an error.
|
||||
///
|
||||
/// # Panic
|
||||
|
@ -645,7 +653,7 @@ impl SecretKeySet {
|
|||
}
|
||||
|
||||
/// Creates a set of secret key shares, where any `threshold + 1` of them can collaboratively
|
||||
/// sign and decrypt. This constuctor is identical to the `SecretKey::random()` in every
|
||||
/// sign and decrypt. This constructor is identical to the `SecretKeySet::random()` in every
|
||||
/// way except that this constructor returns an `Err` where the `random` would panic.
|
||||
pub fn try_random<R: Rng>(threshold: usize, rng: &mut R) -> Result<Self> {
|
||||
Poly::try_random(threshold, rng).map(SecretKeySet::from)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//! Eigth Mersenne prime field
|
||||
//! Eighth Mersenne prime field
|
||||
//!
|
||||
//! The eighth [Mersenne Prime](https://en.wikipedia.org/wiki/Mersenne_prime) (`MS8 := 2^31-1) can
|
||||
//! be used to construct a finite field supporting addition and multiplication. This module provides
|
||||
|
@ -43,7 +43,7 @@ fn modular_pow(base: u32, mut exp: u32, modulus: u32) -> u32 {
|
|||
result as u32
|
||||
}
|
||||
|
||||
/// Eigth Mersenne prime, aka `i32::MAX`.
|
||||
/// Eighth Mersenne prime, aka `i32::MAX`.
|
||||
pub const MS8: u32 = 0x7fff_ffff;
|
||||
|
||||
/// Eighth Mersenne prime field element
|
||||
|
|
|
@ -816,7 +816,7 @@ mod tests {
|
|||
let faulty_num = 2;
|
||||
|
||||
// For distributed key generation, a number of dealers, only one of who needs to be honest,
|
||||
// generates random bivariate polynomials and publicly commits to them. In partice, the
|
||||
// generates random bivariate polynomials and publicly commits to them. In practice, the
|
||||
// dealers can e.g. be any `faulty_num + 1` nodes.
|
||||
let bi_polys: Vec<BivarPoly> = (0..dealer_num)
|
||||
.map(|_| BivarPoly::random(faulty_num, &mut rng))
|
||||
|
|
|
@ -34,7 +34,7 @@ pub(crate) trait ContainsSecret {
|
|||
}
|
||||
}
|
||||
|
||||
/// A wrapper around temporary values to ensuer that they are cleared on drop.
|
||||
/// A wrapper around temporary values to ensure that they are cleared on drop.
|
||||
///
|
||||
/// `Safe<T>` is meant to be used a wrapper around `T`, where `T` is either an `&mut U` or
|
||||
/// `Box<U>`.
|
||||
|
|
Loading…
Reference in New Issue