Document that ReusableSecret is preferrable for Noise protocols.

This commit is contained in:
Isis Lovecruft 2021-09-14 22:33:31 +00:00
parent 588e48f8f2
commit edb9ec984e
No known key found for this signature in database
GPG key ID: AB41313533E8E812

View file

@ -102,6 +102,10 @@ impl<'a> From<&'a EphemeralSecret> for PublicKey {
/// Diffie-Hellman operation multiple times throughout the protocol, while the
/// protocol run at a higher level is only conducted once per key.
///
/// Similarly to [`EphemeralSecret`], this type does _not_ have serialisation
/// methods, in order to discourage long-term usage of secret key material. (For
/// long-term secret keys, see [`StaticSecret`].)
///
/// # Warning
///
/// If you're uncertain about whether you should use this, then you likely
@ -147,15 +151,6 @@ impl<'a> From<&'a ReusableSecret> for PublicKey {
/// serialization methods to save and load key material. This means that the secret may be used
/// multiple times (but does not *have to be*).
///
/// Some protocols, such as Noise, already handle the static/ephemeral distinction, so the
/// additional guarantees provided by [`EphemeralSecret`] are not helpful or would cause duplicate
/// code paths. In this case, it may be useful to
/// ```rust,ignore
/// use x25519_dalek::StaticSecret as SecretKey;
/// ```
/// since the only difference between the two is that [`StaticSecret`] does not enforce at
/// compile-time that the key is only used once.
///
/// # Warning
///
/// If you're uncertain about whether you should use this, then you likely