LoadNodeKey loads NodeKey located in filePath.
(filePath string)
| 70 | |
| 71 | // LoadNodeKey loads NodeKey located in filePath. |
| 72 | func LoadNodeKey(filePath string) (*NodeKey, error) { |
| 73 | jsonBytes, err := os.ReadFile(filePath) |
| 74 | if err != nil { |
| 75 | return nil, err |
| 76 | } |
| 77 | nodeKey := new(NodeKey) |
| 78 | err = tmjson.Unmarshal(jsonBytes, nodeKey) |
| 79 | if err != nil { |
| 80 | return nil, err |
| 81 | } |
| 82 | return nodeKey, nil |
| 83 | } |
| 84 | |
| 85 | // SaveAs persists the NodeKey to filePath. |
| 86 | func (nodeKey *NodeKey) SaveAs(filePath string) error { |