ed25519: recommend using the seed to recover a key pair

This commit is contained in:
Frank Denis 2022-11-01 07:26:32 +01:00
parent 9e44710fc4
commit ddb9eac05c

View File

@ -269,6 +269,10 @@ pub const Ed25519 = struct {
} }
/// Create a KeyPair from a secret key. /// Create a KeyPair from a secret key.
/// Note that with EdDSA, storing the seed, and recovering the key pair
/// from it is recommended over storing the entire secret key.
/// The seed of an exiting key pair can be obtained with
/// `key_pair.secret_key.seed()`.
pub fn fromSecretKey(secret_key: SecretKey) (NonCanonicalError || EncodingError || IdentityElementError)!KeyPair { pub fn fromSecretKey(secret_key: SecretKey) (NonCanonicalError || EncodingError || IdentityElementError)!KeyPair {
// It is critical for EdDSA to use the correct public key. // It is critical for EdDSA to use the correct public key.
// In order to enforce this, a SecretKey implicitly includes a copy of the public key. // In order to enforce this, a SecretKey implicitly includes a copy of the public key.