@@ -3,6 +3,7 @@ package state
3
3
import (
4
4
"encoding/base64"
5
5
"encoding/hex"
6
+ "fmt"
6
7
"time"
7
8
8
9
"github.com/randa-mu/ssv-dkg/shared/api"
@@ -46,33 +47,38 @@ func CreateKeyshareFile(ownerConfig api.OwnerConfig, signingOutput api.SigningOu
46
47
47
48
operators := make ([]operator , len (signingOutput .OperatorShares ))
48
49
operatorIDs := make ([]uint32 , len (signingOutput .OperatorShares ))
50
+ var publicKeys []byte
51
+ var encryptedShares []byte
49
52
50
53
for i , share := range signingOutput .OperatorShares {
51
- operatorKey := make ([]byte , base64 .StdEncoding .EncodedLen (len (share .Identity .Public )))
52
- base64 .StdEncoding .Encode (operatorKey , share .Identity .Public )
54
+ operatorKey := make ([]byte , base64 .RawStdEncoding .EncodedLen (len (share .Identity .Public )))
55
+ base64 .RawStdEncoding .Encode (operatorKey , share .Identity .Public )
53
56
operators [i ] = operator {
54
57
Id : uint32 (i ),
55
58
OperatorKey : operatorKey ,
56
59
}
57
60
operatorIDs [i ] = uint32 (i )
61
+ publicKeys = append (publicKeys , share .Identity .Public ... )
62
+ encryptedShares = append (encryptedShares , share .EncryptedShare ... )
58
63
}
59
64
65
+ sharesData := append (append (signingOutput .ValidatorNonceSignature , publicKeys ... ), encryptedShares ... )
66
+
60
67
return KeyshareFile {
61
68
Version : KeyshareFileVersion ,
62
69
CreatedAt : time .Now ().UTC ().String (),
63
70
Shares : []keyShare {
64
71
{
65
72
Data : data {
66
73
OwnerNonce : ownerConfig .ValidatorNonce ,
67
- OwnerAddress : hex .EncodeToString (ownerConfig .Address ),
74
+ OwnerAddress : fmt . Sprintf ( "0x%s" , hex .EncodeToString (ownerConfig .Address ) ),
68
75
PublicKey : publicKey ,
69
76
Operators : operators ,
70
77
},
71
78
Payload : payload {
72
79
PublicKey : publicKey ,
73
80
OperatorIDs : operatorIDs ,
74
- // TODO: work out how this is actually encoded from the encrypted sahres
75
- SharesData : "0xdeadbeefdeadbeef" ,
81
+ SharesData : fmt .Sprintf ("0x%s" , hex .EncodeToString (sharesData )),
76
82
},
77
83
},
78
84
},
0 commit comments