From e86fbac0b72e82503402cb456ce674622602b727 Mon Sep 17 00:00:00 2001 From: Kevin Lewi Date: Mon, 28 Jun 2021 11:26:14 -0700 Subject: [PATCH] Add copyright header and update server consistency documentation --- src/impls.rs | 5 +++++ src/lib.rs | 23 +++++++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/impls.rs b/src/impls.rs index 1faba3c..675174f 100644 --- a/src/impls.rs +++ b/src/impls.rs @@ -1,3 +1,8 @@ +// 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. + macro_rules! impl_debug_eq_hash_for { (struct $name:ident$(<$($gen:ident$(: $bound:tt)?),+$(,)?>)?, [$field1:ident$(, $field2:ident)*$(,)?]$(, )?$([$($type:ty),+$(,)?]$(,)?)?) => { impl$(<$($gen$(: $bound)?),+>)? std::fmt::Debug for $name$(<$($gen),+>)? diff --git a/src/lib.rs b/src/lib.rs index a99f406..fe1b9ce 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -417,7 +417,8 @@ //! //! A [ClientLoginFinishResult] contains the `server_s_pk` field, which is represents the static public key of the server that is established //! during the setup phase. This can be used by the client to verify the authenticity of the server it engages with during the login phase. In particular, -//! the client can check that the static public key of the server supplied during registration matches this field during login. +//! the client can check that the static public key of the server supplied during registration (with the `server_s_pk` field of +//! [ClientRegistrationFinishResult]) matches this field during login. //! ``` //! # use opaque_ke::{ //! # errors::ProtocolError, @@ -439,13 +440,15 @@ //! # b"password", //! # )?; //! # let mut server_rng = OsRng; -//! // During setup, server generates its static keypair -//! let server_setup = ServerSetup::::new(&mut server_rng); +//! # let server_setup = ServerSetup::::new(&mut server_rng); //! # let server_registration_start_result = ServerRegistration::::start(&server_setup, client_registration_start_result.message, b"alice@example.com")?; -//! -//! // During setup or registration, the server transmits its static public key to the client -//! let server_s_pk = server_setup.keypair().public(); // obtained from the server -//! # let client_registration_finish_result = client_registration_start_result.state.finish(&mut client_rng, server_registration_start_result.message, ClientRegistrationFinishParameters::default())?; +//! // During registration, the client obtains a ClientRegistrationFinishResult with +//! // a server_s_pk field +//! let client_registration_finish_result = client_registration_start_result.state.finish( +//! &mut client_rng, +//! server_registration_start_result.message, +//! ClientRegistrationFinishParameters::default(), +//! )?; //! # let password_file_bytes = ServerRegistration::::finish(client_registration_finish_result.message).serialize(); //! # let client_login_start_result = ClientLogin::::start( //! # &mut client_rng, @@ -464,11 +467,11 @@ //! ClientLoginFinishParameters::default(), //! )?; //! -//! // Check that the server's static public key matches what was obtained during -//! // setup or registration +//! // Check that the server's static public key obtained from login matches what +//! // was obtained during registration //! assert_eq!( +//! &client_registration_finish_result.server_s_pk, //! &client_login_finish_result.server_s_pk, -//! server_s_pk, //! ); //! # Ok::<(), ProtocolError>(()) //! ```