Skip to content

Commit

Permalink
Merge pull request hashicorp#41 from atomx/docfix
Browse files Browse the repository at this point in the history
Added Key documentation and godoc image
  • Loading branch information
armon committed Jun 25, 2015
2 parents b839ee7 + 2e74cb4 commit 4fe75bc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# memberlist
# memberlist [![GoDoc](https://godoc.org/github.com/hashicorp/memberlist?status.png)](https://godoc.org/github.com/hashicorp/memberlist)

memberlist is a [Go](http://www.golang.org) library that manages cluster
membership and member failure detection using a gossip based protocol.
Expand Down
2 changes: 2 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ type Config struct {
// the first key used while attempting to decrypt messages. Providing a
// value for this primary key will enable message-level encryption and
// verification, and automatically install the key onto the keyring.
// The value should be either 16, 24, or 32 bytes to select AES-128,
// AES-192, or AES-256.
SecretKey []byte

// The keyring holds all of the encryption keys used internally. It is
Expand Down
6 changes: 6 additions & 0 deletions keyring.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ func (k *Keyring) init() {
// keyring. If creating a keyring with multiple keys, one key must be designated
// primary by passing it as the primaryKey. If the primaryKey does not exist in
// the list of secondary keys, it will be automatically added at position 0.
//
// A key should be either 16, 24, or 32 bytes to select AES-128,
// AES-192, or AES-256.
func NewKeyring(keys [][]byte, primaryKey []byte) (*Keyring, error) {
keyring := &Keyring{}
keyring.init()
Expand All @@ -58,6 +61,9 @@ func NewKeyring(keys [][]byte, primaryKey []byte) (*Keyring, error) {
// 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.
//
// key should be either 16, 24, or 32 bytes to select AES-128,
// AES-192, or AES-256.
func (k *Keyring) AddKey(key []byte) error {
// Encorce 16-byte key size
if len(key) != 16 {
Expand Down

0 comments on commit 4fe75bc

Please sign in to comment.