clientcore

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidMixes defines an error when either the mix map is nil or contains insufficient number of entries
	ErrInvalidMixes = errors.New("insufficient number of mixes provided")
)

Functions

This section is empty.

Types

type CryptoClient

type CryptoClient struct {
	Provider config.MixConfig
	Network  NetworkPKI
	// contains filtered or unexported fields
}

CryptoClient contains a public/private keypair and an elliptic curve for a given provider and network.

func NewCryptoClient

func NewCryptoClient(privKey *sphinx.PrivateKey,
	pubKey *sphinx.PublicKey,
	provider config.MixConfig,
	network NetworkPKI,
	log *logrus.Logger,
) *CryptoClient

NewCryptoClient constructor function TODO: Same issue as with the 'NewClient' function

func (*CryptoClient) DecodeMessage

func (c *CryptoClient) DecodeMessage(packet sphinx.SphinxPacket) (sphinx.SphinxPacket, error)

DecodeMessage decodes the received sphinx packet. TODO: this function is finished yet.

func (*CryptoClient) EncodeMessage

func (c *CryptoClient) EncodeMessage(message []byte, recipient config.ClientConfig) ([]byte, error)

EncodeMessage encodes given message into the Sphinx packet format. EncodeMessage takes as inputs the message and the recipient's public configuration. EncodeMessage returns the byte representation of the packet or an error if the packet could not be created.

func (*CryptoClient) GetPublicKey

func (c *CryptoClient) GetPublicKey() *sphinx.PublicKey

GetPublicKey returns the public key for this CryptoClient

type MixClient

type MixClient interface {
	EncodeIntoSphinxPacket(message string, recipient config.ClientConfig) ([]byte, error)
	DecodeSphinxPacket(packet sphinx.SphinxPacket) (sphinx.SphinxPacket, error)
	GetPublicKey() *sphinx.PublicKey
}

MixClient does sphinx packet encoding and decoding.

type NetworkPKI

type NetworkPKI struct {
	Mixes   topology.LayeredMixes
	Clients []config.ClientConfig
	// contains filtered or unexported fields
}

NetworkPKI holds PKI data about the current network topology. This allows public-key encryption to happen.

func (*NetworkPKI) ShouldUpdate

func (n *NetworkPKI) ShouldUpdate() bool

func (*NetworkPKI) UpdateNetwork

func (n *NetworkPKI) UpdateNetwork(newMixes topology.LayeredMixes, newClients []config.ClientConfig)

Jump to

Keyboard shortcuts

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