diff options
Diffstat (limited to 'railties')
-rw-r--r-- | railties/CHANGELOG.md | 4 | ||||
-rw-r--r-- | railties/lib/rails/application.rb | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md index 8fbac31c0a..084b87bf35 100644 --- a/railties/CHANGELOG.md +++ b/railties/CHANGELOG.md @@ -35,8 +35,8 @@ This verifier can be used to generate and verify signed messages in the application. - message = Rails.application.message_verifier('salt').generate('my sensible data') - Rails.application.message_verifier('salt').verify(message) + message = Rails.application.message_verifier('sensitive_data').generate('my sensible data') + Rails.application.message_verifier('sensitive_data').verify(message) # => 'my sensible data' It is recommended not to use the same verifier for different things, so you can get different diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 06acb4c877..795321bc20 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -170,18 +170,18 @@ module Rails # # ==== Parameters # - # * +salt+ - the salt that will be used to generate the secret key of the verifier. + # * +verifier_name+ - the name of the message verifier. # # ==== Examples # - # message = Rails.application.message_verifier('salt').generate('my sensible data') - # Rails.application.message_verifier('salt').verify(message) + # message = Rails.application.message_verifier('sensitive_data').generate('my sensible data') + # Rails.application.message_verifier('sensitive_data').verify(message) # # => 'my sensible data' # # See the +ActiveSupport::MessageVerifier+ documentation for more information. - def message_verifier(salt) - @message_verifiers[salt] ||= begin - secret = key_generator.generate_key(salt) + def message_verifier(verifier_name) + @message_verifiers[verifier_name] ||= begin + secret = key_generator.generate_key(verifier_name) ActiveSupport::MessageVerifier.new(secret) end end |