Permalink
Browse files

Change the message verifier argument to verifier_name

  • Loading branch information...
1 parent 87fc20a commit 61f6b47204c63715b4a49f078f9d58f24f06f502 @rafaelfranca rafaelfranca committed Dec 19, 2013
Showing with 8 additions and 8 deletions.
  1. +2 −2 railties/CHANGELOG.md
  2. +6 −6 railties/lib/rails/application.rb
View
@@ -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
@@ -170,18 +170,18 @@ def key_generator
#
# ==== 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

0 comments on commit 61f6b47

Please sign in to comment.