grpc

package
v0.0.0-...-f135b4b Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package grpc implements the gRPC service.

The service is started with `RunServer()`

Index

Constants

This section is empty.

Variables

View Source
var Decrypt_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "Decrypt",
	HandlerType: (*DecryptServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "PublicMainKey",
			Handler:    _Decrypt_PublicMainKey_Handler,
		},
		{
			MethodName: "Start",
			Handler:    _Decrypt_Start_Handler,
		},
		{
			MethodName: "Stop",
			Handler:    _Decrypt_Stop_Handler,
		},
		{
			MethodName: "Clear",
			Handler:    _Decrypt_Clear_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "grpc/decrypt.proto",
}

Decrypt_ServiceDesc is the grpc.ServiceDesc for Decrypt service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_grpc_decrypt_proto protoreflect.FileDescriptor

Functions

func RegisterDecryptServer

func RegisterDecryptServer(s grpc.ServiceRegistrar, srv DecryptServer)

func RunServer

func RunServer(ctx context.Context, decrypt *decrypt.Decrypt, addr string) error

RunServer runs a grpc server on the given addr until ctx is done.

Types

type ClearRequest

type ClearRequest struct {
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*ClearRequest) Descriptor deprecated

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

Deprecated: Use ClearRequest.ProtoReflect.Descriptor instead.

func (*ClearRequest) GetId

func (x *ClearRequest) GetId() string

func (*ClearRequest) ProtoMessage

func (*ClearRequest) ProtoMessage()

func (*ClearRequest) ProtoReflect

func (x *ClearRequest) ProtoReflect() protoreflect.Message

func (*ClearRequest) Reset

func (x *ClearRequest) Reset()

func (*ClearRequest) String

func (x *ClearRequest) String() string

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client holds the connection to a decrypt server.

This is not needed vote vote-decrypt but is used by the vote-service.

func NewClient

func NewClient(addr string) (*Client, func() error, error)

NewClient creates a connection to a decrypt grpc server and wrapps then into a decrypt.crypto interface.

func (*Client) Clear

func (c *Client) Clear(ctx context.Context, pollID string) error

Clear calls the Clear grpc message.

func (*Client) PublicMainKey

func (c *Client) PublicMainKey(ctx context.Context) ([]byte, error)

PublicMainKey calls the grpc method.

func (*Client) Start

func (c *Client) Start(ctx context.Context, pollID string) (pubKey []byte, pubKeySig []byte, err error)

Start calls the Start grpc message.

func (*Client) Stop

func (c *Client) Stop(ctx context.Context, pollID string, voteList [][]byte) (decryptedContent, signature []byte, err error)

Stop calls the Stop grpc message.

type DecryptClient

type DecryptClient interface {
	PublicMainKey(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (*PublicMainKeyResponse, error)
	Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*StartResponse, error)
	Stop(ctx context.Context, in *StopRequest, opts ...grpc.CallOption) (*StopResponse, error)
	Clear(ctx context.Context, in *ClearRequest, opts ...grpc.CallOption) (*EmptyMessage, error)
}

DecryptClient is the client API for Decrypt service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewDecryptClient

func NewDecryptClient(cc grpc.ClientConnInterface) DecryptClient

type DecryptServer

DecryptServer is the server API for Decrypt service. All implementations should embed UnimplementedDecryptServer for forward compatibility

type EmptyMessage

type EmptyMessage struct {
	// contains filtered or unexported fields
}

func (*EmptyMessage) Descriptor deprecated

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

Deprecated: Use EmptyMessage.ProtoReflect.Descriptor instead.

func (*EmptyMessage) ProtoMessage

func (*EmptyMessage) ProtoMessage()

func (*EmptyMessage) ProtoReflect

func (x *EmptyMessage) ProtoReflect() protoreflect.Message

func (*EmptyMessage) Reset

func (x *EmptyMessage) Reset()

func (*EmptyMessage) String

func (x *EmptyMessage) String() string

type PublicMainKeyResponse

type PublicMainKeyResponse struct {
	PublicKey []byte `protobuf:"bytes,1,opt,name=publicKey,proto3" json:"publicKey,omitempty"`
	// contains filtered or unexported fields
}

func (*PublicMainKeyResponse) Descriptor deprecated

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

Deprecated: Use PublicMainKeyResponse.ProtoReflect.Descriptor instead.

