aboutsummaryrefslogtreecommitdiff
path: root/lib/leap_cli/config/macros.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/leap_cli/config/macros.rb')
-rw-r--r--lib/leap_cli/config/macros.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/leap_cli/config/macros.rb b/lib/leap_cli/config/macros.rb
index 5f90894..b2ad942 100644
--- a/lib/leap_cli/config/macros.rb
+++ b/lib/leap_cli/config/macros.rb
@@ -116,11 +116,22 @@ module LeapCli; module Config
#
# manager.export_secrets should be called later to capture any newly generated secrets.
#
+ # +length+ is the character length of the generated password.
+ #
def secret(name, length=32)
@manager.secrets.set(name, Util::Secret.generate(length))
end
#
+ # inserts an hexidecimal secret string, generating it if needed.
+ #
+ # +bit_length+ is the bits in the secret, (ie length of resulting hex string will be bit_length/4)
+ #
+ def hex_secret(name, bit_length=128)
+ @manager.secrets.set(name, Util::Secret.generate_hex(bit_length))
+ end
+
+ #
# return a fingerprint for a x509 certificate
#
def fingerprint(filename)