Class: CredStash::Cipher
- Inherits:
-
Object
- Object
- CredStash::Cipher
- Defined in:
- lib/cred_stash/cipher.rb
Instance Method Summary collapse
- #decrypt(value) ⇒ Object
- #encrypt(value) ⇒ Object
-
#initialize(key) ⇒ Cipher
constructor
A new instance of Cipher.
Constructor Details
#initialize(key) ⇒ Cipher
Returns a new instance of Cipher.
4 5 6 |
# File 'lib/cred_stash/cipher.rb', line 4 def initialize(key) @key = key end |
Instance Method Details
#decrypt(value) ⇒ Object
12 13 14 |
# File 'lib/cred_stash/cipher.rb', line 12 def decrypt(value) run(mode: :decrypt, value: value).force_encoding("UTF-8") end |
#encrypt(value) ⇒ Object
8 9 10 |
# File 'lib/cred_stash/cipher.rb', line 8 def encrypt(value) run(mode: :encrypt, value: value) end |