sharding

package
v0.1.2-0...-8dfc45d Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package sharding is a generated protocol buffer package.

It is generated from these files:

sharding/protobuf.proto

It has these top-level messages:

AssociatedData
ProtoShard

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CombineShards

func CombineShards(shards []*ProtoShard) (data []byte, err error)

CombineShards attempts to reconstruct the encoded and encrypted data from a slice of ProtoShards. The first shard in the slice is assumed to be 'ours' and some of its values are used to verify the rest of the shards.

Types

type AssociatedData

type AssociatedData struct {
	Uuid      []byte `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"`
	Threshold int32  `protobuf:"varint,2,opt,name=threshold" json:"threshold,omitempty"`
	Shares    int32  `protobuf:"varint,3,opt,name=shares" json:"shares,omitempty"`
}

func (*AssociatedData) Descriptor

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

func (*AssociatedData) GetShares

func (m *AssociatedData) GetShares() int32

func (*AssociatedData) GetThreshold

func (m *AssociatedData) GetThreshold() int32

func (*AssociatedData) GetUuid

func (m *AssociatedData) GetUuid() []byte

func (*AssociatedData) ProtoMessage

func (*AssociatedData) ProtoMessage()

func (*AssociatedData) Reset

func (m *AssociatedData) Reset()

func (*AssociatedData) String

func (m *AssociatedData) String() string

type ProtoShard

type ProtoShard struct {
	Associated *AssociatedData `protobuf:"bytes,1,opt,name=associated" json:"associated,omitempty"`
	Index      int32           `protobuf:"varint,2,opt,name=index" json:"index,omitempty"`
	Keyshare   []byte          `protobuf:"bytes,3,opt,name=keyshare,proto3" json:"keyshare,omitempty"`
	Pubkey     []byte          `protobuf:"bytes,4,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
	Signature  []byte          `protobuf:"bytes,5,opt,name=signature,proto3" json:"signature,omitempty"`
	Data       []byte          `protobuf:"bytes,6,opt,name=data,proto3" json:"data,omitempty"`
}

func ExtractProtoShards

func ExtractProtoShards(shards []*Shard) (ps []*ProtoShard)

ExtractProtoShards simply extracts ProtoShard structs to a new slice.

func (*ProtoShard) Descriptor

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

func (*ProtoShard) GetAssociated

func (m *ProtoShard) GetAssociated() *AssociatedData

func (*ProtoShard) GetData

func (m *ProtoShard) GetData() []byte

func (*ProtoShard) GetIndex

func (m *ProtoShard) GetIndex() int32

func (*ProtoShard) GetKeyshare

func (m *ProtoShard) GetKeyshare() []byte

func (*ProtoShard) GetPubkey

func (m *ProtoShard) GetPubkey() []byte

func (*ProtoShard) GetSignature

func (m *ProtoShard) GetSignature() []byte

func (*ProtoShard) ProtoMessage

func (*ProtoShard) ProtoMessage()

func (*ProtoShard) Reset

func (m *ProtoShard) Reset()

func (*ProtoShard) String

func (m *ProtoShard) String() string

type Shard

type Shard struct {
	Description string
	Threshold   int
	UUID        uuid.UUID
	Proto       *ProtoShard
}

Shard is a high-level struct for construction of PEM files. For binary files marshalling a ProtoShard is sufficient.

func CreateShards

func CreateShards(threshold, shares int, message []byte, description string) (shards []*Shard, err error)

CreateShards creates key/data shards TODO: write specification / description

func ReadAll

func ReadAll(input []byte) (shards []*Shard, err error)

ReadAll reads multiple PEM-armored shards from a given byteslice.

func UnmarshalPEM

func UnmarshalPEM(armor []byte) (shard *Shard, rest []byte, err error)

UnmarshalPEM attempts to parse a Shard from the given byteslice. It returns the Shard and any remaining input in rest. If no PEM block was found, shard will be nil.

func (*Shard) MarshalPEM

func (s *Shard) MarshalPEM() (armor []byte, err error)

MarshalPEM marshals the contained protobuf and then marshals a byte representation of a PEM armored shard.

Jump to

Keyboard shortcuts

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