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 ¶
- func CombineShards(shards []*ProtoShard) (data []byte, err error)
- type AssociatedData
- type ProtoShard
- func (*ProtoShard) Descriptor() ([]byte, []int)
- func (m *ProtoShard) GetAssociated() *AssociatedData
- func (m *ProtoShard) GetData() []byte
- func (m *ProtoShard) GetIndex() int32
- func (m *ProtoShard) GetKeyshare() []byte
- func (m *ProtoShard) GetPubkey() []byte
- func (m *ProtoShard) GetSignature() []byte
- func (*ProtoShard) ProtoMessage()
- func (m *ProtoShard) Reset()
- func (m *ProtoShard) String() string
- type Shard
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"` }
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"` 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 UnmarshalPEM ¶
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 ¶
MarshalPEM marshals the contained protobuf and then marshals a byte representation of a PEM armored shard.