1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #43334 from federicoaldunate/add-that-raises-exception-message-encryptor

Update MessageEncryptor guide to show that an exception is raised [ci-skip]
This commit is contained in:
Jonathan Hefner 2021-09-29 12:15:59 -05:00 committed by GitHub
commit 414e8dea59
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -22,6 +22,11 @@ module ActiveSupport
# crypt = ActiveSupport::MessageEncryptor.new(key) # => #<ActiveSupport::MessageEncryptor ...>
# encrypted_data = crypt.encrypt_and_sign('my secret data') # => "NlFBTTMwOUV5UlA1QlNEN2xkY2d6eThYWWh..."
# crypt.decrypt_and_verify(encrypted_data) # => "my secret data"
# The +decrypt_and_verify+ method will raise an
# <tt>ActiveSupport::MessageEncryptor::InvalidMessage</tt> exception if the data
# provided cannot be decrypted or verified.
#
# crypt.decrypt_and_verify('not encrypted data') # => ActiveSupport::MessageEncryptor::InvalidMessage
#
# === Confining messages to a specific purpose
#