recipient

package
v0.0.0-...-259a6ac Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2018 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package recipient implements the recipient public key store.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Store is the recipient store.

func New

func New(dCfg *config.Debug, 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) 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL