Method: PreciousCargo::Data.encrypt!

Defined in:
lib/precious_cargo/data.rb

.encrypt!(data, options = {}) ⇒ Object

Public: Encrypt the supplied data using a secret string. Currently only supports AES 256 encryption. data - The data to be encrypted. options - Hash of values used to encrypt the secret.

:secret - A secret string.

Returns the AES encrypted data.



14
15
16
17
18
# File 'lib/precious_cargo/data.rb', line 14

def encrypt!(data, options = {})
  secret = options[:secret]
  cipher = Gibberish::AES.new(secret)
  cipher.encrypt(data)
end