api

package
v0.0.0-...-6d8402f Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: Apache-2.0, MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SidecarDKGPath = "/dkg"
View Source
var SidecarHealthPath = "/health"
View Source
var SidecarIdentityPath = "/identity"
View Source
var SidecarResharePath = "/reshare"
View Source
var SidecarSignPath = "/sign"
View Source
var SsvHealthPath = "/health"
View Source
var SsvIdentityPath = "/identity"

Functions

func BindSSVApi

func BindSSVApi(router *chi.Mux, node Ssv)

func BindSidecarAPI

func BindSidecarAPI(router *chi.Mux, node Sidecar)

Types

type Deal

type Deal struct {
	DealerIndex uint32
	Deals       []dkg.Deal
	Public      [][]byte
	SessionID   []byte
	Signature   []byte
}

func DealFromDomain

func DealFromDomain(bundle *dkg.DealBundle) (*Deal, error)

DealFromDomain takes the kyber DKG packet and turns it into something that can be marshalled into an HTTP request

func (Deal) ToDomain

func (d Deal) ToDomain(scheme crypto.ThresholdScheme) (dkg.DealBundle, error)

ToDomain takes the deal part of an HTTP request and maps it into a type usable by the kyber DKG

type Justification

type Justification struct {
	DealerIndex    uint32
	Justifications []JustificationShare
	SessionID      []byte
	Signature      []byte
}

func JustFromDomain

func JustFromDomain(bundle *dkg.JustificationBundle) (*Justification, error)

JustFromDomain takes the kyber DKG packet and turns it into something that can be marshalled into an HTTP request

func (Justification) ToDomain

ToDomain takes the deal part of an HTTP request and maps it into a type usable by the kyber DKG

type JustificationShare

type JustificationShare struct {
	ShareIndex uint32
	Share      []byte
}

type OperatorResponse

type OperatorResponse struct {
	Identity crypto.Identity
	Response SignResponse
}

type OperatorShare

type OperatorShare struct {
	Identity       crypto.Identity `json:"identity"`
	EncryptedShare []byte          `json:"encrypted_share"`
}

type PreviousDKGState

type PreviousDKGState struct {
	SessionID                   string            `json:"session_id"`
	Nodes                       []crypto.Identity `json:"nodes"`
	PublicPolynomialCommitments []byte            `json:"public_polynomial_commitments"`
}

type ReshareRequest

type ReshareRequest struct {
	ValidatorNonce             uint32            `json:"validator_nonce"`
	Operators                  []crypto.Identity `json:"operators"`
	PreviousState              PreviousDKGState  `json:"previous_state"`
	PreviousEncryptedShareHash []byte            `json:"previous_encrypted_share_hash"`
}

type ReshareResponse

type ReshareResponse struct {
	// the new key share encrypted with the validator's RSA key
	EncryptedShare []byte `json:"encrypted_share"`

	// the BLS12-381 public key for the group created during the DKG
	// it should be the same as the initial sharing, but always good to check
	PublicPolynomial []byte `json:"public_polynomial"`

	// the BLS12-381 public key for the specific validator node
	NodePK []byte `json:"node_pk"`
}

type Response

type Response struct {
	dkg.ResponseBundle
}

type Sidecar

type Sidecar interface {
	Health() error
	Sign(request SignRequest) (SignResponse, error)
	Reshare(request ReshareRequest) (ReshareResponse, error)
	Identity(request SidecarIdentityRequest) (SidecarIdentityResponse, error)
	BroadcastDKG(packet SidecarDKGPacket) error
}

func NewSidecarClient

func NewSidecarClient(url string) Sidecar

type SidecarClient

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

func (SidecarClient) BroadcastDKG

func (s SidecarClient) BroadcastDKG(packet SidecarDKGPacket) error

func (SidecarClient) Health

func (s SidecarClient) Health() error

func (SidecarClient) Identity

func (SidecarClient) Reshare

func (s SidecarClient) Reshare(request ReshareRequest) (ReshareResponse, error)

func (SidecarClient) Sign

func (s SidecarClient) Sign(request SignRequest) (SignResponse, error)

type SidecarDKGPacket

type SidecarDKGPacket struct {
	Deal          *Deal
	Response      *Response
	Justification *Justification
}

type SidecarIdentityRequest

type SidecarIdentityRequest struct {
	ValidatorNonce uint32 `json:"validator_nonce"`
}

type SidecarIdentityResponse

type SidecarIdentityResponse struct {
	PublicKey []byte `json:"data"`
	Address   string `json:"address"`
	Signature []byte `json:"signature"`
}

type SignRequest

type SignRequest struct {
	SessionID      []byte              `json:"session_id"`
	ValidatorNonce uint32              `json:"validator_nonce"`
	Data           UnsignedDepositData `json:"data"`
	Operators      []crypto.Identity   `json:"operators"`
}

type SignResponse

type SignResponse struct {
	// the key share encrypted with the validator's RSA key
	EncryptedShare []byte `json:"encrypted_share"`

	// the BLS12-381 public key for the group created during the DKG
	PublicPolynomial []byte `json:"public_polynomial"`

	// the BLS12-381 public key for the specific validator node
	NodePK []byte `json:"node_pk"`

	// a partial signature over the deposit data's SHA256 hash
	DepositDataPartialSignature []byte `json:"deposit_data_partial_signature"`

	// a partial signature over the validator's nonce's SHA256 hash
	DepositValidatorNonceSignature []byte `json:"deposit_validator_nonce_signature"`
}

type SignedDepositData

type SignedDepositData struct {
	UnsignedDepositData
	PubKey    []byte `json:"pubkey"`
	Signature []byte `json:"signature"`
}

type SigningOutput

type SigningOutput struct {
	SessionID             []byte            `json:"session_id"`
	GroupSignature        []byte            `json:"group_signature"`
	PolynomialCommitments []byte            `json:"group_public_commitments"`
	OperatorShares        []OperatorShare   `json:"operator_shares"`
	DepositData           SignedDepositData `json:"deposit_data"`
}

type Ssv

type Ssv interface {
	Health() error
	Identity() (SsvIdentityResponse, error)
}

type SsvClient

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

func NewSsvClient

func NewSsvClient(url string) SsvClient

func (SsvClient) Health

func (s SsvClient) Health() error

func (SsvClient) Identity

func (s SsvClient) Identity() (SsvIdentityResponse, error)

type SsvIdentityResponse

type SsvIdentityResponse struct {
	PublicKey []byte `json:"publicKey"`
}

type UnsignedDepositData

type UnsignedDepositData struct {
	WithdrawalCredentials []byte `json:"withdrawal_credentials"`
	DepositDataRoot       []byte `json:"deposit_data_root"`
	DepositMessageRoot    []byte `json:"deposit_message_root,omitempty"`
	Amount                uint64 `json:"amount,omitempty"`
	ForkVersion           string `json:"fork_version,omitempty"`
	NetworkName           string `json:"network_name,omitempty"`
	DepositCLIVersion     string `json:"deposit_cli_version,omitempty"`
}

func (UnsignedDepositData) ExtractRequired

func (u UnsignedDepositData) ExtractRequired() crypto.RequiredDepositFields

Jump to

Keyboard shortcuts

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