mpcsigner

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeURL

func NormalizeURL(url string) string

Types

type AbortDKGRequest

type AbortDKGRequest struct {
	DKGSessionID string `json:"dkg_session_id"`
	KeyID        string `json:"key_id"`
}

type ApprovalRequest

type ApprovalRequest struct {
	VaultID           string    `json:"vault_id"`
	SessionID         string    `json:"session_id"`
	KeyID             string    `json:"key_id"`
	Threshold         int       `json:"threshold"`
	Participants      []int     `json:"participants"`
	MessageHash       string    `json:"message_hash"`
	MessageType       string    `json:"message_type,omitempty"`
	Chain             string    `json:"chain,omitempty"`
	Network           string    `json:"network,omitempty"`
	TransactionDigest string    `json:"transaction_digest,omitempty"`
	ExpiresAt         time.Time `json:"expires_at"`
}

type ApprovalRequestRecord

type ApprovalRequestRecord struct {
	RequestID  string                `json:"request_id"`
	PartyID    uint32                `json:"party_id"`
	Status     ApprovalRequestStatus `json:"status"`
	Request    ApprovalRequest       `json:"request"`
	Approval   *mpc.Approval         `json:"approval,omitempty"`
	Reason     string                `json:"reason,omitempty"`
	CreatedAt  time.Time             `json:"created_at"`
	UpdatedAt  time.Time             `json:"updated_at"`
	ApprovedAt time.Time             `json:"approved_at,omitempty"`
	RejectedAt time.Time             `json:"rejected_at,omitempty"`
}

type ApprovalRequestStatus

type ApprovalRequestStatus string
const (
	ApprovalRequestPending  ApprovalRequestStatus = "pending"
	ApprovalRequestApproved ApprovalRequestStatus = "approved"
	ApprovalRequestRejected ApprovalRequestStatus = "rejected"
	ApprovalRequestExpired  ApprovalRequestStatus = "expired"
)

type CommitDKGRequest

type CommitDKGRequest struct {
	DKGSessionID string `json:"dkg_session_id"`
	KeyID        string `json:"key_id"`
}

type CreateApprovalRequestResponse

type CreateApprovalRequestResponse struct {
	Request ApprovalRequestRecord `json:"request"`
}

type DKGShareRequest

type DKGShareRequest struct {
	DKGSessionID string               `json:"dkg_session_id"`
	VaultID      string               `json:"vault_id"`
	KeyID        string               `json:"key_id"`
	Threshold    int                  `json:"threshold"`
	Members      []Member             `json:"members"`
	FromPartyID  uint32               `json:"from_party_id"`
	ToPartyID    uint32               `json:"to_party_id"`
	Share        string               `json:"share"`
	Commitment   mpc.PublicCommitment `json:"commitment"`
}

type FileStore

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

func NewFileStore

func NewFileStore(path, passphrase string) (*FileStore, error)

func (*FileStore) Load

func (s *FileStore) Load() (*signerSnapshot, bool, error)

func (*FileStore) Save

func (s *FileStore) Save(snapshot signerSnapshot) error

type FinalizeDKGRequest

type FinalizeDKGRequest struct {
	DKGSessionID string                 `json:"dkg_session_id"`
	VaultID      string                 `json:"vault_id"`
	KeyID        string                 `json:"key_id"`
	Threshold    int                    `json:"threshold"`
	Members      []Member               `json:"members"`
	Commitments  []mpc.PublicCommitment `json:"commitments"`
}

type FinalizeDKGResponse

type FinalizeDKGResponse struct {
	PartyID           uint32                `json:"party_id"`
	PublicKey         mpc.Point             `json:"public_key"`
	EncryptedFragment mpc.EncryptedFragment `json:"encrypted_fragment"`
}

type IdentityResponse

type IdentityResponse struct {
	Member mpc.SignerIdentity `json:"member"`
}

type ListApprovalRequestsResponse

type ListApprovalRequestsResponse struct {
	Requests []ApprovalRequestRecord `json:"requests"`
}

type Member

type Member struct {
	MemberID            string `json:"member_id"`
	PartyID             uint32 `json:"party_id"`
	URL                 string `json:"url"`
	EncryptionPublicKey string `json:"encryption_public_key"`
	ApprovalPublicKey   string `json:"approval_public_key"`
}

type NonceCommitRequest

type NonceCommitRequest struct {
	KeyID       string `json:"key_id"`
	SessionID   string `json:"session_id"`
	MessageHash string `json:"message_hash"`
}

type RejectApprovalRequest

type RejectApprovalRequest struct {
	Reason string `json:"reason,omitempty"`
}

type RuntimeInfo

type RuntimeInfo struct {
	GoVersion string `json:"go_version"`
	GOOS      string `json:"goos"`
	GOARCH    string `json:"goarch"`
}

type Service

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

func New

func New(memberID string, partyID uint32, name, url string, sharedKey []byte, logger *slog.Logger) (*Service, error)

func NewWithStore

func NewWithStore(memberID string, partyID uint32, name, url string, sharedKey []byte, store *FileStore, logger *slog.Logger) (*Service, error)

func (*Service) Handler

func (s *Service) Handler() http.Handler

func (*Service) Identity

func (s *Service) Identity() mpc.SignerIdentity

func (*Service) SetOperatorToken

func (s *Service) SetOperatorToken(token []byte)

type SignShareRequest

type SignShareRequest struct {
	KeyID        string                `json:"key_id"`
	SessionID    string                `json:"session_id"`
	MessageB64   string                `json:"message_base64"`
	Participants []int                 `json:"participants"`
	AggregateR   mpc.Point             `json:"aggregate_r"`
	Fragment     mpc.EncryptedFragment `json:"fragment"`
	Approval     mpc.Approval          `json:"approval"`
}

type StartDKGRequest

type StartDKGRequest struct {
	DKGSessionID string   `json:"dkg_session_id"`
	VaultID      string   `json:"vault_id"`
	KeyID        string   `json:"key_id"`
	Threshold    int      `json:"threshold"`
	Members      []Member `json:"members"`
}

type StartDKGResponse

type StartDKGResponse struct {
	PartyID    uint32               `json:"party_id"`
	Commitment mpc.PublicCommitment `json:"commitment"`
}

type StatusResponse

type StatusResponse struct {
	Status                 string                        `json:"status"`
	MemberID               string                        `json:"member_id"`
	PartyID                uint32                        `json:"party_id"`
	URL                    string                        `json:"url,omitempty"`
	DurableState           bool                          `json:"durable_state"`
	StoreStatus            string                        `json:"store_status"`
	Keys                   int                           `json:"keys"`
	PendingSigningSessions int                           `json:"pending_signing_sessions"`
	DKGStatuses            map[string]int                `json:"dkg_statuses"`
	ApprovalRequestCounts  map[ApprovalRequestStatus]int `json:"approval_request_counts"`
	StartedAt              time.Time                     `json:"started_at"`
	UptimeSeconds          int64                         `json:"uptime_seconds"`
	Runtime                RuntimeInfo                   `json:"runtime"`
}

Jump to

Keyboard shortcuts

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