diff --git a/src/group.rs b/src/group.rs index 27d0b39..8a297f9 100644 --- a/src/group.rs +++ b/src/group.rs @@ -3,6 +3,9 @@ // This source code is licensed under the MIT license found in the // LICENSE file in the root directory of this source tree. +//! Defines the Group trait to specify the underlying prime order group used in +//! OPAQUE's OPRF + use crate::errors::InternalPakeError; use curve25519_dalek::{ @@ -53,6 +56,7 @@ pub trait Group: Sized + for<'a> Mul<&'a ::Scalar, Output = Self> /// may not be necessary as this function is going to be called with the /// output of a kdf. type UniformBytesLen: ArrayLength; + /// Hashes a slice of pseudo-random bytes of the correct length to a curve point fn hash_to_curve(uniform_bytes: &GenericArray) -> Self; } diff --git a/src/lib.rs b/src/lib.rs index 95eb464..aba0b31 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -395,8 +395,8 @@ pub mod opaque; pub mod ciphersuite; mod envelope; -mod group; -mod map_to_curve; +pub mod group; +pub mod map_to_curve; pub mod key_exchange; pub mod keypair; diff --git a/src/map_to_curve.rs b/src/map_to_curve.rs index 8992d9a..57123b1 100644 --- a/src/map_to_curve.rs +++ b/src/map_to_curve.rs @@ -1,10 +1,20 @@ +// Copyright (c) Facebook, Inc. and its affiliates. +// +// This source code is licensed under the MIT license found in the +// LICENSE file in the root directory of this source tree. + +//! Defines the GroupWithMapToCurve trait to specify how to map a password to a +//! curve point + use crate::group::Group; use curve25519_dalek::{edwards::EdwardsPoint, ristretto::RistrettoPoint}; use generic_array::GenericArray; use hkdf::Hkdf; +/// A subtrait of Group specifying how to has a password into a point pub trait GroupWithMapToCurve: Group { + /// transforms a password and optional pepper into a curve point fn map_to_curve(password: &[u8], pepper: Option<&[u8]>) -> Self; }