types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterMessageFormat

func RegisterMessageFormat(c serde.Format, f serde.FormatEngine)

RegisterMessageFormat register the engine for the provided format.

Types

type AddrKey

type AddrKey struct{}

AddrKey is the key for the address factory.

type Ciphertext

type Ciphertext struct {
	K    kyber.Point  // r
	C    kyber.Point  // C
	UBar kyber.Point  // ubar
	E    kyber.Scalar // e
	F    kyber.Scalar // f
	GBar kyber.Point  // GBar
}

Ciphertext provides the verifiable encryption function. A description can be found in https://arxiv.org/pdf/2205.08529.pdf. The equivalent of each parameter in the paper is written in front of it.

type Deal

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

Deal matches the attributes defined in kyber dkg.Deal.

- implements serde.Message

func NewDeal

func NewDeal(index uint32, sig []byte, e EncryptedDeal) Deal

NewDeal creates a new deal.

func (Deal) GetEncryptedDeal

func (d Deal) GetEncryptedDeal() EncryptedDeal

GetEncryptedDeal returns the encrypted deal.

func (Deal) GetIndex

func (d Deal) GetIndex() uint32

GetIndex returns the index.

func (Deal) GetSignature

func (d Deal) GetSignature() []byte

GetSignature returns the signature in bytes.

func (Deal) Serialize

func (d Deal) Serialize(ctx serde.Context) ([]byte, error)

Serialize implements serde.Message.

type DealerResponse

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

DealerResponse is a response of a single dealer.

func NewDealerResponse

func NewDealerResponse(index uint32, status bool, sessionID, sig []byte) DealerResponse

NewDealerResponse creates a new dealer response.

func (DealerResponse) GetIndex

func (dresp DealerResponse) GetIndex() uint32

GetIndex returns the index.

func (DealerResponse) GetSessionID

func (dresp DealerResponse) GetSessionID() []byte

GetSessionID returns the session ID in bytes.

func (DealerResponse) GetSignature

func (dresp DealerResponse) GetSignature() []byte

GetSignature returns the signature in bytes.

func (DealerResponse) GetStatus

func (dresp DealerResponse) GetStatus() bool

GetStatus returns the status.

type DecryptReply

type DecryptReply struct {
	V kyber.Point
	I int64
}

DecryptReply is the response of a decryption request.

- implements serde.Message

func NewDecryptReply

func NewDecryptReply(i int64, v kyber.Point) DecryptReply

NewDecryptReply returns a new decryption reply.

func (DecryptReply) GetI

func (resp DecryptReply) GetI() int64

GetI returns I.

func (DecryptReply) GetV

func (resp DecryptReply) GetV() kyber.Point

GetV returns V.

func (DecryptReply) Serialize

func (resp DecryptReply) Serialize(ctx serde.Context) ([]byte, error)

Serialize implements serde.Message.

type DecryptRequest

type DecryptRequest struct {
	K kyber.Point
	C kyber.Point
}

DecryptRequest is a message sent to request a decryption.

- implements serde.Message

func NewDecryptRequest

func NewDecryptRequest(k, c kyber.Point) DecryptRequest

NewDecryptRequest creates a new decryption request.

func (DecryptRequest) GetC

func (req DecryptRequest) GetC() kyber.Point

GetC returns C.

func (DecryptRequest) GetK

func (req DecryptRequest) GetK() kyber.Point

GetK returns K.

func (DecryptRequest) Serialize

func (req DecryptRequest) Serialize(ctx serde.Context) ([]byte, error)

Serialize implements serde.Message.

type EncryptedDeal

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

EncryptedDeal contains the different parameters and data of an encrypted deal.

func NewEncryptedDeal

func NewEncryptedDeal(dhkey, sig, nonce, cipher []byte) EncryptedDeal

NewEncryptedDeal creates a new encrypted deal message.

func (EncryptedDeal) GetCipher

func (d EncryptedDeal) GetCipher() []byte

GetCipher returns the cipher in bytes.

func (EncryptedDeal) GetDHKey

