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

Update MessageEncryptor guide to show that an exception is raised

swap order
This commit is contained in:
Federico Aldunate 2021-09-29 12:11:49 -03:00
parent fdf5e0054a
commit 4860d8534b

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
#