keygen

package
v0.0.0-...-4f94b01 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: GPL-2.0, GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package keygen ED MPC implementation of generating pubkey

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckFull

func CheckFull(msg []smpc.Message) bool

CheckFull Check for empty messages

func NewLocalDNode

func NewLocalDNode(
	out chan<- smpc.Message,
	end chan<- LocalDNodeSaveData,
	DNodeCountInGroup int,
	threshold int,
	sigtype string,
) smpc.DNode

NewLocalDNode new a DNode data struct for current node

Types

type KGRound0Message

type KGRound0Message struct {
	*KGRoundMessage
}

KGRound0Message Round 0 sending message

func (*KGRound0Message) GetFromID

func (kg *KGRound0Message) GetFromID() string

GetFromID get the ID of sending nodes in the group

func (*KGRound0Message) GetFromIndex

func (kg *KGRound0Message) GetFromIndex() int

GetFromIndex get the Serial number of sending nodes in the group

func (*KGRound0Message) GetMsgType

func (kg *KGRound0Message) GetMsgType() string

GetMsgType get msg type

func (*KGRound0Message) GetToID

func (kg *KGRound0Message) GetToID() []string

GetToID get the ID of the node that broacasting message to

func (*KGRound0Message) IsBroadcast

func (kg *KGRound0Message) IsBroadcast() bool

IsBroadcast weather broacast the message

func (*KGRound0Message) OutMap

func (kg *KGRound0Message) OutMap() map[string]string

OutMap transfer *KGRound0Message to map

type KGRound1Message

type KGRound1Message struct {
	*KGRoundMessage

	CPk [32]byte
}

KGRound1Message Round 1 sending message

func (*KGRound1Message) GetFromID

func (kg *KGRound1Message) GetFromID() string

GetFromID get the ID of sending nodes in the group

func (*KGRound1Message) GetFromIndex

func (kg *KGRound1Message) GetFromIndex() int

GetFromIndex get the Serial number of sending nodes in the group

func (*KGRound1Message) GetMsgType

func (kg *KGRound1Message) GetMsgType() string

GetMsgType get msg type

func (*KGRound1Message) GetToID

func (kg *KGRound1Message) GetToID() []string

GetToID get the ID of the node that broacasting message to

func (*KGRound1Message) IsBroadcast

func (kg *KGRound1Message) IsBroadcast() bool

IsBroadcast weather broacast the message

func (*KGRound1Message) OutMap

func (kg *KGRound1Message) OutMap() map[string]string

OutMap transfer *KGRound1Message to map

type KGRound2Message

type KGRound2Message struct {
	*KGRoundMessage

	ZkPk [64]byte
}

KGRound2Message Round 2 sending message

func (*KGRound2Message) GetFromID

func (kg *KGRound2Message) GetFromID() string

GetFromID get the ID of sending nodes in the group

func (*KGRound2Message) GetFromIndex

func (kg *KGRound2Message) GetFromIndex() int

GetFromIndex get the Serial number of sending nodes in the group

func (*KGRound2Message) GetMsgType

func (kg *KGRound2Message) GetMsgType() string

GetMsgType get msg type

func (*KGRound2Message) GetToID

func (kg *KGRound2Message) GetToID() []string

GetToID get the ID of the node that broacasting message to

func (*KGRound2Message) IsBroadcast

func (kg *KGRound2Message) IsBroadcast() bool

IsBroadcast weather broacast the message

func (*KGRound2Message) OutMap

func (kg *KGRound2Message) OutMap() map[string]string

OutMap transfer *KGRound2Message to map

type KGRound3Message

type KGRound3Message struct {
	*KGRoundMessage

	DPk [64]byte
}

KGRound3Message Round 3 sending message

func (*KGRound3Message) GetFromID

func (kg *KGRound3Message) GetFromID() string

GetFromID get the ID of sending nodes in the group

func (*KGRound3Message) GetFromIndex

func (kg *KGRound3Message) GetFromIndex() int

GetFromIndex get the Serial number of sending nodes in the group

func (*KGRound3Message) GetMsgType

func (kg *KGRound3Message) GetMsgType() string

GetMsgType get msg type

func (*KGRound3Message) GetToID

func (kg *KGRound3Message) GetToID() []string

GetToID get the ID of the node that broacasting message to

func (*KGRound3Message) IsBroadcast

func (kg *KGRound3Message) IsBroadcast() bool

IsBroadcast weather broacast the message

func (*KGRound3Message) OutMap

func (kg *KGRound3Message) OutMap() map[string]string

OutMap transfer *KGRound3Message to map

type KGRound4Message

type KGRound4Message struct {
	*KGRoundMessage

	Share [32]byte
}

KGRound4Message Round 4 sending message

func (*KGRound4Message) GetFromID

func (kg *KGRound4Message) GetFromID() string

GetFromID get the ID of sending nodes in the group

func (*KGRound4Message) GetFromIndex

func (kg *KGRound4Message) GetFromIndex() int

