mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 18:37:45 +08:00
fix(key): dont allow backup key to be named 'self'
docs: update the key rotate help docs to be clearer about the backup
This commit is contained in:
parent
e80601b249
commit
0ed43e903e
@ -442,6 +442,7 @@ var keyRotateCmd = &cmds.Command{
|
||||
Tagline: "Rotates the ipfs identity.",
|
||||
ShortDescription: `
|
||||
Generates a new ipfs identity and saves it to the ipfs config file.
|
||||
Your existing identity key will be backed up in the Keystore.
|
||||
The daemon must not be running when calling this command.
|
||||
|
||||
ipfs uses a repository in the local file system. By default, the repo is
|
||||
@ -453,7 +454,7 @@ environment variable:
|
||||
},
|
||||
Arguments: []cmds.Argument{},
|
||||
Options: []cmds.Option{
|
||||
cmds.StringOption(oldKeyOptionName, "o", "Keystore name for the old/rotated-out key."),
|
||||
cmds.StringOption(oldKeyOptionName, "o", "Keystore name to use for backing up your existing identity"),
|
||||
cmds.StringOption(keyStoreTypeOptionName, "t", "type of the key to create: rsa, ed25519").WithDefault(keyStoreAlgorithmDefault),
|
||||
cmds.IntOption(keyStoreSizeOptionName, "s", "size of the key to generate"),
|
||||
},
|
||||
@ -482,6 +483,9 @@ environment variable:
|
||||
if !ok {
|
||||
return fmt.Errorf("keystore name for backing up old key must be provided")
|
||||
}
|
||||
if oldKey == "self" {
|
||||
return fmt.Errorf("keystore name for back up cannot be named 'self'")
|
||||
}
|
||||
return doRotate(os.Stdout, cctx.ConfigRoot, oldKey, algorithm, nBitsForKeypair, nBitsGiven)
|
||||
},
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user