Standard library / crypto/ed25519

crypto/ed25519.PrivateKey

64-byte private key representation including seed and public suffix. Implements crypto.Signer. Keep private bytes secret. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
type PrivateKey []byte

Working Example

Example Snippetgo
package main
import (  "crypto/ed25519"  "crypto/rand"  "fmt")
func main() {  pub, k, err := ed25519.GenerateKey(rand.Reader)  check(err)  var v ed25519.PrivateKey = k  fmt.Println(v.Public().(ed25519.PublicKey).Equal(pub))}func must[T any](v T, e error) T {  if e != nil {    panic(e)  }  return v}func check(e error) {  if e != nil {    panic(e)  }}
Go Reference