GetFromIndex get the Serial number of sending nodes in the group

func (*KGRound4Message) GetMsgType

func (kg *KGRound4Message) GetMsgType() string

GetMsgType get msg type

func (*KGRound4Message) GetToID

func (kg *KGRound4Message) GetToID() []string

GetToID get the ID of the node that broacasting message to

func (*KGRound4Message) IsBroadcast

func (kg *KGRound4Message) IsBroadcast() bool

IsBroadcast weather broacast the message

func (*KGRound4Message) OutMap

func (kg *KGRound4Message) OutMap() map[string]string

OutMap transfer *KGRound4Message to map

type KGRound5Message

type KGRound5Message struct {
	*KGRoundMessage

	CfsBBytes [][32]byte
}

KGRound5Message Round 5 sending message

func (*KGRound5Message) GetFromID

func (kg *KGRound5Message) GetFromID() string

GetFromID get the ID of sending nodes in the group

func (*KGRound5Message) GetFromIndex

func (kg *KGRound5Message) GetFromIndex() int

GetFromIndex get the Serial number of sending nodes in the group

func (*KGRound5Message) GetMsgType

func (kg *KGRound5Message) GetMsgType() string

GetMsgType get msg type

func (*KGRound5Message) GetToID

func (kg *KGRound5Message) GetToID() []string

GetToID get the ID of the node that broacasting message to

func (*KGRound5Message) IsBroadcast

func (kg *KGRound5Message) IsBroadcast() bool

IsBroadcast weather broacast the message

func (*KGRound5Message) OutMap

func (kg *KGRound5Message) OutMap() map[string]string

OutMap transfer *KGRound5Message to map

type KGRoundMessage

type KGRoundMessage struct {
	FromID    string   `json:"FromID"` //DNodeID
	FromIndex int      `json:"FromIndex"`
	ToID      []string `json:"ToID"`
}

KGRoundMessage base type of sign round message

func (*KGRoundMessage) AppendToID

func (kg *KGRoundMessage) AppendToID(toid string)

AppendToID get the ID of nodes that the message will broacast to

func (*KGRoundMessage) SetFromID

func (kg *KGRoundMessage) SetFromID(id string)

SetFromID set sending nodes's ID

func (*KGRoundMessage) SetFromIndex

func (kg *KGRoundMessage) SetFromIndex(index int)

SetFromIndex set sending nodes's serial number in group

type LocalDNode

type LocalDNode struct {
	*smpc.BaseDNode
	// contains filtered or unexported fields
}

LocalDNode current local node

func (*LocalDNode) DNodeID

func (p *LocalDNode) DNodeID() string

DNodeID get the ID of current DNode

func (*LocalDNode) DulMessage

func (p *LocalDNode) DulMessage(msg smpc.Message) bool

DulMessage check whether the msg already exists in the list.

func (*LocalDNode) Finalize

func (p *LocalDNode) Finalize() bool

Finalize weather gg20 round

func (*LocalDNode) FinalizeRound

func (p *LocalDNode) FinalizeRound() smpc.Round

FinalizeRound get finalize round

func (*LocalDNode) FirstRound

func (p *LocalDNode) FirstRound() smpc.Round

FirstRound first round

func (*LocalDNode) SetDNodeID

func (p *LocalDNode) SetDNodeID(id string)

SetDNodeID set the ID of current DNode p.ID : enode --> DoubleHash --> index+1 --> Sprintf(index+1) --> []byte( Sprintf(index+1) ) --> EncodeToString *big.Int format: index+1 string format: EncodeToString

func (*LocalDNode) Start

func (p *LocalDNode) Start() error

Start generating pubkey start

func (*LocalDNode) StoreMessage

func (p *LocalDNode) StoreMessage(msg smpc.Message) (bool, error)

StoreMessage Collect data from other nodes

func (*LocalDNode) Update

func (p *LocalDNode) Update(msg smpc.Message) (ok bool, err error)

Update Collect data from other nodes and enter the next round

type LocalDNodeSaveData

type LocalDNodeSaveData struct {
	//
	Sk           [32]byte
	Pk           [32]byte
	TSk          [32]byte
	FinalPkBytes [32]byte

	IDs        smpc.SortableIDSSlice
	CurDNodeID *big.Int
}

LocalDNodeSaveData the ed data need to save in local db

func GetLocalDNodeSaveData

func GetLocalDNodeSaveData(data map[string]string) *LocalDNodeSaveData

GetLocalDNodeSaveData get LocalDNodeSaveData from map

func NewLocalDNodeSaveData

func NewLocalDNodeSaveData(DNodeCount int) (saveData LocalDNodeSaveData)

NewLocalDNodeSaveData new LocalDNodeSaveData

func (*LocalDNodeSaveData) OutMap

func (sd *LocalDNodeSaveData) OutMap() map[string]string

OutMap Convert LocalDNodeSaveData into map

Jump to

Keyboard shortcuts

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