func (*PublicMainKeyResponse) GetPublicKey

func (x *PublicMainKeyResponse) GetPublicKey() []byte

func (*PublicMainKeyResponse) ProtoMessage

func (*PublicMainKeyResponse) ProtoMessage()

func (*PublicMainKeyResponse) ProtoReflect

func (x *PublicMainKeyResponse) ProtoReflect() protoreflect.Message

func (*PublicMainKeyResponse) Reset

func (x *PublicMainKeyResponse) Reset()

func (*PublicMainKeyResponse) String

func (x *PublicMainKeyResponse) String() string

type StartRequest

type StartRequest struct {
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*StartRequest) Descriptor deprecated

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

Deprecated: Use StartRequest.ProtoReflect.Descriptor instead.

func (*StartRequest) GetId

func (x *StartRequest) GetId() string

func (*StartRequest) ProtoMessage

func (*StartRequest) ProtoMessage()

func (*StartRequest) ProtoReflect

func (x *StartRequest) ProtoReflect() protoreflect.Message

func (*StartRequest) Reset

func (x *StartRequest) Reset()

func (*StartRequest) String

func (x *StartRequest) String() string

type StartResponse

type StartResponse struct {
	PubKey []byte `protobuf:"bytes,1,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty"`
	PubSig []byte `protobuf:"bytes,2,opt,name=pub_sig,json=pubSig,proto3" json:"pub_sig,omitempty"`
	// contains filtered or unexported fields
}

func (*StartResponse) Descriptor deprecated

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

Deprecated: Use StartResponse.ProtoReflect.Descriptor instead.

func (*StartResponse) GetPubKey

func (x *StartResponse) GetPubKey() []byte

func (*StartResponse) GetPubSig

func (x *StartResponse) GetPubSig() []byte

func (*StartResponse) ProtoMessage

func (*StartResponse) ProtoMessage()

func (*StartResponse) ProtoReflect

func (x *StartResponse) ProtoReflect() protoreflect.Message

func (*StartResponse) Reset

func (x *StartResponse) Reset()

func (*StartResponse) String

func (x *StartResponse) String() string

type StopRequest

type StopRequest struct {
	Id    string   `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Votes [][]byte `protobuf:"bytes,2,rep,name=votes,proto3" json:"votes,omitempty"`
	// contains filtered or unexported fields
}

func (*StopRequest) Descriptor deprecated

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

Deprecated: Use StopRequest.ProtoReflect.Descriptor instead.

func (*StopRequest) GetId

func (x *StopRequest) GetId() string

func (*StopRequest) GetVotes

func (x *StopRequest) GetVotes() [][]byte

func (*StopRequest) ProtoMessage

func (*StopRequest) ProtoMessage()

func (*StopRequest) ProtoReflect

func (x *StopRequest) ProtoReflect() protoreflect.Message

func (*StopRequest) Reset

func (x *StopRequest) Reset()

func (*StopRequest) String

func (x *StopRequest) String() string

type StopResponse

type StopResponse struct {
	Votes     []byte `protobuf:"bytes,1,opt,name=votes,proto3" json:"votes,omitempty"`
	Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
	// contains filtered or unexported fields
}

func (*StopResponse) Descriptor deprecated

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

Deprecated: Use StopResponse.ProtoReflect.Descriptor instead.

func (*StopResponse) GetSignature

func (x *StopResponse) GetSignature() []byte

func (*StopResponse) GetVotes

func (x *StopResponse) GetVotes() []byte

func (*StopResponse) ProtoMessage

func (*StopResponse) ProtoMessage()

func (*StopResponse) ProtoReflect

func (x *StopResponse) ProtoReflect() protoreflect.Message

func (*StopResponse) Reset

func (x *StopResponse) Reset()

func (*StopResponse) String

func (x *StopResponse) String() string

type UnimplementedDecryptServer

type UnimplementedDecryptServer struct {
}

UnimplementedDecryptServer should be embedded to have forward compatible implementations.

func (UnimplementedDecryptServer) Clear

func (UnimplementedDecryptServer) PublicMainKey

func (UnimplementedDecryptServer) Start

func (UnimplementedDecryptServer) Stop

type UnsafeDecryptServer

type UnsafeDecryptServer interface {
	// contains filtered or unexported methods
}

UnsafeDecryptServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to DecryptServer will result in compilation errors.

Jump to

Keyboard shortcuts

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