Class: ActiveRecord::Encryption::ReadOnlyNullEncryptor
- Inherits:
-
Object
- Object
- ActiveRecord::Encryption::ReadOnlyNullEncryptor
- Defined in:
- lib/active_record/encryption/read_only_null_encryptor.rb
Overview
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.
Instance Method Summary collapse
- #binary? ⇒ Boolean
- #decrypt(encrypted_text, key_provider: nil, cipher_options: {}) ⇒ Object
- #encrypt(clean_text, key_provider: nil, cipher_options: {}) ⇒ Object
- #encrypted?(text) ⇒ Boolean
Instance Method Details
#binary? ⇒ Boolean
23 24 25 |
# File 'lib/active_record/encryption/read_only_null_encryptor.rb', line 23 def binary? false end |
#decrypt(encrypted_text, key_provider: nil, cipher_options: {}) ⇒ Object
15 16 17 |
# File 'lib/active_record/encryption/read_only_null_encryptor.rb', line 15 def decrypt(encrypted_text, key_provider: nil, cipher_options: {}) encrypted_text end |
#encrypt(clean_text, key_provider: nil, cipher_options: {}) ⇒ Object
11 12 13 |
# File 'lib/active_record/encryption/read_only_null_encryptor.rb', line 11 def encrypt(clean_text, key_provider: nil, cipher_options: {}) raise Errors::Encryption, "This encryptor is read-only" end |
#encrypted?(text) ⇒ Boolean
19 20 21 |
# File 'lib/active_record/encryption/read_only_null_encryptor.rb', line 19 def encrypted?(text) false end |