func (d EncryptedDeal) GetDHKey() []byte

GetDHKey returns the Diffie-Helmann key in bytes.

func (EncryptedDeal) GetNonce

func (d EncryptedDeal) GetNonce() []byte

GetNonce returns the nonce in bytes.

func (EncryptedDeal) GetSignature

func (d EncryptedDeal) GetSignature() []byte

GetSignature returns the signatures in bytes.

type MessageFactory

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

MessageFactory is a message factory for the different DKG messages.

- implements serde.Factory

func NewMessageFactory

func NewMessageFactory(f mino.AddressFactory) MessageFactory

NewMessageFactory returns a message factory for the DKG.

func (MessageFactory) Deserialize

func (f MessageFactory) Deserialize(ctx serde.Context, data []byte) (serde.Message, error)

Deserialize implements serde.Factory.

type ReencryptReply

type ReencryptReply struct {
	PubK kyber.Point
	Ui   *share.PubShare
	Ei   kyber.Scalar
	Fi   kyber.Scalar
}

ReencryptReply returns the share to re-encrypt from one node

func NewReencryptReply

func NewReencryptReply(pubk kyber.Point, ui *share.PubShare, ei, fi kyber.Scalar) ReencryptReply

NewReencryptReply creates a new decryption request.

func (ReencryptReply) GetI

func (reply ReencryptReply) GetI() int

GetI returns I.

func (ReencryptReply) GetV

func (reply ReencryptReply) GetV() kyber.Point

GetV returns V.

func (ReencryptReply) Serialize

func (reply ReencryptReply) Serialize(ctx serde.Context) ([]byte, error)

Serialize implements serde.Message.

type ReencryptRequest

type ReencryptRequest struct {
	K    kyber.Point
	PubK kyber.Point
}

ReencryptRequest share is sent to a node in order to reencrypt a secret using the original randomness K from the write request and the public key PubK from the reader

func NewReencryptRequest

func NewReencryptRequest(k, pubk kyber.Point) *ReencryptRequest

NewReencryptRequest creates a new reencryption request.

func (ReencryptRequest) Serialize

func (req ReencryptRequest) Serialize(ctx serde.Context) ([]byte, error)

Serialize implements serde.Message.

type Reshare

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

Reshare messages for resharing process - implements serde.Message

func NewReshare

func NewReshare(deal Deal, publicCoeff []kyber.Point) Reshare

NewReshare creates a new deal.

func (Reshare) GetDeal

func (d Reshare) GetDeal() Deal

GetDeal returns the deal.

func (Reshare) GetPublicCoeffs

func (d Reshare) GetPublicCoeffs() []kyber.Point

GetPublicCoeffs returns the public coeff.

func (Reshare) Serialize

func (d Reshare) Serialize(ctx serde.Context) ([]byte, error)

Serialize implements serde.Message.

type Response

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

Response matches the attributes defined in kyber pedersen.Response.

- implements serde.Message

func NewResponse

func NewResponse(index uint32, r DealerResponse) Response

NewResponse creates a new response.

func (Response) GetIndex

func (r Response) GetIndex() uint32

GetIndex returns the index.

func (Response) GetResponse

func (r Response) GetResponse() DealerResponse

GetResponse returns the dealer response.

func (Response) Serialize

func (r Response) Serialize(ctx serde.Context) ([]byte, error)

Serialize implements serde.Message.

type ShareAndProof

type ShareAndProof struct {
	V  kyber.Point
	I  int64
	Ui kyber.Point  // u_i
	Ei kyber.Scalar // e_i
	Fi kyber.Scalar // f_i
	Hi kyber.Point  // h_i
}

ShareAndProof is the ShareAndProof provided by the verifiable decryption function.

see: https://arxiv.org/pdf/2205.08529.pdf

The equivalent of each parameter in the paper is mentioned.

type Start

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

Start is the message the initiator of the DKG protocol should send to all the nodes.

- implements serde.Message

func NewStart

func NewStart(thres int, addrs []mino.Address, pubkeys []kyber.Point) Start

NewStart creates a new start message.

