func NewRandomPubKeyMaterial(signerID []byte, c2PubKey e4crypto.Curve25519PublicKey) (PubKeyMaterial, error) {
	_, privateKey, err := ed25519.GenerateKey(nil)
	if err != nil {
		return nil, err
	}
	return NewPubKeyMaterial(signerID, privateKey, c2PubKey)
}
NewRandomPubKeyMaterial creates a new PubKeyMaterial key from a random ed25519 key
package keys
import (
	"encoding/binary"
	"encoding/hex"
	"encoding/json"
	"fmt"
	"sync"
	"time"
	"golang.org/x/crypto/curve25519"
	"golang.org/x/crypto/ed25519"
	e4crypto "github.com/teserakt-io/e4go/crypto"
)
type PubKeyMaterial interface {
	KeyMaterial
	PubKeyStore
	PublicKey() ed25519.PublicKey
}
type pubKeyMaterial struct {
	PrivateKey ed25519.PrivateKey           `json:"privateKey,omitempty"`
	SignerID   []byte                       `json:"signerID,omitempty"`
	C2PubKey   e4crypto.Curve25519PublicKey `json:"c2PubKey,omitempty"`
	PubKeys    map[string]ed25519.PublicKey `json:"pubKeys,omitempty"`
	mutex     sync.RWMutex
	sharedKey []byte
}
var _ PubKeyMaterial = (*pubKeyMaterial)(nil)
var _ json.Marshaler = (*pubKeyMaterial)(nil)
func NewPubKeyMaterial(signerID []byte, privateKey ed25519.PrivateKey, c2PubKey e4crypto.Curve25519PublicKey) (PubKeyMaterial, error) {
	if err := e4crypto.ValidateID(signerID); err != nil {
		return nil, fmt.Errorf("invalid signerID: %v", err)
	}
	if err := e4crypto.ValidateEd25519PrivKey(privateKey); err != nil {
		return nil, fmt.Errorf("invalid private key: %v", err)
	}
	if err := e4crypto.ValidateCurve25519PubKey(c2PubKey); err != nil {
		return nil, fmt.Errorf("invalid c2 public key: %v", err)
	}
	k := &pubKeyMaterial{
		PubKeys: make(map[string]ed25519.PublicKey),
	}
	k.C2PubKey = make([]byte, len(c2PubKey))
	copy(k.C2PubKey, c2PubKey)
	k.PrivateKey = make([]byte, len(privateKey))
	copy(k.PrivateKey, privateKey)
	if err := k.updateSharedKey(); err != nil {
		return nil, err
	}
	k.SignerID = make([]byte, len(signerID))
	copy(k.SignerID, signerID)
	return k, nil
}