instance method decrypt

Ruby on Rails 8.0.4

Since v7.0.10

Available in: v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

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_message req
key keyreq
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

Type at least 2 characters to search.

↑↓ navigate · open · esc close