Comment about ed25519 private key format on Sign (#2632)

Closes #2001
This commit is contained in:
Dev Ojha 2018-10-13 17:01:21 -07:00 committed by Ethan Buchman
parent 0baa7588c2
commit 0790223518
1 changed files with 6 additions and 0 deletions

View File

@ -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