Class: Lockbox::Encryptor

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

Class Method Summary collapse

Class Method Details

.box(options) ⇒ Object



11
12
13
14
15
# File 'lib/lockbox/encryptor.rb', line 11

def self.box(options)
  options = options.slice(:key, :encryption_key, :decryption_key, :algorithm, :previous_versions)
  options[:algorithm] = "aes-gcm" if options[:algorithm] == "aes-256-gcm"
  Lockbox.new(options)
end

.decrypt(options) ⇒ Object



7
8
9
# File 'lib/lockbox/encryptor.rb', line 7

def self.decrypt(options)
  box(options).decrypt(options[:value])
end

.encrypt(options) ⇒ Object



3
4
5
# File 'lib/lockbox/encryptor.rb', line 3

def self.encrypt(options)
  box(options).encrypt(options[:value])
end