instance method
decrypt
Ruby on Rails 8.0.4
Since v7.0.10Signature
decrypt(encrypted_message, key:)
Decrypt the provided Message.
When key is an Array, it will try all the keys raising a ActiveRecord::Encryption::Errors::Decryption if none works.
Parameters
-
encrypted_messagereq -
keykeyreq
Source
# File activerecord/lib/active_record/encryption/cipher.rb, line 25
def decrypt(encrypted_message, key:)
try_to_decrypt_with_each(encrypted_message, keys: Array(key)).tap do |decrypted_text|
decrypted_text.force_encoding(encrypted_message.headers.encoding || DEFAULT_ENCODING)
end
end
Defined in activerecord/lib/active_record/encryption/cipher.rb line 25
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Encryption::Cipher