Class: CredStash::Cipher

Inherits:
Object
  • Object
show all
Defined in:
lib/cred_stash/cipher.rb

Instance Method Summary collapse

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