跳至内容 跳至搜索

一个 NullEncryptor,在尝试加密数据时会引发错误

这在您希望出于调试目的而显示密文,并希望确保不会用错误内容覆盖任何可加密属性时非常有用。

方法
B
D
E

实例公共方法

binary?()

# File activerecord/lib/active_record/encryption/read_only_null_encryptor.rb, line 23
def binary?
  false
end

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

# File activerecord/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: {})

# File activerecord/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)

# File activerecord/lib/active_record/encryption/read_only_null_encryptor.rb, line 19
def encrypted?(text)
  false
end