func (Start) GetAddresses

func (s Start) GetAddresses() []mino.Address

GetAddresses returns the list of addresses.

func (Start) GetPublicKeys

func (s Start) GetPublicKeys() []kyber.Point

GetPublicKeys returns the list of public keys.

func (Start) GetThreshold

func (s Start) GetThreshold() int

GetThreshold returns the threshold.

func (Start) Serialize

func (s Start) Serialize(ctx serde.Context) ([]byte, error)

Serialize implements serde.Message. It looks up the format and returns the serialized data for the start message.

type StartDone

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

StartDone should be sent by all the nodes to the initiator of the DKG when the DKG setup is done.

- implements serde.Message

func NewStartDone

func NewStartDone(pubkey kyber.Point) StartDone

NewStartDone creates a new start done message.

func (StartDone) GetPublicKey

func (s StartDone) GetPublicKey() kyber.Point

GetPublicKey returns the public key of the LTS.

func (StartDone) Serialize

func (s StartDone) Serialize(ctx serde.Context) ([]byte, error)

Serialize implements serde.Message.

type StartResharing

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

StartResharing is the message the initiator of the resharing protocol should send to all the old nodes.

- implements serde.Message

func NewStartResharing

func NewStartResharing(tNew int, tOld int, addrsNew []mino.Address, addrsOld []mino.Address,
	pubkeysNew []kyber.Point, pubkeysOld []kyber.Point) StartResharing

NewStartResharing creates a new start resharing message.

func (StartResharing) GetAddrsNew

func (r StartResharing) GetAddrsNew() []mino.Address

GetAddrsNew returns the list of new addresses.

func (StartResharing) GetAddrsOld

func (r StartResharing) GetAddrsOld() []mino.Address

GetAddrsOld returns the list of old addresses.

func (StartResharing) GetPubkeysNew

func (r StartResharing) GetPubkeysNew() []kyber.Point

GetPubkeysNew returns the list of new public keys.

func (StartResharing) GetPubkeysOld

func (r StartResharing) GetPubkeysOld() []kyber.Point

GetPubkeysOld returns the list of old public keys.

func (StartResharing) GetTNew

func (r StartResharing) GetTNew() int

GetTNew returns the new threshold.

func (StartResharing) GetTOld

func (r StartResharing) GetTOld() int

GetTOld returns the old threshold.

func (StartResharing) Serialize

func (r StartResharing) Serialize(ctx serde.Context) ([]byte, error)

Serialize implements serde.Message. It looks up the format and returns the serialized data for the resharingRequest message.

type VerifiableDecryptReply

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

VerifiableDecryptReply is a message sent to request a verifiable decryption.

- implements serde.Message

func NewVerifiableDecryptReply

func NewVerifiableDecryptReply(shareAndProof []ShareAndProof) VerifiableDecryptReply

NewVerifiableDecryptReply creates a new verifiable decryption reply.

func (VerifiableDecryptReply) GetShareAndProof

func (resp VerifiableDecryptReply) GetShareAndProof() []ShareAndProof

GetShareAndProof returns ShareAndProof.

func (VerifiableDecryptReply) Serialize

func (resp VerifiableDecryptReply) Serialize(ctx serde.Context) ([]byte, error)

Serialize implements serde.Message.

type VerifiableDecryptRequest

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

VerifiableDecryptRequest is a message sent to request a verifiable decryption.

- implements serde.Message

func NewVerifiableDecryptRequest

func NewVerifiableDecryptRequest(ciphertexts []Ciphertext) VerifiableDecryptRequest

NewVerifiableDecryptRequest creates a new verifiable decryption request.

func (VerifiableDecryptRequest) GetCiphertexts

func (req VerifiableDecryptRequest) GetCiphertexts() []Ciphertext

GetCiphertexts returns ciphertexts.

func (VerifiableDecryptRequest) Serialize

func (req VerifiableDecryptRequest) Serialize(ctx serde.Context) ([]byte, error)

Serialize implements serde.Message.

Jump to

Keyboard shortcuts

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