Documentation ¶
Overview ¶
Package mpcrpc is a client of mpc server, doing the sign and accept tasks.
Index ¶
- Variables
- func AcceptReqAddr(raw string) (string, error)
- func AcceptSign(raw string) (string, error)
- func BuildMPCRawTx(nonce uint64, payload []byte) (string, error)
- func DoAcceptReqAddr(keyID, agreeResult string) (string, error)
- func DoAcceptSign(keyID, agreeResult string, msgHash, msgContext []string) (string, error)
- func DoDKG(enodeSigs []string) (keyID string, pubkey string, err error)
- func DoSign(signPubkey string, msgHash, msgContext []string) (keyID string, rsvs []string, err error)
- func DoSignOne(signPubkey, msgHash, msgContext string) (keyID string, rsvs []string, err error)
- func GetBigIntFromStr(str string) (*big.Int, error)
- func GetEnode(rpcAddr string) (string, error)
- func GetReqAddrNonce(mpcUser, rpcAddr string) (uint64, error)
- func GetSignNonce(mpcUser, rpcAddr string) (uint64, error)
- func GetSignStatusByKeyID(keyID string) (rsvs []string, err error)
- func GetUint64FromStr(str string) (uint64, error)
- func Init(mpcConfig *MPCConfig, isSign bool)
- func NowMilliStr() string
- func ParseUint64(s string) (uint64, bool)
- func ReqDcrmAddr(raw, rpcAddr string) (string, error)
- func Sign(raw, rpcAddr string) (string, error)
- func SignContent(content []byte) (signature []byte, err error)
- func SignWithKey(message []byte) ([]byte, error)
- type AcceptData
- type DataEnode
- type DataResult
- type DataResultResp
- type GetEnodeResp
- type GetGroupByIDResp
- type GroupInfo
- type MPCConfig
- type ReqAddrData
- type ReqAddrInfoData
- type ReqAddrInfoResp
- type ReqAddrInfoSortedSlice
- type ReqAddrStatus
- type SignData
- type SignInfoData
- type SignInfoResp
- type SignInfoSortedSlice
- type SignReply
- type SignStatus
Constants ¶
This section is empty.
Variables ¶
var ( ErrGetSignStatusTimeout = errors.New("getSignStatus timeout") ErrGetSignStatusFailed = errors.New("getSignStatus failure") ErrGetDKGStatusTimeout = errors.New("getDKGStatus timeout") ErrGetDKGStatusFailed = errors.New("getDKGStatus failure") )
get mpc sign status error
Functions ¶
func AcceptReqAddr ¶
AcceptReqAddr call acceptReqAddr
func BuildMPCRawTx ¶
BuildMPCRawTx build mpc raw tx
func DoAcceptReqAddr ¶
DoAcceptReqAddr accept request address
func DoAcceptSign ¶
DoAcceptSign accept sign
func DoSign ¶
func DoSign(signPubkey string, msgHash, msgContext []string) (keyID string, rsvs []string, err error)
DoSign mpc sign msgHash with context msgContext
func GetBigIntFromStr ¶
GetBigIntFromStr new big int from string.
func GetReqAddrNonce ¶
GetReqAddrNonce call getReqAddrNonce
func GetSignNonce ¶
GetSignNonce call getSignNonce
func GetSignStatusByKeyID ¶
GetSignStatusByKeyID get sign status by keyID
func GetUint64FromStr ¶
GetUint64FromStr get uint64 from string.
func NowMilliStr ¶
func NowMilliStr() string
NowMilliStr returns now timestamp in miliseconds of string format.
func ParseUint64 ¶
ParseUint64 parses s as an integer in decimal or hexadecimal syntax. Leading zeros are accepted. The empty string parses as zero.
func ReqDcrmAddr ¶
ReqDcrmAddr call reqDcrmAddr
func SignContent ¶
SignContent sign content
func SignWithKey ¶
SignWithKey sign by mpc node user with private key
Types ¶
type AcceptData ¶
type AcceptData struct { TxType string Key string Accept string MsgHash []string MsgContext []string TimeStamp string }
AcceptData accpet data
type DataResultResp ¶
type DataResultResp struct { Status string Tip string Error string Data *DataResult }
DataResultResp result response
type GetEnodeResp ¶
GetEnodeResp enode response
type GetGroupByIDResp ¶
GetGroupByIDResp group response
type MPCConfig ¶
type MPCConfig struct { APIPrefix string RPCAddress string RPCTimeout uint64 KeystoreFile string `json:"-"` PasswordFile string `json:"-"` NeedKeyStore bool `json:"-"` IsDKG bool `json:"-"` SignTimeout uint64 SignType string // eg. ECDSA SignGroup string Threshold string Mode *uint64 // 0:managed 1:private }
MPCConfig mpc related config
type ReqAddrData ¶
type ReqAddrData struct { TxType string GroupID string ThresHold string Mode string TimeStamp string Sigs string }
ReqAddrData request address data
type ReqAddrInfoData ¶
type ReqAddrInfoData struct { Account string Cointype string GroupID string Key string Mode string Nonce string ThresHold string TimeStamp string // contains filtered or unexported fields }
ReqAddrInfoData request address info data
func GetCurNodeReqAddrInfo ¶
func GetCurNodeReqAddrInfo(expiredInterval int64) ([]*ReqAddrInfoData, error)
GetCurNodeReqAddrInfo call getCurNodeReqAddrInfo
func GetDKGAcceptList ¶
func GetDKGAcceptList(user string, expiredInterval int64) ([]*ReqAddrInfoData, error)
GetDKGAcceptList get dkg accept list
type ReqAddrInfoResp ¶
type ReqAddrInfoResp struct { Status string Tip string Error string Data []*ReqAddrInfoData }
ReqAddrInfoResp request address info response
type ReqAddrInfoSortedSlice ¶
type ReqAddrInfoSortedSlice []*ReqAddrInfoData
ReqAddrInfoSortedSlice sorted slice
func (ReqAddrInfoSortedSlice) Less ¶
func (s ReqAddrInfoSortedSlice) Less(i, j int) bool
Less impl Sortable
func (ReqAddrInfoSortedSlice) Swap ¶
func (s ReqAddrInfoSortedSlice) Swap(i, j int)
Swap impl Sortable
type ReqAddrStatus ¶
type ReqAddrStatus struct { Status string PubKey string Tip string Error string AllReply []*SignReply TimeStamp string }
ReqAddrStatus request address status
func GetReqAddrStatus ¶
func GetReqAddrStatus(key, rpcAddr string) (*ReqAddrStatus, error)
GetReqAddrStatus call getReqAddrStatus
type SignData ¶
type SignData struct { TxType string PubKey string MsgHash []string MsgContext []string Keytype string GroupID string ThresHold string Mode string TimeStamp string }
SignData sign data
type SignInfoData ¶
type SignInfoData struct { Account string GroupID string Key string KeyType string Mode string MsgHash []string MsgContext []string Nonce string PubKey string ThresHold string TimeStamp string // contains filtered or unexported fields }
SignInfoData sign info
func GetAcceptList ¶
func GetAcceptList(user string, expiredInterval int64) ([]*SignInfoData, error)
GetAcceptList get accept list of 'user'
func GetCurNodeSignInfo ¶
func GetCurNodeSignInfo(expiredInterval int64) ([]*SignInfoData, error)
GetCurNodeSignInfo call getCurNodeSignInfo
type SignInfoResp ¶
type SignInfoResp struct { Status string Tip string Error string Data []*SignInfoData }
SignInfoResp sign info response
type SignInfoSortedSlice ¶
type SignInfoSortedSlice []*SignInfoData
SignInfoSortedSlice sorted slice
func (SignInfoSortedSlice) Less ¶
func (s SignInfoSortedSlice) Less(i, j int) bool
Less impl Sortable
type SignStatus ¶
type SignStatus struct { Status string Rsv []string Tip string Error string AllReply []*SignReply TimeStamp string }
SignStatus sign status
func GetSignStatus ¶
func GetSignStatus(key, rpcAddr string) (*SignStatus, error)
GetSignStatus call getSignStatus