From 0790223518b2f4c75f98244c59396f25c40100ab Mon Sep 17 00:00:00 2001 From: Dev Ojha Date: Sat, 13 Oct 2018 17:01:21 -0700 Subject: [PATCH] Comment about ed25519 private key format on Sign (#2632) Closes #2001 --- crypto/ed25519/ed25519.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crypto/ed25519/ed25519.go b/crypto/ed25519/ed25519.go index c2bed6ab1..61872d98d 100644 --- a/crypto/ed25519/ed25519.go +++ b/crypto/ed25519/ed25519.go @@ -46,6 +46,12 @@ func (privKey PrivKeyEd25519) Bytes() []byte { } // Sign produces a signature on the provided message. +// This assumes the privkey is wellformed in the golang format. +// The first 32 bytes should be random, +// corresponding to the normal ed25519 private key. +// The latter 32 bytes should be the compressed public key. +// If these conditions aren't met, Sign will panic or produce an +// incorrect signature. func (privKey PrivKeyEd25519) Sign(msg []byte) ([]byte, error) { signatureBytes := ed25519.Sign(privKey[:], msg) return signatureBytes[:], nil