drand

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2018 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package drand is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterBeaconServer

func RegisterBeaconServer(s *grpc.Server, srv BeaconServer)

func RegisterInfoHandler added in v0.3.7

func RegisterInfoHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterInfoHandler registers the http handlers for service Info to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterInfoHandlerClient added in v0.3.7

func RegisterInfoHandlerClient(ctx context.Context, mux *runtime.ServeMux, client InfoClient) error

RegisterInfoHandlerClient registers the http handlers for service Info to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "InfoClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "InfoClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "InfoClient" to call the correct interceptors.

func RegisterInfoHandlerFromEndpoint added in v0.3.7

func RegisterInfoHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterInfoHandlerFromEndpoint is same as RegisterInfoHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterInfoServer added in v0.3.7

func RegisterInfoServer(s *grpc.Server, srv InfoServer)

func RegisterRandomnessHandler added in v0.3.7

func RegisterRandomnessHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterRandomnessHandler registers the http handlers for service Randomness to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterRandomnessHandlerClient added in v0.3.7

func RegisterRandomnessHandlerClient(ctx context.Context, mux *runtime.ServeMux, client RandomnessClient) error

RegisterRandomnessHandlerClient registers the http handlers for service Randomness to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "RandomnessClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "RandomnessClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "RandomnessClient" to call the correct interceptors.

func RegisterRandomnessHandlerFromEndpoint added in v0.3.7

func RegisterRandomnessHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterRandomnessHandlerFromEndpoint is same as RegisterRandomnessHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterRandomnessServer

func RegisterRandomnessServer(s *grpc.Server, srv RandomnessServer)

Types

type BeaconClient

type BeaconClient interface {
	NewBeacon(ctx context.Context, in *BeaconRequest, opts ...grpc.CallOption) (*BeaconResponse, error)
}

BeaconClient is the client API for Beacon service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewBeaconClient

func NewBeaconClient(cc *grpc.ClientConn) BeaconClient

type BeaconRequest

