-
Notifications
You must be signed in to change notification settings - Fork 2
/
request_response.go
58 lines (50 loc) · 1.69 KB
/
request_response.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package tss
import "strings"
type KeygenRequest struct {
LocalPartyID string
AllParties string
ChainCodeHex string // hex encoded chain code
}
func (r KeygenRequest) GetAllParties() []string {
return strings.Split(r.AllParties, ",")
}
type KeygenResponse struct {
PubKey string `json:"pub_key"`
}
type KeysignRequest struct {
PubKey string `json:"pub_key"`
MessageToSign string `json:"message_to_sign"` // base64 encoded message that need to be signed
KeysignCommitteeKeys string `json:"keysign_committee_keys"`
LocalPartyKey string `json:"local_party_key"`
DerivePath string `json:"derive_path"`
}
func (r KeysignRequest) GetKeysignCommitteeKeys() []string {
return strings.Split(r.KeysignCommitteeKeys, ",")
}
type KeysignResponse struct {
Msg string `json:"msg"`
R string `json:"r"`
S string `json:"s"`
DerSignature string `json:"der_signature"`
RecoveryID string `json:"recovery_id"` // mostly used in ETH
}
// ReshareRequest is used to request a reshare
type ReshareRequest struct {
PubKey string `json:"pub_key"`
LocalPartyID string `json:"local_party_id"`
NewParties string `json:"all_parties"`
ChainCodeHex string `json:"chain_code_hex"`
OldParties string `json:"old_parties"`
ResharePrefix string `json:"reshare_prefix"`
NewResharePrefix string `json:"new_reshare_prefix"`
}
type ReshareResponse struct {
PubKey string `json:"pub_key"`
ResharePrefix string `json:"reshare_prefix"`
}
func (r ReshareRequest) GetNewParties() []string {
return strings.Split(r.NewParties, ",")
}
func (r ReshareRequest) GetOldParties() []string {
return strings.Split(r.OldParties, ",")
}