Method: ActiveRecord::Encryption::Cipher#decrypt
- Defined in:
- activerecord/lib/active_record/encryption/cipher.rb
#decrypt(encrypted_message, key:) ⇒ Object
Decrypt the provided Message.
When key is an Array, it will try all the keys raising a ActiveRecord::Encryption::Errors::Decryption if none works.
25 26 27 28 29 |
# File 'activerecord/lib/active_record/encryption/cipher.rb', line 25 def decrypt(, key:) try_to_decrypt_with_each(, keys: Array(key)).tap do |decrypted_text| decrypted_text.force_encoding(.headers.encoding || DEFAULT_ENCODING) end end |