fix(key): dont allow backup key to be named 'self'
docs: update the key rotate help docs to be clearer about the backup
Jacob Heun committed
Aug 21, 2020 at 19:42 UTC
0ed43e903e52bda84649cbbf04729477ea099af1
1 file changed
+5
-1
core/commands/keystore.go
+5
-1
@@ -442,6 +442,7 @@ var keyRotateCmd = &cmds.Command{
442
Tagline: "Rotates the ipfs identity.",
443
ShortDescription: `
444
Generates a new ipfs identity and saves it to the ipfs config file.
445
+Your existing identity key will be backed up in the Keystore.
446
The daemon must not be running when calling this command.
447
448
ipfs uses a repository in the local file system. By default, the repo is
@@ -453,7 +454,7 @@ environment variable:
454
},
455
Arguments: []cmds.Argument{},
456
Options: []cmds.Option{
456
- cmds.StringOption(oldKeyOptionName, "o", "Keystore name for the old/rotated-out key."),
457
+ cmds.StringOption(oldKeyOptionName, "o", "Keystore name to use for backing up your existing identity"),
458
cmds.StringOption(keyStoreTypeOptionName, "t", "type of the key to create: rsa, ed25519").WithDefault(keyStoreAlgorithmDefault),
459
cmds.IntOption(keyStoreSizeOptionName, "s", "size of the key to generate"),
460
},
@@ -482,6 +483,9 @@ environment variable:
483
if !ok {
484
return fmt.Errorf("keystore name for backing up old key must be provided")
485
}
486
+ if oldKey == "self" {
487
+ return fmt.Errorf("keystore name for back up cannot be named 'self'")
488
+ }
489
return doRotate(os.Stdout, cctx.ConfigRoot, oldKey, algorithm, nBitsForKeypair, nBitsGiven)
490
},
491
}