Class: Mongoid::Encrypted::Encryptor

Inherits:
Object
  • Object
show all
Defined in:
lib/mongoid/encrypted/encryptor.rb

Defined Under Namespace

Classes: MissingKeyError

Class Method Summary collapse

Class Method Details

.decrypt(value) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/mongoid/encrypted/encryptor.rb', line 17

def decrypt(value)
  crypt = instance

  if config.rotations.present?
    config.rotations.each { |r| crypt.rotate *Array.wrap(r) }
  end

  crypt.decrypt_and_verify(value)
end

.encrypt(value) ⇒ Object



13
14
15
# File 'lib/mongoid/encrypted/encryptor.rb', line 13

def encrypt(value)
  instance.encrypt_and_sign(value)
end