Class: Veil::Cipher
- Inherits:
-
Object
- Object
- Veil::Cipher
- Defined in:
- lib/veil/cipher.rb,
lib/veil/cipher/v1.rb,
lib/veil/cipher/v2.rb
Defined Under Namespace
Constant Summary collapse
Class Method Summary collapse
-
.create(opts = {}) ⇒ Object
Create a new Cipher instance.
Class Method Details
.create(opts = {}) ⇒ Object
Create a new Cipher instance
Defaults to using v1 for decryption (noop), v2 for encryption. If invoked as default, v2 will generate key and iv.
21 22 23 24 25 26 27 28 29 |
# File 'lib/veil/cipher.rb', line 21 def create(opts = {}) case opts when {}, nil [ DEFAULT_DECRYPTOR.new({}), DEFAULT_ENCRYPTOR.new({}) ] else cipher = const_get(opts[:type]) [ cipher.new(opts), cipher.new(opts) ] end end |