Skip to content

Commit 414e8de

Browse files
Merge pull request rails#43334 from federicoaldunate/add-that-raises-exception-message-encryptor
Update MessageEncryptor guide to show that an exception is raised [ci-skip]
2 parents d59e729 + 4860d85 commit 414e8de

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

activesupport/lib/active_support/message_encryptor.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ module ActiveSupport
2222
# crypt = ActiveSupport::MessageEncryptor.new(key) # => #<ActiveSupport::MessageEncryptor ...>
2323
# encrypted_data = crypt.encrypt_and_sign('my secret data') # => "NlFBTTMwOUV5UlA1QlNEN2xkY2d6eThYWWh..."
2424
# crypt.decrypt_and_verify(encrypted_data) # => "my secret data"
25+
# The +decrypt_and_verify+ method will raise an
26+
# <tt>ActiveSupport::MessageEncryptor::InvalidMessage</tt> exception if the data
27+
# provided cannot be decrypted or verified.
28+
#
29+
# crypt.decrypt_and_verify('not encrypted data') # => ActiveSupport::MessageEncryptor::InvalidMessage
2530
#
2631
# === Confining messages to a specific purpose
2732
#

0 commit comments

Comments
 (0)