Back to

package recipient

Latest Go to latest
Published: Jun 25, 2019 | License: AGPL-3.0 | Module:


Package recipient implements the recipient public key store.


type Store

type Store struct {
	// contains filtered or unexported fields

Store is the recipient store.

func New

func New(cfg *config.Config, t *thwack.Server) *Store

New constructs a new Store instance.

func (*Store) Clear

func (s *Store) Clear(r string) error

Clear removes the recipient and corresponding ecdh.PublicKey from the Store.

func (*Store) CloneRecipients

func (s *Store) CloneRecipients() map[string]*ecdh.PublicKey

CloneRecipients returns a copy of the internal recipient map.

func (*Store) Get

func (s *Store) Get(r string) *ecdh.PublicKey

Get returns the ecdh.PublicKey for the given recipient, or nil iff the recipient does not exist. Note that this treats Normalize() failures as if the recipient is invalid.

func (*Store) GetByKey

func (s *Store) GetByKey(k *ecdh.PublicKey) string

GetByKey returns the identifier for the provided public key if any.

func (*Store) LoadFromPEM

func (s *Store) LoadFromPEM(path string) error

LoadFromPEM adds a receipient from a PEM file on disk.

func (*Store) Normalize

func (s *Store) Normalize(r string) (string, string, string, error)

Normalize normalizes the provided recipient according to the rules specified at the Store construction time, along with performing some basic sanity checking, and returns the normalized address, local part and domain. The Store is not queried for recipient presence.

func (*Store) Set

func (s *Store) Set(r string, k *ecdh.PublicKey) error

Set sets the ecdh.PublicKey for the provided recipient. If an existing key is present, it will be silently overwritten.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
f or F : Jump to identifier