MCPcopy
hub / github.com/hashicorp/memberlist / GetPrimaryKey

Method GetPrimaryKey

keyring.go:155–163  ·  view source on GitHub ↗

GetPrimaryKey returns the key on the ring at position 0. This is the key used for encrypting messages, and is the first key tried for decrypting messages.

()

Source from the content-addressed store, hash-verified

153// GetPrimaryKey returns the key on the ring at position 0. This is the key used
154// for encrypting messages, and is the first key tried for decrypting messages.
155func (k *Keyring) GetPrimaryKey() (key []byte) {
156 k.l.Lock()
157 defer k.l.Unlock()
158
159 if len(k.keys) > 0 {
160 key = k.keys[0]
161 }
162 return
163}

Callers 5

TestKeyring_AddRemoveUseFunction · 0.95
AddKeyMethod · 0.95
rawSendMsgPacketMethod · 0.80
encryptLocalStateMethod · 0.80

Calls

no outgoing calls

Tested by 2

TestKeyring_AddRemoveUseFunction · 0.76