class ActiveRecord::Encryption::Encryptor

def encrypt(clear_text, key_provider: default_key_provider, cipher_options: {})

+ActiveRecord::Encryption.cipher+
Cipher-specific options that will be passed to the Cipher configured in
[:cipher_options]

+ActiveRecord::Encryption.key_provider+ when not provided.
Key provider to use for the encryption operation. It will default to
[:key_provider]

=== Options

4. Encode the result with Base 64
by default)
3. Serialize it with +ActiveRecord::Encryption.message_serializer+ (+ActiveRecord::Encryption::SafeMarshal+
2. Compress and encrypt +clean_text+ as the message payload
1. Create a new ActiveRecord::Encryption::Message

Internally, it will:

Encrypts +clean_text+ and returns the encrypted result
def encrypt(clear_text, key_provider: default_key_provider, cipher_options: {})
  clear_text = force_encoding_if_needed(clear_text) if cipher_options[:deterministic]
  validate_payload_type(clear_text)
  serialize_message build_encrypted_message(clear_text, key_provider: key_provider, cipher_options: cipher_options)
end