Documentation
¶
Index ¶
- Constants
- func AesDecrypt(encryptedData, key string) (string, error)
- func AesEncrypt(data, key string) (string, error)
- func ClearSessionLog(session string)
- func Contains(s []string, searchterm string) bool
- func ConvertPubKeyToBTCAddress(pubKeyCompressed, mainnetORtestnet3 string) (string, error)
- func DecodeAddress(address string) (string, error)
- func DisableLogs()
- func DiscoverPeer(id, pubkey, localIP, remoteIP, port, timeout string) (string, error)
- func EciesDecrypt(encryptedData, privateKeyHex string) (string, error)
- func EciesEncrypt(data, publicKeyHex string) (string, error)
- func FetchData(url, decKey, data string) (string, error)
- func FetchUTXODetails(txID string, vout uint32) (*wire.TxOut, bool, error)
- func GenerateKeyPair() (string, error)
- func GetDERSignature(r, s *big.Int) ([]byte, error)
- func GetDerivePathBytes(derivePath string) ([]uint32, error)
- func GetDerivedPubKey(hexPubKey, hexChainCode, path string, isEdDSA bool) (string, error)
- func GetHexEncodedPubKey(pubKey *tcrypto.ECPoint) (string, error)
- func GetNetwork() (string, error)
- func GetThreshold(value int) (int, error)
- func HashToInt(hash []byte, c elliptic.Curve) *big.Int
- func Hook(message string)
- func InitLog()
- func JoinKeygen(...) (string, error)
- func JoinKeysign(...) (string, error)
- func ListenForPeer(id, pubkey, port, timeout string) (string, error)
- func LocalPreParams(ppmFile string, timeoutMinutes int) (bool, error)
- func Logf(format string, v ...any)
- func Logln(v ...any)
- func MpcSendBTC(...) (string, error)
- func PostTx(rawTxHex string) (string, error)
- func PreParams(ppmFile string) (*ecdsaKeygen.LocalPreParams, error)
- func PublishData(port, timeout, enckey, data string) (string, error)
- func RecommendedFees(feeType string) (int, error)
- func RunRelay(port string) (string, error)
- func SecP256k1Recover(r, s, v, h string) (string, error)
- func SendBitcoin(wifKey, publicKey, senderAddress, receiverAddress string, ...) (string, error)
- func SessionLog(session string) string
- func SessionState(session string) string
- func SetEventListener(l GoLogListener)
- func SetHookListener(h HookListener)
- func SetNetwork(network string) (string, error)
- func Sha256(msg string) (string, error)
- func StopRelay() (string, error)
- func TotalUTXO(address string) (string, error)
- func UseAPI(network, base string) (string, error)
- func UseFeePolicy(feeType string) (string, error)
- type FeeResponse
- type GoLogListener
- type HookListener
- type KeygenRequest
- type KeygenResponse
- type KeysignRequest
- type KeysignResponse
- type LocalState
- type LocalStateAccessor
- type LocalStateAccessorImp
- type Message
- type MessageFromTss
- type Messenger
- type MessengerImp
- type Service
- type ServiceImpl
- type Session
- type Status
- type UTXO
Constants ¶
const MaxUint32 = ^uint32(0)
Variables ¶
This section is empty.
Functions ¶
func AesDecrypt ¶
func AesEncrypt ¶
func ClearSessionLog ¶
func ClearSessionLog(session string)
func Contains ¶
Contains checks if a given string slice contains a specific search term. It iterates through the slice and returns true if the search term is found, false otherwise.
func DecodeAddress ¶
func DisableLogs ¶
func DisableLogs()
func DiscoverPeer ¶
func EciesDecrypt ¶
func EciesEncrypt ¶
func GenerateKeyPair ¶
func GetDerivePathBytes ¶
func GetDerivedPubKey ¶
func GetHexEncodedPubKey ¶
GetHexEncodedPubKey returns the hexadecimal encoded string representation of an ECDSA/EDDSA public key. It takes a pointer to an ECPoint as input and returns the encoded string and an error. If the ECPoint is nil, it returns an empty string and an error indicating a nil ECPoint. If the ECPoint is not on the curve, it returns an empty string and an error indicating an invalid ECPoint.
func GetNetwork ¶
func GetThreshold ¶
GetThreshold calculates the threshold value based on the input value. It takes an integer value as input and returns the threshold value and an error. If the input value is negative, it returns an error with the message "invalid input".
func HashToInt ¶
HashToInt converts a byte slice hash to a big.Int value using the provided elliptic curve. If the length of the hash is greater than the orderBytes of the curve, it truncates the hash. It then performs a right shift on the resulting big.Int value to ensure it fits within the orderBits of the curve. The converted big.Int value is returned.
func JoinKeygen ¶
func JoinKeysign ¶
func ListenForPeer ¶
func MpcSendBTC ¶
func PreParams ¶
func PreParams(ppmFile string) (*ecdsaKeygen.LocalPreParams, error)
func PublishData ¶
func RecommendedFees ¶
func SecP256k1Recover ¶
func SendBitcoin ¶
func SessionLog ¶
func SessionState ¶
func SetEventListener ¶
func SetEventListener(l GoLogListener)
SetEventListener sets the listener for UTXO events
func SetHookListener ¶
func SetHookListener(h HookListener)
func SetNetwork ¶
func UseFeePolicy ¶
Types ¶
type FeeResponse ¶
type GoLogListener ¶
type GoLogListener interface {
OnGoLog(message string)
}
type HookListener ¶
type HookListener interface {
OnMessage(message string)
}
type KeygenRequest ¶
func (KeygenRequest) GetAllParties ¶
func (r KeygenRequest) GetAllParties() []string
type KeygenResponse ¶
type KeygenResponse struct {
PubKey string `json:"pub_key"`
}
type KeysignRequest ¶
type KeysignRequest struct {
PubKey string `json:"pub_key"`
MessageToSign string `json:"message_to_sign"` // base64 encoded
KeysignCommitteeKeys string `json:"keysign_committee_keys"`
LocalPartyKey string `json:"local_party_key"`
DerivePath string `json:"derive_path"`
}
func (KeysignRequest) GetKeysignCommitteeKeys ¶
func (r KeysignRequest) GetKeysignCommitteeKeys() []string
type KeysignResponse ¶
type LocalState ¶
type LocalState struct {
PubKey string `json:"pub_key"`
ECDSALocalData ecdsaKeygen.LocalPartySaveData `json:"ecdsa_local_data"`
KeygenCommitteeKeys []string `json:"keygen_committee_keys"`
LocalPartyKey string `json:"local_party_key"`
ChainCodeHex string `json:"chain_code_hex"`
}
type LocalStateAccessor ¶
type LocalStateAccessorImp ¶
type LocalStateAccessorImp struct {
// contains filtered or unexported fields
}
func (*LocalStateAccessorImp) GetLocalState ¶
func (l *LocalStateAccessorImp) GetLocalState(keyshare string) (string, error)
func (*LocalStateAccessorImp) SaveLocalState ¶
func (l *LocalStateAccessorImp) SaveLocalState(pubKey, localState string) error
type Message ¶
type Message struct {
SessionID string `json:"session_id,omitempty"`
From string `json:"from,omitempty"`
To []string `json:"to,omitempty"`
Body string `json:"body,omitempty"`
SeqNo string `json:"sequence_no,omitempty"`
Hash string `json:"hash,omitempty"`
}
Message structure
type MessageFromTss ¶
type MessengerImp ¶
func (*MessengerImp) Send ¶
func (m *MessengerImp) Send(from, to, body string) error
type Service ¶
type Service interface {
KeygenECDSA(req *KeygenRequest) (*KeygenResponse, error)
KeysignECDSA(req *KeysignRequest) (*KeysignResponse, error)
ApplyData(string) error
}
type ServiceImpl ¶
type ServiceImpl struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(msg Messenger, stateAccessor LocalStateAccessor, createPreParam bool, ppmFile string) (*ServiceImpl, error)
func (*ServiceImpl) ApplyData ¶
func (s *ServiceImpl) ApplyData(msg string) error
func (*ServiceImpl) KeygenECDSA ¶
func (s *ServiceImpl) KeygenECDSA(req *KeygenRequest) (*KeygenResponse, error)
func (*ServiceImpl) KeysignECDSA ¶
func (s *ServiceImpl) KeysignECDSA(req *KeysignRequest) (*KeysignResponse, error)
type Session ¶
type Session struct {
SessionID string `json:"sessionID"`
Participants []string `json:"participants"`
}
Session structure