func (k *Keyring) AddKey(key []byte) error {
	if len(key) != 16 {
		return fmt.Errorf("key size must be 16 bytes")
	}
	for _, installedKey := range k.keys {
		if bytes.Equal(installedKey, key) {
			return nil
		}
	}
	keys := append(k.keys, key)
	primaryKey := k.GetPrimaryKey()
	if primaryKey == nil {
		primaryKey = key
	}
	k.installKeys(keys, primaryKey)
	return nil
}
AddKey will install a new key on the ring. Adding a key to the ring will make
it available for use in decryption. If the key already exists on the ring,
this function will just return noop.
package memberlist
import (
	"bytes"
	"fmt"
	"sync"
)
type Keyring struct {
	keys [][]byte
	l sync.Mutex
}
func (k *Keyring) init() {
	k.keys = make([][]byte, 0)
}
func NewKeyring(keys [][]byte, primaryKey []byte) (*Keyring, error) {
	keyring := &Keyring{}
	keyring.init()
	if len(keys) > 0 || len(primaryKey) > 0 {
		if len(primaryKey) == 0 {
			return nil, fmt.Errorf("Empty primary key not allowed")
		}
		if err := keyring.AddKey(primaryKey); err != nil {
			return nil, err
		}
		for _, key := range keys {
			if err := keyring.AddKey(key); err != nil {
				return nil, err
			}
		}
	}
	return keyring, nil
}