Sha256: d97a1aa713a040f43566dd25bb149d56ddfdf8527c02a2b1a408b72ed96b4b82

Contents?: true

Size: 737 Bytes

Versions: 23

Compression:

Stored size: 737 Bytes

Contents

# frozen_string_literal: true

module ActiveRecord
  module Encryption
    # A +NullEncryptor+ that will raise an error when trying to encrypt data
    #
    # This is useful when you want to reveal ciphertexts for debugging purposes
    # and you want to make sure you won't overwrite any encryptable attribute with
    # the wrong content.
    class ReadOnlyNullEncryptor
      def encrypt(clean_text, key_provider: nil, cipher_options: {})
        raise Errors::Encryption, "This encryptor is read-only"
      end

      def decrypt(encrypted_text, key_provider: nil, cipher_options: {})
        encrypted_text
      end

      def encrypted?(text)
        false
      end

      def binary?
        false
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
activerecord-8.0.1 lib/active_record/encryption/read_only_null_encryptor.rb
activerecord-8.0.0.1 lib/active_record/encryption/read_only_null_encryptor.rb
activerecord-7.2.2.1 lib/active_record/encryption/read_only_null_encryptor.rb
activerecord-8.0.0 lib/active_record/encryption/read_only_null_encryptor.rb
activerecord-7.2.2 lib/active_record/encryption/read_only_null_encryptor.rb
activerecord-8.0.0.rc2 lib/active_record/encryption/read_only_null_encryptor.rb
activerecord-7.2.1.2 lib/active_record/encryption/read_only_null_encryptor.rb
activerecord-8.0.0.rc1 lib/active_record/encryption/read_only_null_encryptor.rb
activerecord-7.2.1.1 lib/active_record/encryption/read_only_null_encryptor.rb
activerecord-8.0.0.beta1 lib/active_record/encryption/read_only_null_encryptor.rb
omg-activerecord-8.0.0.alpha9 lib/active_record/encryption/read_only_null_encryptor.rb
omg-activerecord-8.0.0.alpha8 lib/active_record/encryption/read_only_null_encryptor.rb
omg-activerecord-8.0.0.alpha7 lib/active_record/encryption/read_only_null_encryptor.rb
omg-activerecord-8.0.0.alpha4 lib/active_record/encryption/read_only_null_encryptor.rb
omg-activerecord-8.0.0.alpha3 lib/active_record/encryption/read_only_null_encryptor.rb
omg-activerecord-8.0.0.alpha2 lib/active_record/encryption/read_only_null_encryptor.rb
omg-activerecord-8.0.0.alpha1 lib/active_record/encryption/read_only_null_encryptor.rb
activerecord-7.2.1 lib/active_record/encryption/read_only_null_encryptor.rb
activerecord-7.2.0 lib/active_record/encryption/read_only_null_encryptor.rb
activerecord-7.2.0.rc1 lib/active_record/encryption/read_only_null_encryptor.rb