跳至内容 跳至搜索

一个在尝试加密数据时会引发错误的 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