-
Notifications
You must be signed in to change notification settings - Fork 504
/
result.go
46 lines (35 loc) · 963 Bytes
/
result.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
package init
import (
"bytes"
"fmt"
"github.com/0xPolygon/polygon-edge/command/helper"
"github.com/0xPolygon/polygon-edge/types"
)
type SecretsInitResult struct {
Address types.Address `json:"address"`
BLSPubkey string `json:"bls_pubkey"`
NodeID string `json:"node_id"`
Insecure bool `json:"insecure"`
}
func (r *SecretsInitResult) GetOutput() string {
var buffer bytes.Buffer
vals := make([]string, 0, 3)
vals = append(
vals,
fmt.Sprintf("Public key (address)|%s", r.Address.String()),
)
if r.BLSPubkey != "" {
vals = append(
vals,
fmt.Sprintf("BLS Public key|%s", r.BLSPubkey),
)
}
vals = append(vals, fmt.Sprintf("Node ID|%s", r.NodeID))
if r.Insecure {
buffer.WriteString("\n[WARNING: INSECURE LOCAL SECRETS - SHOULD NOT BE RUN IN PRODUCTION]\n")
}
buffer.WriteString("\n[SECRETS INIT]\n")
buffer.WriteString(helper.FormatKV(vals))
buffer.WriteString("\n")
return buffer.String()
}