func (p *PreKey) Sign(km km.KeyManager) error {
	idPubKey, err := km.IdentityPublicKey()
	if err != nil {
		return err
	}
	rawIdPubKey, err := hex.DecodeString(idPubKey)
	if err != nil {
		return err
	}
	if len(rawIdPubKey) != 32 {
		return InvalidIdentityKey
	}
	if p.PublicKey == [32]byte{} {
		return errors.New("got invalid pre key public key")
	}
	copy(p.IdentityPublicKey[:], rawIdPubKey[:32])
	hash, err := p.hash()
	if err != nil {
		return err
	}
	p.Signature, err = km.IdentitySign(hash)
	if err != nil {
		return err
	}
	return nil
}
sign prekey public key
package prekey
import (
	"bytes"
	"encoding/binary"
	"encoding/hex"
	"errors"
	"time"
	km "github.com/Bit-Nation/panthalassa/keyManager"
	pb "github.com/Bit-Nation/protobuffers"
	x3dh "github.com/Bit-Nation/x3dh"
	mh "github.com/multiformats/go-multihash"
	ed25519 "golang.org/x/crypto/ed25519"
)
var (
	InvalidIdentityKey = errors.New("invalid identity key - expected length to be 32 bytes")
)
type PreKey struct {
	x3dh.KeyPair
	IdentityPublicKey [32]byte
	Signature         []byte
	Time int64
}
func (p *PreKey) hash() (mh.Multihash, error) {
	if p.IdentityPublicKey == [32]byte{} {
		return nil, errors.New("got invalid identity key public key")
	}
	if p.PublicKey == [32]byte{} {
		return nil, errors.New("got invalid pre key public key")
	}
	b := bytes.NewBuffer(p.PublicKey[:])
	b.Write(p.IdentityPublicKey[:])
	timeStamp := make([]byte, 8)
	n := binary.PutVarint(timeStamp, p.Time)
	b.Write(timeStamp[:n])
	return mh.Sum(b.Bytes(), mh.SHA3_256, -1)
}