method
encrypt
v8.0.0 -
Show latest stable
- Class:
ActiveRecord::Encryption::Encryptor
encrypt(clear_text, key_provider: default_key_provider, cipher_options: {})public
Encrypts clean_text and returns the encrypted result
Internally, it will:
-
Compress and encrypt clean_text as the message payload
-
Serialize it with +ActiveRecord::Encryption.message_serializer+ (+ActiveRecord::Encryption::SafeMarshal+ by default)
-
Encode the result with Base 64
Options
- :key_provider
-
Key provider to use for the encryption operation. It will default to +ActiveRecord::Encryption.key_provider+ when not provided.
- :cipher_options
-
Cipher-specific options that will be passed to the Cipher configured in +ActiveRecord::Encryption.cipher+