summaryrefslogtreecommitdiff
path: root/lib/leap_cli
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2012-12-11 02:19:46 -0800
committerelijah <elijah@riseup.net>2012-12-11 02:19:46 -0800
commitf43b27b2e5e192a917ae0fdac34097ad0754f9bc (patch)
treea703157d5f46fa2d79540155467a4e79856f502e /lib/leap_cli
parent4a63e8c258025f91f4f3e37385fe2dfc0fc579ad (diff)
generate secrets that are url compatible
Diffstat (limited to 'lib/leap_cli')
-rw-r--r--lib/leap_cli/util/secret.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/leap_cli/util/secret.rb b/lib/leap_cli/util/secret.rb
index 4833caa..27770a7 100644
--- a/lib/leap_cli/util/secret.rb
+++ b/lib/leap_cli/util/secret.rb
@@ -1,8 +1,8 @@
#
# A simple alphanumeric secret generator, with no ambiguous characters.
#
-# It also includes symbols that are treated as word characters by most
-# terminals (so you can still double click to select the entire secret).
+# Only alphanumerics are allows, in order to make these passwords work
+# for REST url calls and to allow you to easily copy and past them.
#
# Uses OpenSSL random number generator instead of Ruby's rand function
#
@@ -13,9 +13,9 @@ module LeapCli; module Util
class Secret
- CHARS = ('A'..'Z').to_a + ('a'..'z').to_a + ('0'..'9').to_a + "_-&@%~=+".split(//u) - "io01lO".split(//u)
+ CHARS = ('A'..'Z').to_a + ('a'..'z').to_a + ('0'..'9').to_a + "_".split(//u) - "io01lO".split(//u)
- def self.generate(length = 10)
+ def self.generate(length = 16)
seed
OpenSSL::Random.random_bytes(length).bytes.to_a.collect { |byte|
CHARS[ byte % CHARS.length ]