提交 2fded41f 作者: Jakub Sztandera

core/commands: do not show PrivKey in config if it is null

License: MIT
Signed-off-by: 's avatarJakub Sztandera <kubuxu@protonmail.ch>
上级 2b682f95
......@@ -161,7 +161,7 @@ included in the output of this command.
return
}
cfg["Identity"].(map[string]interface{})["PrivKey"] = nil
delete(cfg["Identity"].(map[string]interface{}), "PrivKey")
output, err := config.HumanOutput(cfg)
if err != nil {
......
......@@ -8,7 +8,7 @@ import (
// Identity tracks the configuration of the local node's identity.
type Identity struct {
PeerID string
PrivKey string
PrivKey string `json:",omitempty"`
}
// DecodePrivateKey is a helper to decode the users PrivateKey
......
......@@ -93,12 +93,12 @@ test_config_cmd() {
test_expect_success "'ipfs config show' doesn't include privkey" '
ipfs config show > show_config &&
grep PrivKey show_config | grep "\"PrivKey\": null"
test_expect_code 1 grep PrivKey show_config
'
test_expect_success "'ipfs config replace' injects privkey back" '
ipfs config replace show_config &&
grep PrivKey "$IPFS_PATH/config" | grep -v ": null" >/dev/null
grep "\"PrivKey\":" "$IPFS_PATH/config" | grep -e ": \".*\"" >/dev/null
'
test_expect_success "'ipfs config replace' with privkey erors out" '
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论