func (s *Salt) ToProto() *pb.Salt {
	return &pb.Salt{
		Bytes:   s.bytes,
		ExpTime: uint64(s.expirationTime.Unix()),
	}
}
ToProto encodes the Salt into a proto buffer Salt message
package salt
import (
	"crypto/rand"
	"fmt"
	"sync"
	"time"
	pb "github.com/iotaledger/hive.go/autopeering/salt/proto"
	"google.golang.org/protobuf/proto"
)
const SaltByteSize = 20
type Salt struct {
	bytes          []byte     
	expirationTime time.Time  
	mutex          sync.RWMutex
}
func NewSalt(lifetime time.Duration) (salt *Salt, err error) {
	salt = &Salt{
		bytes:          make([]byte, SaltByteSize),
		expirationTime: time.Now().Add(lifetime),
	}
	if _, err = rand.Read(salt.bytes); err != nil {
		return nil, err
	}
	return salt, err
}
func (s *Salt) GetBytes() []byte {
	s.mutex.RLock()
	defer s.mutex.RUnlock()
	return append([]byte{}, s.bytes...)
}
func (s *Salt) GetExpiration() time.Time {
	s.mutex.RLock()
	defer s.mutex.RUnlock()
	return s.expirationTime
}
func (s *Salt) Expired() bool {
	return time.Now().After(s.GetExpiration())
}