Documentation ¶
Index ¶
- Constants
- func GetOperatorID(operators []*wire.Operator, pkBytes []byte) (uint64, error)
- func RegisterRoutes(s *Server)
- type Instance
- type InstanceID
- type KeySign
- type Server
- type Switch
- func (s *Switch) CleanInstances() int
- func (s *Switch) CreateInstance(reqID [24]byte, init *wire.Init, initiatorPublicKey *rsa.PublicKey) (Instance, []byte, error)
- func (s *Switch) CreateInstanceReshare(reqID [24]byte, reshare *wire.Reshare, initiatorPublicKey *rsa.PublicKey) (Instance, []byte, error)
- func (s *Switch) CreateVerifyFunc(ops []*wire.Operator) (func(id uint64, msg []byte, sig []byte) error, error)
- func (s *Switch) Decrypt(ciphertext []byte) ([]byte, error)
- func (s *Switch) DecryptSecretDB(bin []byte) ([]byte, error)
- func (s *Switch) Encrypt(msg []byte) ([]byte, error)
- func (s *Switch) EncryptSecretDB(bin []byte) ([]byte, error)
- func (s *Switch) InitInstance(reqID [24]byte, initMsg *wire.Transport, initiatorSignature []byte) ([]byte, error)
- func (s *Switch) InitInstanceReshare(reqID [24]byte, reshareMsg *wire.Transport, initiatorSignature []byte) ([]byte, error)
- func (s *Switch) MarshallAndSign(msg wire.SSZMarshaller, msgType wire.TransportType, operatorID uint64, ...) ([]byte, error)
- func (s *Switch) Pong() ([]byte, error)
- func (s *Switch) ProcessMessage(dkgMsg []byte) ([]byte, error)
- func (s *Switch) SaveResultData(incMsg *wire.SignedTransport) error
- func (s *Switch) Sign(msg []byte) ([]byte, error)
- func (s *Switch) VerifyIncomingMessage(incMsg *wire.SignedTransport) (uint64, error)
- func (s *Switch) VerifySig(incMsg *wire.SignedTransport, initiatorPubKey *rsa.PublicKey) error
Constants ¶
const ErrTooManyRouteRequests = `{"error": "too many requests to /route"}`
TODO: either do all json or all SSZ
const MaxInstanceTime = 5 * time.Minute
const MaxInstances = 1024
Variables ¶
This section is empty.
Functions ¶
func GetOperatorID ¶ added in v1.1.0
func RegisterRoutes ¶
func RegisterRoutes(s *Server)
RegisterRoutes creates routes at operator to process messages incoming from initiator
Types ¶
type Instance ¶
type Instance interface { Process(uint64, *wire.SignedTransport) error ReadResponse() []byte ReadError() error VerifyInitiatorMessage(msg, sig []byte) error GetLocalOwner() *dkg.LocalOwner }
Instance interface to process messages at DKG instances incoming from initiator
type InstanceID ¶
type InstanceID [24]byte
InstanceID each new DKG ceremony has a unique random ID that we can identify messages and be able to process them in parallel
type KeySign ¶
type KeySign struct { ValidatorPK ssvspec_types.ValidatorPK SigningRoot []byte }
type Server ¶
type Server struct { Logger *zap.Logger // logger HttpServer *http.Server // http server Router chi.Router // http router State *Switch // structure to store instances of DKG ceremonies }
Server structure for operator to store http server and DKG ceremony instances
type Switch ¶
type Switch struct { Logger *zap.Logger Mtx sync.RWMutex InstanceInitTime map[InstanceID]time.Time // mapping to store DKG instance creation time Instances map[InstanceID]Instance // mapping to store DKG instances PrivateKey *rsa.PrivateKey // operator RSA private key Version []byte PubKeyBytes []byte OperatorID uint64 }
Switch structure to hold many instances created for separate DKG ceremonies
func (*Switch) CleanInstances ¶
CleanInstances removes all instances at Switch
func (*Switch) CreateInstance ¶
func (s *Switch) CreateInstance(reqID [24]byte, init *wire.Init, initiatorPublicKey *rsa.PublicKey) (Instance, []byte, error)
CreateInstance creates a LocalOwner instance with the DKG ceremony ID, that we can identify it later. Initiator public key identifies an initiator for new instance. There cant be two instances with the same ID, but one initiator can start several DKG ceremonies.
func (*Switch) CreateInstanceReshare ¶ added in v1.0.0
func (*Switch) CreateVerifyFunc ¶
func (s *Switch) CreateVerifyFunc(ops []*wire.Operator) (func(id uint64, msg []byte, sig []byte) error, error)
CreateVerifyFunc verifies signatures for operators participating at DKG ceremony
func (*Switch) DecryptSecretDB ¶ added in v1.0.0
DecryptSecretDB decrypts a secret share using operator's private key
func (*Switch) EncryptSecretDB ¶ added in v1.0.0
EncryptSecretDB encrypts secret share object bytes using RSA key to store at DB
func (*Switch) InitInstance ¶
func (s *Switch) InitInstance(reqID [24]byte, initMsg *wire.Transport, initiatorSignature []byte) ([]byte, error)
InitInstance creates a LocalOwner instance and DKG public key message (Exchange)
func (*Switch) InitInstanceReshare ¶ added in v1.0.0
func (*Switch) MarshallAndSign ¶ added in v1.1.0
func (s *Switch) MarshallAndSign(msg wire.SSZMarshaller, msgType wire.TransportType, operatorID uint64, id [24]byte) ([]byte, error)
func (*Switch) ProcessMessage ¶
ProcessMessage processes incoming message to /dkg route
func (*Switch) SaveResultData ¶ added in v1.1.0
func (s *Switch) SaveResultData(incMsg *wire.SignedTransport) error
func (*Switch) Sign ¶
Sign creates a RSA signature for the message at operator before sending it to initiator
func (*Switch) VerifyIncomingMessage ¶ added in v1.1.0
func (s *Switch) VerifyIncomingMessage(incMsg *wire.SignedTransport) (uint64, error)