Documentation
¶
Overview ¶
Package cosi implements a round of a Collective Signing protocol.
Index ¶
- Constants
- Variables
- func NewProtocol(node *onet.TreeNodeInstance) (onet.ProtocolInstance, error)
- func VerifySignature(suite kyber.Group, publics []kyber.Point, msg, sig []byte) error
- type Announcement
- type AnnouncementHook
- type Challenge
- type ChallengeHook
- type CoSi
- func (c *CoSi) Dispatch() error
- func (c *CoSi) RegisterAnnouncementHook(fn AnnouncementHook)
- func (c *CoSi) RegisterChallengeHook(fn ChallengeHook)
- func (c *CoSi) RegisterCommitmentHook(fn CommitmentHook)
- func (c *CoSi) RegisterResponseHook(fn ResponseHook)
- func (c *CoSi) RegisterSignatureHook(fn SignatureHook)
- func (c *CoSi) SigningMessage(msg []byte)
- func (c *CoSi) Start() error
- func (c *CoSi) VerifyResponses(agg kyber.Point) error
- type Commitment
- type CommitmentHook
- type MessageProxy
- type ProtocolPacket
- type Response
- type ResponseHook
- type SignatureHook
Constants ¶
const ( // AnnouncementPhase is the ID of the Announcement message AnnouncementPhase uint32 = 1 // CommitmentPhase is the ID of the Commitment message CommitmentPhase = 2 // ChallengePhase is the ID of the Challenge message ChallengePhase = 3 // ResponsePhase is the ID of the Response message ResponsePhase = 4 )
Variables ¶
var Name = "CoSi"
Name can be used to reference the registered protocol.
var ProtocolPacketID = network.RegisterMessage(ProtocolPacket{})
ProtocolPacketID is the network.PacketTypeID of the CoSi ProtocolPacket
Functions ¶
func NewProtocol ¶
func NewProtocol(node *onet.TreeNodeInstance) (onet.ProtocolInstance, error)
NewProtocol returns a ProtocolCosi with the node set with the right channels. Use this function like this: ``` round := NewRound****()
fn := func(n *onet.Node) onet.ProtocolInstance {
pc := NewProtocolCosi(round,n)
return pc
}
onet.RegisterNewProtocolName("cothority",fn) ```
func VerifySignature ¶
VerifySignature verifies if the challenge and the secret (from the response phase) form a correct signature for this message using the aggregated public key. This is copied from cosi, so that you don't need to include both lib/cosi and protocols/cosi
Types ¶
type Announcement ¶
type Announcement struct {
}
Announcement is sent down the tree to start the collective signature.
type AnnouncementHook ¶
type AnnouncementHook func() error
AnnouncementHook allows for handling what should happen upon an announcement
type ChallengeHook ¶
ChallengeHook allows for handling what should happen when a challenge is received
type CoSi ¶
type CoSi struct {
// The node that represents us
*onet.TreeNodeInstance
// the message we want to sign typically given by the Root
Message []byte
// contains filtered or unexported fields
}
CoSi is the main structure holding the round and the onet.Node.
func (*CoSi) RegisterAnnouncementHook ¶
func (c *CoSi) RegisterAnnouncementHook(fn AnnouncementHook)
RegisterAnnouncementHook allows for handling what should happen upon an announcement
func (*CoSi) RegisterChallengeHook ¶
func (c *CoSi) RegisterChallengeHook(fn ChallengeHook)
RegisterChallengeHook allows for handling what should happen when a challenge is received
func (*CoSi) RegisterCommitmentHook ¶
func (c *CoSi) RegisterCommitmentHook(fn CommitmentHook)
RegisterCommitmentHook allows for handling what should happen when a commitment is received
func (*CoSi) RegisterResponseHook ¶
func (c *CoSi) RegisterResponseHook(fn ResponseHook)
RegisterResponseHook allows for handling what should happen when a response is received
func (*CoSi) RegisterSignatureHook ¶
func (c *CoSi) RegisterSignatureHook(fn SignatureHook)
RegisterSignatureHook allows for handling what should happen when the protocol is done
func (*CoSi) SigningMessage ¶
SigningMessage simply set the message to sign for this round
type Commitment ¶
Commitment of all nodes, aggregated over all children.
type CommitmentHook ¶
CommitmentHook allows for handling what should happen when all commitments are received
type MessageProxy ¶
type MessageProxy struct{}
MessageProxy implements the onet.MessageProxy interface for the CoSi protocol.
func (*MessageProxy) Name ¶
func (p *MessageProxy) Name() string
Name implements the onet.MessageProxy interface by returning the name under which cosi.MessageProxy is registered.
func (*MessageProxy) PacketType ¶
func (p *MessageProxy) PacketType() network.MessageTypeID
PacketType implements the onet.MessageProxy interface by returning the type of the ProtocolPacket.
func (*MessageProxy) Unwrap ¶
func (p *MessageProxy) Unwrap(msg interface{}) (interface{}, *onet.OverlayMsg, error)
Unwrap implements the onet.MessageProxy interface by unwraping and returning the specific message of one of the four steps.
func (*MessageProxy) Wrap ¶
func (p *MessageProxy) Wrap(msg interface{}, info *onet.OverlayMsg) (interface{}, error)
Wrap implements the onet.MessageProxy interface by wrapping up any of the four-step messages into a ProtooclPacket.
type ProtocolPacket ¶
type ProtocolPacket struct {
Phase uint32
OverlayMessage *onet.OverlayMsg
Ann *Announcement
Comm *Commitment
Chal *Challenge
Resp *Response
}
ProtocolPacket is the main message for the CoSi protocol which includes every information that the CoSi protocol might need.
type ResponseHook ¶
ResponseHook allows for handling what should happen when all responses are received and our response is calculated
type SignatureHook ¶
type SignatureHook func(sig []byte)
SignatureHook allows registering a handler when the signature is done