instance method
encrypt
Ruby on Rails 7.1.6
Since v7.0.10Signature
encrypt(clean_text, key:, deterministic: false)
Encrypts the provided text and return an encrypted Message.
Parameters
-
clean_textreq -
keykeyreq -
deterministickey = false
Source
# File activerecord/lib/active_record/encryption/cipher.rb, line 15
def encrypt(clean_text, key:, deterministic: false)
cipher_for(key, deterministic: deterministic).encrypt(clean_text).tap do |message|
message.headers.encoding = clean_text.encoding.name unless clean_text.encoding == DEFAULT_ENCODING
end
end
Defined in activerecord/lib/active_record/encryption/cipher.rb line 15
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Encryption::Cipher