mixnet

package
v0.0.0-...-55ba49f Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2019 License: AGPL-3.0-or-later Imports: 30 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BackwardNonce

func BackwardNonce(round uint32) *[24]byte

func ForwardNonce

func ForwardNonce(round uint32) *[24]byte

Types

type Client

type Client struct {
	Key ed25519.PrivateKey
	// contains filtered or unexported fields
}

func (*Client) NewRound

func (c *Client) NewRound(ctx context.Context, servers []PublicServerConfig, settings *RoundSettings) ([][]byte, error)

NewRound starts a new mixing round on the given servers. NewRound fills in settings.OnionKeys and returns the servers' signatures of the round settings.

settings.Round must be set.

func (*Client) RunRoundBidirectional

func (c *Client) RunRoundBidirectional(ctx context.Context, server PublicServerConfig, service string, round uint32, onions [][]byte) ([][]byte, error)

func (*Client) RunRoundUnidirectional

func (c *Client) RunRoundUnidirectional(ctx context.Context, server PublicServerConfig, service string, round uint32, onions [][]byte) (string, error)

type MixService

type MixService interface {
	// True for mixnets that send onions in both directions (e.g., Convo),
	// and false for mixnets that send onions in one direction
	// (e.g., AddFriend and Dialing).
	Bidirectional() bool

	SizeIncomingMessage() int
	SizeReplyMessage() int

	ParseServiceData(data []byte) (interface{}, error)

	GenerateNoise(settings RoundSettings, myPos int) [][]byte

	// HandleMessages is called by the last server on the chain
	// with the decrypted message batch. If Bidirectional() is true,
	// the first return value of HandleMessages must be [][]byte,
	// otherwise it must be a string that is used as the Close RPC result.
	HandleMessages(settings RoundSettings, messages [][]byte) (interface{}, error)
}

type PublicServerConfig

type PublicServerConfig struct {
	Key     ed25519.PublicKey
	Address string
}

func (*PublicServerConfig) FromProto

func (c *PublicServerConfig) FromProto(pbc *pb.PublicServerConfig) error

func (PublicServerConfig) MarshalEasyJSON

func (v PublicServerConfig) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (PublicServerConfig) MarshalJSON

func (v PublicServerConfig) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (PublicServerConfig) Proto

func (*PublicServerConfig) UnmarshalEasyJSON

func (v *PublicServerConfig) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*PublicServerConfig) UnmarshalJSON

func (v *PublicServerConfig) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type RoundSettings

type RoundSettings struct {
	// Service is the name of the mixnet service.
	Service string

	// Round is the round that these settings correspond to.
	Round uint32

	// OnionKeys are the encryption keys in mixnet order.
	OnionKeys []*[32]byte

	// RawServiceData is the extra data required by the mixnet service.
	RawServiceData []byte

	// ServiceData is the result of parsing the RawServiceData;
	// it is not included in the signing message.
	ServiceData interface{} `json:"-"`
}

func (*RoundSettings) FromProto

func (s *RoundSettings) FromProto(pbs *pb.RoundSettings) error

func (RoundSettings) Proto

func (s RoundSettings) Proto() *pb.RoundSettings

func (RoundSettings) SigningMessage

func (s RoundSettings) SigningMessage() []byte

type Server

type Server struct {
	SigningKey     ed25519.PrivateKey
	CoordinatorKey ed25519.PublicKey

	Services map[string]MixService
	// contains filtered or unexported fields
}

func (*Server) AddOnions

func (srv *Server) AddOnions(stream pb.Mixnet_AddOnionsServer) error

func (*Server) CloseRound

func (srv *Server) CloseRound(ctx context.Context, req *pb.CloseRoundRequest) (*pb.CloseRoundResponse, error)

func (*Server) DeleteRound

func (srv *Server) DeleteRound(ctx context.Context, req *pb.DeleteRoundRequest) (*pb.Nothing, error)

func (*Server) GetOnions

func (srv *Server) GetOnions(req *pb.GetOnionsRequest, stream pb.Mixnet_GetOnionsServer) error

func (*Server) NewRound

func (srv *Server) NewRound(ctx context.Context, req *pb.NewRoundRequest) (*pb.NewRoundResponse, error)

func (*Server) SetRoundSettings

func (srv *Server) SetRoundSettings(ctx context.Context, req *pb.SetRoundSettingsRequest) (*pb.RoundSettingsSignature, error)

SetRoundSettings is an RPC used by the coordinator to set the parameters for a round. The RPC returns a signature of the round settings. Clients must verify this signature from each server before participating in the round. This prevents dishonest servers from tricking clients and other servers into using different keys or a different number of mailboxes in a round (which can lead to distinguishable noise).

Directories

Path Synopsis
Package convopb is a generated protocol buffer package.
Package convopb is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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