type BeaconRequest struct {
	Round        uint64 `protobuf:"varint,1,opt,name=round,proto3" json:"round,omitempty"`
	PreviousRand []byte `protobuf:"bytes,2,opt,name=previous_rand,json=previousRand,proto3" json:"previous_rand,omitempty"`
	// To prove the issuer comes from a valid node
	// It is a group point prefixed by the index of the issuer
	PartialRand          []byte   `protobuf:"bytes,3,opt,name=partial_rand,json=partialRand,proto3" json:"partial_rand,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

BeaconRequest holds a link to a previous signature, a timestamp and the partial signature for this beacon. All participants send and collects many of theses partial beacon packets to recreate locally one beacon

func (*BeaconRequest) Descriptor

func (*BeaconRequest) Descriptor() ([]byte, []int)

func (*BeaconRequest) GetPartialRand

func (m *BeaconRequest) GetPartialRand() []byte

func (*BeaconRequest) GetPreviousRand

func (m *BeaconRequest) GetPreviousRand() []byte

func (*BeaconRequest) GetRound

func (m *BeaconRequest) GetRound() uint64

func (*BeaconRequest) ProtoMessage

func (*BeaconRequest) ProtoMessage()

func (*BeaconRequest) Reset

func (m *BeaconRequest) Reset()

func (*BeaconRequest) String

func (m *BeaconRequest) String() string

func (*BeaconRequest) XXX_DiscardUnknown added in v0.3.7

func (m *BeaconRequest) XXX_DiscardUnknown()

func (*BeaconRequest) XXX_Marshal added in v0.3.7

func (m *BeaconRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BeaconRequest) XXX_Merge added in v0.3.7

func (dst *BeaconRequest) XXX_Merge(src proto.Message)

func (*BeaconRequest) XXX_Size added in v0.3.7

func (m *BeaconRequest) XXX_Size() int

func (*BeaconRequest) XXX_Unmarshal added in v0.3.7

func (m *BeaconRequest) XXX_Unmarshal(b []byte) error

type BeaconResponse

type BeaconResponse struct {
	PartialRand          []byte   `protobuf:"bytes,1,opt,name=partial_rand,json=partialRand,proto3" json:"partial_rand,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*BeaconResponse) Descriptor

func (*BeaconResponse) Descriptor() ([]byte, []int)

func (*BeaconResponse) GetPartialRand

func (m *BeaconResponse) GetPartialRand() []byte

func (*BeaconResponse) ProtoMessage

func (*BeaconResponse) ProtoMessage()

func (*BeaconResponse) Reset

func (m *BeaconResponse) Reset()

func (*BeaconResponse) String

func (m *BeaconResponse) String() string

func (*BeaconResponse) XXX_DiscardUnknown added in v0.3.7

func (m *BeaconResponse) XXX_DiscardUnknown()

func (*BeaconResponse) XXX_Marshal added in v0.3.7

func (m *BeaconResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BeaconResponse) XXX_Merge added in v0.3.7

func (dst *BeaconResponse) XXX_Merge(src proto.Message)

func (*BeaconResponse) XXX_Size added in v0.3.7

func (m *BeaconResponse) XXX_Size() int

func (*BeaconResponse) XXX_Unmarshal added in v0.3.7

func (m *BeaconResponse) XXX_Unmarshal(b []byte) error

type BeaconServer

type BeaconServer interface {
	NewBeacon(context.Context, *BeaconRequest) (*BeaconResponse, error)
}

BeaconServer is the server API for Beacon service.

type DistKeyRequest added in v0.3.7

type DistKeyRequest struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

DistKeyRequest requests the distributed public key used during the randomness generation process

func (*DistKeyRequest) Descriptor added in v0.3.7

func (*DistKeyRequest) Descriptor() ([]byte, []int)

func (*DistKeyRequest) ProtoMessage added in v0.3.7

func (*DistKeyRequest) ProtoMessage()

func (*DistKeyRequest) Reset added in v0.3.7

func (m *DistKeyRequest) Reset()

func (*DistKeyRequest) String added in v0.3.7

func (m *DistKeyRequest) String() string

func (*DistKeyRequest) XXX_DiscardUnknown added in v0.3.7

func (m *DistKeyRequest) XXX_DiscardUnknown()

func (*DistKeyRequest) XXX_Marshal added in v0.3.7

func (m *DistKeyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DistKeyRequest) XXX_Merge added in v0.3.7

func (dst *DistKeyRequest) XXX_Merge(src proto.Message)

func (*DistKeyRequest) XXX_Size added in v0.3.7

func (m *DistKeyRequest) XXX_Size() int

func (*DistKeyRequest) XXX_Unmarshal added in v0.3.7

func (m *DistKeyRequest) XXX_Unmarshal(b []byte) error

type DistKeyResponse added in v0.3.7

type DistKeyResponse struct {
	Key                  *crypto.Point `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	XXX_NoUnkeyedLiteral struct{}      `json:"-"`
	XXX_unrecognized     []byte        `json:"-"`
	XXX_sizecache        int32         `json:"-"`
}

func (*DistKeyResponse) Descriptor added in v0.3.7

func (*DistKeyResponse) Descriptor() ([]byte, []int)

func (*DistKeyResponse) GetKey added in v0.3.7

func (m *DistKeyResponse) GetKey() *crypto.Point

func (*DistKeyResponse) ProtoMessage added in v0.3.7

func (*DistKeyResponse) ProtoMessage()

func (*DistKeyResponse) Reset added in v0.3.7

func (m *DistKeyResponse) Reset()

func (*DistKeyResponse) String added in v0.3.7

func (m *DistKeyResponse) String() string

func (*DistKeyResponse) XXX_DiscardUnknown added in v0.3.7

func (m *DistKeyResponse) XXX_DiscardUnknown()

func (*DistKeyResponse) XXX_Marshal added in v0.3.7

func (m *DistKeyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DistKeyResponse) XXX_Merge added in v0.3.7

func (dst *DistKeyResponse) XXX_Merge(src proto.Message)

func (*DistKeyResponse) XXX_Size added in v0.3.7

func (m *DistKeyResponse) XXX_Size() int

func (*DistKeyResponse) XXX_Unmarshal added in v0.3.7

func (m *DistKeyResponse) XXX_Unmarshal(b []byte) error

type ECIESObject

type ECIESObject struct {
	Ephemeral            *crypto.Point `protobuf:"bytes,1,opt,name=ephemeral,proto3" json:"ephemeral,omitempty"`
	Ciphertext           []byte        `protobuf:"bytes,2,opt,name=ciphertext,proto3" json:"ciphertext,omitempty"`
	Nonce                []byte        `protobuf:"bytes,3,opt,name=nonce,proto3" json:"nonce,omitempty"`
	XXX_NoUnkeyedLiteral struct{}      `json:"-"`
	XXX_unrecognized     []byte        `json:"-"`
	XXX_sizecache        int32         `json:"-"`
}

func (*ECIESObject) Descriptor

func (*ECIESObject) Descriptor() ([]byte, []int)

func (*ECIESObject) GetCiphertext

func (m *ECIESObject) GetCiphertext() []byte

func (*ECIESObject) GetEphemeral

func (m *ECIESObject) GetEphemeral() *crypto.Point

func (*ECIESObject) GetNonce

func (m *ECIESObject) GetNonce() []byte

func (*ECIESObject) ProtoMessage

func (*ECIESObject) ProtoMessage()

func (*ECIESObject) Reset

func (m *ECIESObject) Reset()

func (*ECIESObject) String

func (m *ECIESObject) String() string

func (*ECIESObject) XXX_DiscardUnknown added in v0.3.7

func (m *ECIESObject) XXX_DiscardUnknown()

func (*ECIESObject) XXX_Marshal added in v0.3.7

func (m *ECIESObject) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ECIESObject) XXX_Merge added in v0.3.7

func (dst *ECIESObject) XXX_Merge(src proto.Message)

func (*ECIESObject) XXX_Size added in v0.3.7

func (m *ECIESObject) XXX_Size() int

func (*ECIESObject) XXX_Unmarshal added in v0.3.7

func (m *ECIESObject) XXX_Unmarshal(b []byte) error

type HomeRequest added in v0.4.1

type HomeRequest struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*HomeRequest) Descriptor added in v0.4.1

func (*HomeRequest) Descriptor() ([]byte, []int)

func (*HomeRequest) ProtoMessage added in v0.4.1

func (*HomeRequest) ProtoMessage()

func (*HomeRequest) Reset added in v0.4.1

func (m *HomeRequest) Reset()

func (*HomeRequest) String added in v0.4.1

func (m *HomeRequest) String() string

func (*HomeRequest) XXX_DiscardUnknown added in v0.4.1

func (m *HomeRequest) XXX_DiscardUnknown()

func (*HomeRequest) XXX_Marshal added in v0.4.1

func (m *HomeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*HomeRequest) XXX_Merge added in v0.4.1

func (dst *HomeRequest) XXX_Merge(src proto.Message)

func (*HomeRequest) XXX_Size added in v0.4.1

func (m *HomeRequest) XXX_Size() int

func (*HomeRequest) XXX_Unmarshal added in v0.4.1

func (m *HomeRequest) XXX_Unmarshal(b []byte) error

type HomeResponse added in v0.4.1

type HomeResponse struct {
	Status               string   `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*HomeResponse) Descriptor added in v0.4.1

func (*HomeResponse) Descriptor() ([]byte, []int)

func (*HomeResponse) GetStatus added in v0.4.1

func (m *HomeResponse) GetStatus() string

func (*HomeResponse) ProtoMessage added in v0.4.1

func (*HomeResponse) ProtoMessage()

func (*HomeResponse) Reset added in v0.4.1

func (m *HomeResponse) Reset()

func (*HomeResponse) String added in v0.4.1

func (m *HomeResponse) String() string

func (*HomeResponse) XXX_DiscardUnknown added in v0.4.1

func (m *HomeResponse) XXX_DiscardUnknown()

func (*HomeResponse) XXX_Marshal added in v0.4.1

func (m *HomeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*HomeResponse) XXX_Merge added in v0.4.1

func (dst *HomeResponse) XXX_Merge(src proto.Message)

func (*HomeResponse) XXX_Size added in v0.4.1

func (m *HomeResponse) XXX_Size() int

func (*HomeResponse) XXX_Unmarshal added in v0.4.1

func (m *HomeResponse) XXX_Unmarshal(b []byte) error

type InfoClient added in v0.3.7

type InfoClient interface {
	DistKey(ctx context.Context, in *DistKeyRequest, opts ...grpc.CallOption) (*DistKeyResponse, error)
	Home(ctx context.Context, in *HomeRequest, opts ...grpc.CallOption) (*HomeResponse, error)
}

InfoClient is the client API for Info service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewInfoClient added in v0.3.7

func NewInfoClient(cc *grpc.ClientConn) InfoClient

type InfoServer added in v0.3.7

type InfoServer interface {
	DistKey(context.Context, *DistKeyRequest) (*DistKeyResponse, error)
	Home(context.Context, *HomeRequest) (*HomeResponse, error)
}

InfoServer is the server API for Info service.

type PrivateRandRequest

type PrivateRandRequest struct {
	// Request must contains a public key towards which to encrypt the private
	// randomness.
	Request              *ECIESObject `protobuf:"bytes,1,opt,name=request,proto3" json:"request,omitempty"`
	XXX_NoUnkeyedLiteral struct{}     `json:"-"`
	XXX_unrecognized     []byte       `json:"-"`
	XXX_sizecache        int32        `json:"-"`
}

PrivateRandRequest is the message to send when requesting a private random value.

func (*PrivateRandRequest) Descriptor

func (*PrivateRandRequest) Descriptor() ([]byte, []int)

func (*PrivateRandRequest) GetRequest

func (m *PrivateRandRequest) GetRequest() *ECIESObject

func (*PrivateRandRequest) ProtoMessage

func (*PrivateRandRequest) ProtoMessage()

func (*PrivateRandRequest) Reset

func (m *PrivateRandRequest) Reset()

func (*PrivateRandRequest) String

func (m *PrivateRandRequest) String() string

func (*PrivateRandRequest) XXX_DiscardUnknown added in v0.3.7

func (m *PrivateRandRequest) XXX_DiscardUnknown()

func (*PrivateRandRequest) XXX_Marshal added in v0.3.7

func (m *PrivateRandRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PrivateRandRequest) XXX_Merge added in v0.3.7

func (dst *PrivateRandRequest) XXX_Merge(src proto.Message)

func (*PrivateRandRequest) XXX_Size added in v0.3.7

func (m *PrivateRandRequest) XXX_Size() int

func (*PrivateRandRequest) XXX_Unmarshal added in v0.3.7

func (m *PrivateRandRequest) XXX_Unmarshal(b []byte) error

type PrivateRandResponse

type PrivateRandResponse struct {
	// Response contains the private randomness encrypted towards the client's
	// request key.
	Response             *ECIESObject `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"`
	XXX_NoUnkeyedLiteral struct{}     `json:"-"`
	XXX_unrecognized     []byte       `json:"-"`
	XXX_sizecache        int32        `json:"-"`
}

func (*PrivateRandResponse) Descriptor

func (*PrivateRandResponse) Descriptor() ([]byte, []int)

func (*PrivateRandResponse) GetResponse

func (m *PrivateRandResponse) GetResponse() *ECIESObject

func (*PrivateRandResponse) ProtoMessage

func (*PrivateRandResponse) ProtoMessage()

func (*PrivateRandResponse) Reset

func (m *PrivateRandResponse) Reset()

func (*PrivateRandResponse) String

func (m *PrivateRandResponse) String() string

func (*PrivateRandResponse) XXX_DiscardUnknown added in v0.3.7

func (m *PrivateRandResponse) XXX_DiscardUnknown()

func (*PrivateRandResponse) XXX_Marshal added in v0.3.7

func (m *PrivateRandResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PrivateRandResponse) XXX_Merge added in v0.3.7

func (dst *PrivateRandResponse) XXX_Merge(src proto.Message)

func (*PrivateRandResponse) XXX_Size added in v0.3.7

func (m *PrivateRandResponse) XXX_Size() int

func (*PrivateRandResponse) XXX_Unmarshal added in v0.3.7

func (m *PrivateRandResponse) XXX_Unmarshal(b []byte) error

type PublicRandRequest

type PublicRandRequest struct {
	// round uniquely identifies a beacon. If round == 0, then the response will
	// contain the last.
	// XXX better ways to do that...
	Round                uint64   `protobuf:"varint,1,opt,name=round,proto3" json:"round,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

PublicRandRequest requests a public random value that has been generated in a unbiasable way and verifiable.

func (*PublicRandRequest) Descriptor

func (*PublicRandRequest) Descriptor() ([]byte, []int)

func (*PublicRandRequest) GetRound

func (m *PublicRandRequest) GetRound() uint64

func (*PublicRandRequest) ProtoMessage

func (*PublicRandRequest) ProtoMessage()

func (*PublicRandRequest) Reset

func (m *PublicRandRequest) Reset()

func (*PublicRandRequest) String

func (m *PublicRandRequest) String() string

func (*PublicRandRequest) XXX_DiscardUnknown added in v0.3.7

func (m *PublicRandRequest) XXX_DiscardUnknown()

func (*PublicRandRequest) XXX_Marshal added in v0.3.7

func (m *PublicRandRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PublicRandRequest) XXX_Merge added in v0.3.7

func (dst *PublicRandRequest) XXX_Merge(src proto.Message)

func (*PublicRandRequest) XXX_Size added in v0.3.7

func (m *PublicRandRequest) XXX_Size() int

func (*PublicRandRequest) XXX_Unmarshal added in v0.3.7

func (m *PublicRandRequest) XXX_Unmarshal(b []byte) error

type PublicRandResponse

type PublicRandResponse struct {
	Round                uint64        `protobuf:"varint,1,opt,name=round,proto3" json:"round,omitempty"`
	Previous             []byte        `protobuf:"bytes,2,opt,name=previous,proto3" json:"previous,omitempty"`
	Randomness           *crypto.Point `protobuf:"bytes,3,opt,name=randomness,proto3" json:"randomness,omitempty"`
	XXX_NoUnkeyedLiteral struct{}      `json:"-"`
	XXX_unrecognized     []byte        `json:"-"`
	XXX_sizecache        int32         `json:"-"`
}

PublicRandResponse holds a signature which is the random value. It can be verified thanks to the distributed public key of the nodes that have ran the DKG protocol and is unbiasable. The randomness can be verified using the BLS verification routine with the message "round || previous_rand".

func (*PublicRandResponse) Descriptor

func (*PublicRandResponse) Descriptor() ([]byte, []int)

func (*PublicRandResponse) GetPrevious added in v0.3.7

func (m *PublicRandResponse) GetPrevious() []byte

func (*PublicRandResponse) GetRandomness

func (m *PublicRandResponse) GetRandomness() *crypto.Point

func (*PublicRandResponse) GetRound

func (m *PublicRandResponse) GetRound() uint64

func (*PublicRandResponse) ProtoMessage

func (*PublicRandResponse) ProtoMessage()

func (*PublicRandResponse) Reset

func (m *PublicRandResponse) Reset()

func (*PublicRandResponse) String

func (m *PublicRandResponse) String() string

func (*PublicRandResponse) XXX_DiscardUnknown added in v0.3.7

func (m *PublicRandResponse) XXX_DiscardUnknown()

func (*PublicRandResponse) XXX_Marshal added in v0.3.7

func (m *PublicRandResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PublicRandResponse) XXX_Merge added in v0.3.7

func (dst *PublicRandResponse) XXX_Merge(src proto.Message)

func (*PublicRandResponse) XXX_Size added in v0.3.7

func (m *PublicRandResponse) XXX_Size() int

func (*PublicRandResponse) XXX_Unmarshal added in v0.3.7

func (m *PublicRandResponse) XXX_Unmarshal(b []byte) error

type RandomnessClient

type RandomnessClient interface {
	Public(ctx context.Context, in *PublicRandRequest, opts ...grpc.CallOption) (*PublicRandResponse, error)
	Private(ctx context.Context, in *PrivateRandRequest, opts ...grpc.CallOption) (*PrivateRandResponse, error)
}

RandomnessClient is the client API for Randomness service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewRandomnessClient

func NewRandomnessClient(cc *grpc.ClientConn) RandomnessClient

type RandomnessServer

type RandomnessServer interface {
	Public(context.Context, *PublicRandRequest) (*PublicRandResponse, error)
	Private(context.Context, *PrivateRandRequest) (*PrivateRandResponse, error)
}

RandomnessServer is the server API for Randomness service.

Jump to

Keyboard shortcuts

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