mpc

package
v1.20.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2025 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultThreshold is the default threshold for MPC
	DefaultThreshold = 3

	// DefaultParties is the default number of parties
	DefaultParties = 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MPCAccount

type MPCAccount struct {
	AccountID ids.ShortID
	Threshold int
	Parties   int
	PublicKey *PublicKey
	Shares    map[int]*Share
	Protocol  Protocol
	// contains filtered or unexported fields
}

MPCAccount represents a per-account MPC configuration

func (*MPCAccount) AddShare

func (a *MPCAccount) AddShare(index int, share *Share) error

AddShare adds a share to the account

func (*MPCAccount) GetShare

func (a *MPCAccount) GetShare(index int) (*Share, error)

GetShare retrieves a specific share

func (*MPCAccount) RefreshShares

func (a *MPCAccount) RefreshShares() error

RefreshShares performs proactive secret sharing to refresh shares

func (*MPCAccount) Sign

func (a *MPCAccount) Sign(message []byte, participatingShares map[int]*Share) ([]byte, error)

Sign creates a threshold signature

func (*MPCAccount) Verify

func (a *MPCAccount) Verify(message []byte, signature []byte) bool

Verify verifies a signature

type Manager

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

Manager manages per-account MPC configurations

func NewManager

func NewManager() *Manager

NewManager creates a new MPC manager

func (*Manager) CreateAccount

func (m *Manager) CreateAccount(accountID ids.ShortID, threshold, parties int, protocol Protocol) (*MPCAccount, error)

CreateAccount creates a new MPC account

func (*Manager) GetAccount

func (m *Manager) GetAccount(accountID ids.ShortID) (*MPCAccount, error)

GetAccount retrieves an MPC account

type Point

type Point struct {
	X, Y *big.Int
}

Point represents a point on the elliptic curve

type Protocol

type Protocol string

Protocol represents the MPC protocol type

const (
	ProtocolGG18 Protocol = "gg18"
	ProtocolGG20 Protocol = "gg20"
	ProtocolCMP  Protocol = "cmp"
)

type PublicKey

type PublicKey struct {
	Point *Point
}

PublicKey represents an MPC public key

type Share

type Share struct {
	Index int
	Value *big.Int
	Proof []byte
}

Share represents a secret share held by a party

Jump to

Keyboard shortcuts

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