rails/rails — pull request #12995 by rafaelfranca (2013-11-22 02:08:17+00:00)
Title: Add Application#message_verifier method to return a message verifier

This verifier can be used to generate and verify signed messages in the application.

```ruby
message = Rails.application.message_verifier.generate('my sensible data')
Rails.application.message_verifier.verify(message)
# => 'my sensible data'
```

It is recommended to not use the same verifier to different things, so you can get different verifiers passing the name argument.

```ruby
message = Rails.application.message_verifier('cookies').generate('my sensible cookie data')
```

By default all the verifiers will share the same salt, so messages generated by one can be verifier by another one.

We recommend to use different salts to different verifiers and you can configure using `config.message_verifier_salts`.

```ruby
Rails.application.config.message_verifier_salts = { 'cookies' => 'cookies salt' }
```

See the [`ActiveSupport::MessageVerifier` documentation](http://api.rubyonrails.org/classes/ActiveSupport/MessageVerifier.html) for more information.