func (i ClientID) Bytes() []byte {
	if i.id == "" {
		return nil
	}
	return []byte(i.id)
}
Bytes returns bytes stored by ClientID
package common
import (
	"bytes"
	"crypto"
	"crypto/rand"
	"crypto/sha256"
	"crypto/x509"
	"encoding/hex"
	"errors"
	fspb "github.com/google/fleetspeak/fleetspeak/src/common/proto/fleetspeak"
)
type ClientID struct {
	id string
}
func BytesToClientID(b []byte) (ClientID, error) {
	if len(b) == 0 {
		return ClientID{}, nil
	}
	if len(b) != 8 {
		return ClientID{}, errors.New("ClientID must be 8 bytes")
	}
	return ClientID{id: string(b)}, nil
}
func StringToClientID(s string) (ClientID, error) {
	if s == "" || s == "nil" {
		return ClientID{}, nil
	}
	if len(s) != 16 {
		return ClientID{}, errors.New("ClientID must be 16 characters")
	}
	b, err := hex.DecodeString(s)
	if err != nil {
		return ClientID{}, err
	}
	return BytesToClientID(b)
}
func MakeClientID(pk crypto.PublicKey) (ClientID, error) {
	b, err := x509.MarshalPKIXPublicKey(pk)
	if err != nil {
		return ClientID{}, err
	}
	h := sha256.Sum256(b)
	return BytesToClientID(h[0:8])
}
func (i ClientID) IsNil() bool {
	return i.id == ""
}
func (i ClientID) String() string {
	if i.IsNil() {
		return "nil"
	}
	return hex.EncodeToString([]byte(i.id))
}