Module: SecPass

Defined in:
lib/pass/sec_pass.rb

Overview

this is used to encrypt and decrypt third party passwords that we store. not super safe, but better than plain text

Class Method Summary collapse

Class Method Details

.decrypt(pass) ⇒ Object


8
9
10
11
12
13
14
15
# File 'lib/pass/sec_pass.rb', line 8

def decrypt(pass)
  begin
    decoded = Base64.decode64(pass.encode('ascii-8bit'))
    Encryptor.decrypt(:value => decoded, :key => ENV['SALTY'])
  rescue Exception => exception
    return false
  end
end

.encrypt(pass) ⇒ Object


4
5
6
# File 'lib/pass/sec_pass.rb', line 4

def encrypt(pass)
  Base64.encode64(Encryptor.encrypt(:value => pass, :key => ENV['SALTY'])).encode('utf-8')
end