Generate
While some secrets have to be manually generated (e.g. by clicking through a graphical user interface), others can be programmatically generated.
That’s where the generate
command comes in.
When you want to generate a random password (or any random sequence of characters for that matter), you can use the generate
command:
secrethub generate [options] <namespace>/<repo>[/<dir>]/<secret>
The generate
command generates a random string and writes it to the given path.
Arguments
-
<namespace>/<repo>[/<dir>]/<secret>
(string) - The path to write the generated secret to.
Flags
-
-l, --length
(int) - The length of the generated secret. Defaults to 22.
-
--charset
(string) - Define the set of characters to randomly generate a password from. Options are
all
,alphanumeric
,numeric
,lowercase
,uppercase
,letters
,symbols
andhuman-readable
. Multiple character sets can be combined by supplying them in a comma separated list. Defaults to alphanumeric. -
--min
(string) - String of the form
<charset>:<n>
. Ensure that the resulting password contains at least n characters from the given character set. Note that adding constrains reduces the strength of the secret. When possible, avoid any constraints. -
-c, --clip
(boolean) - Copy the generated value to the clipboard. The clipboard is automatically cleared after 45 seconds.