func (privKey PrivKey) PubKey() crypto.PubKey {
	initialized := false
	for _, v := range privKey[32:] {
		if v != 0 {
			initialized = true
			break
		}
	}
	if !initialized {
		panic("Expected ed25519 PrivKey to include concatenated pubkey bytes")
	}
	pubkeyBytes := make([]byte, PubKeySize)
	copy(pubkeyBytes, privKey[32:])
	return PubKey(pubkeyBytes)
}
PubKey gets the corresponding public key from the private key.

Panics if the private key is not initialized.
package ed25519
import (
	"bytes"
	"crypto/subtle"
	"errors"
	"fmt"
	"io"
	"github.com/oasisprotocol/curve25519-voi/primitives/ed25519"
	"github.com/oasisprotocol/curve25519-voi/primitives/ed25519/extra/cache"
	"github.com/tendermint/tendermint/crypto"
	"github.com/tendermint/tendermint/crypto/tmhash"
	tmjson "github.com/tendermint/tendermint/libs/json"
)
var (
	_ crypto.PrivKey = PrivKey{}
	verifyOptions = &ed25519.Options{
		Verify: ed25519.VerifyOptionsZIP_215,
	}
	cachingVerifier = cache.NewVerifier(cache.NewLRUCache(cacheSize))
)
const (
	PrivKeyName = "tendermint/PrivKeyEd25519"
	PubKeyName  = "tendermint/PubKeyEd25519"
	PubKeySize = 32
	PrivateKeySize = 64
	SignatureSize = 64
	SeedSize = 32
	KeyType = "ed25519"
	cacheSize = 4096
)
func init() {
	tmjson.RegisterType(PubKey{}, PubKeyName)
	tmjson.RegisterType(PrivKey{}, PrivKeyName)
}
type PrivKey []byte
func (privKey PrivKey) Bytes() []byte {
	return []byte(privKey)
}
func (privKey PrivKey) Sign(msg []byte) ([]byte, error) {
	signatureBytes := ed25519.Sign(ed25519.PrivateKey(privKey), msg)
	return signatureBytes, nil
}