Froze rails gems
[depot.git] / vendor / rails / railties / lib / rails_generator / secret_key_generator.rb
1 module Rails
2 # A class for creating random secret keys. This class will do its best to create a
3 # random secret key that's as secure as possible, using whatever methods are
4 # available on the current platform. For example:
5 #
6 # generator = Rails::SecretKeyGenerator("some unique identifier, such as the application name")
7 # generator.generate_secret # => "f3f1be90053fa851... (some long string)"
8 #
9 # This class is *deprecated* in Rails 2.2 in favor of ActiveSupport::SecureRandom.
10 # It is currently a wrapper around ActiveSupport::SecureRandom.
11 class SecretKeyGenerator
12 def initialize(identifier)
13 end
14
15 # Generate a random secret key with the best possible method available on
16 # the current platform.
17 def generate_secret
18 ActiveSupport::SecureRandom.hex(64)
19 end
20 deprecate :generate_secret=>"You should use ActiveSupport::SecureRandom.hex(64)"
21 end
22 end