types

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: May 2, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

The Licensed Work is (c) 2022 Sygma SPDX-License-Identifier: LGPL-3.0-only

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalStartMessage

func MarshalStartMessage(params []byte) ([]byte, error)

func MarshalTssMessage

func MarshalTssMessage(tssMsg *TssMessage) ([]byte, error)

func MarshalTssResharingMessage

func MarshalTssResharingMessage(
	msgBytes []byte,
	isToOldCommittee bool,
	isBroadcast bool,
	isToOldAndNewCommittees bool,
	from *tss.PartyID,
	to []*tss.PartyID,
) ([]byte, error)

func SaveStructToJsonFile

func SaveStructToJsonFile(s interface{}, filename string) error

Types

type GenerateKeyMessage

type GenerateKeyMessage struct {
	WalletID  string `json:"wallet_id"`
	Signature []byte `json:"signature"`
}

func (*GenerateKeyMessage) InitiatorID

func (m *GenerateKeyMessage) InitiatorID() string

func (*GenerateKeyMessage) Raw

func (m *GenerateKeyMessage) Raw() ([]byte, error)

func (*GenerateKeyMessage) Sig

func (m *GenerateKeyMessage) Sig() []byte

type InitiatorMessage

type InitiatorMessage interface {
	// Raw returns the canonical byte‐slice that was signed.
	Raw() ([]byte, error)
	// Sig returns the signature over Raw().
	Sig() []byte
	// InitiatorID returns the ID whose public key we have to look up.
	InitiatorID() string
}

InitiatorMessage is anything that carries a payload to verify and its signature.

type KeyType

type KeyType string
const (
	KeyTypeSecp256k1 KeyType = "secp256k1"
	KeyTypeEd25519           = "ed25519"
)

type SignTxMessage

type SignTxMessage struct {
	KeyType             KeyType `json:"key_type"`
	WalletID            string  `json:"wallet_id"`
	NetworkInternalCode string  `json:"network_internal_code"`
	TxID                string  `json:"tx_id"`
	Tx                  []byte  `json:"tx"`
	Signature           []byte  `json:"signature"`
}

func (*SignTxMessage) InitiatorID

func (m *SignTxMessage) InitiatorID() string

func (*SignTxMessage) Raw

func (m *SignTxMessage) Raw() ([]byte, error)

func (*SignTxMessage) Sig

func (m *SignTxMessage) Sig() []byte

type StartMessage

type StartMessage struct {
	Params []byte `json:"params"`
}

func UnmarshalStartMessage

func UnmarshalStartMessage(msgBytes []byte) (*StartMessage, error)

type TssMessage

type TssMessage struct {
	WalletID    string         `json:"sessionID"`
	MsgBytes    []byte         `json:"msgBytes"`
	IsBroadcast bool           `json:"isBroadcast"`
	From        *tss.PartyID   `json:"from"`
	To          []*tss.PartyID `json:"to"`

	IsToOldCommittee        bool `json:"isToOldCommittee"`
	IsToOldAndNewCommittees bool `json:"isToOldAndNewCommittees"`

	Signature []byte `json:"signature"`
}

func NewTssMessage

func NewTssMessage(
	walletID string,
	msgBytes []byte,
	isBroadcast bool,
	from *tss.PartyID,
	to []*tss.PartyID,
) TssMessage

func UnmarshalTssMessage

func UnmarshalTssMessage(msgBytes []byte) (*TssMessage, error)

func (*TssMessage) MarshalForSigning

func (msg *TssMessage) MarshalForSigning() ([]byte, error)

MarshalForSigning returns the deterministic JSON bytes for signing

Jump to

Keyboard shortcuts

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