Standard library / crypto/ed25519

crypto/ed25519.PrivateKey.Seed()

Returns a copy of secret 32-byte seed; protect it just like the private key. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func (priv PrivateKey) Seed() []byte

Return Value

[]byte

Result as described above; check any returned error before use.

Working Example

Example Snippetgo
package main
import (  "crypto/ed25519"  "crypto/rand"  "fmt")
func main() {  pub, k, err := ed25519.GenerateKey(rand.Reader)  check(err)  fmt.Println(len(k.Seed()) == 32 && len(pub) == 32)}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