class OmniAuth::Whichsignupapi::TokenTools
Public Class Methods
new(password)
click to toggle source
# File lib/omniauth/whichsignupapi/token_tools.rb, line 4 def initialize(password) @password = password end
Public Instance Methods
decode_token(token)
click to toggle source
# File lib/omniauth/whichsignupapi/token_tools.rb, line 14 def decode_token(token) dec = get_cipher.decrypt(token) parts = dec.split('|') { time: parts.pop, token_data: parts.join('|') } end
generate_token(token_data)
click to toggle source
# File lib/omniauth/whichsignupapi/token_tools.rb, line 8 def generate_token(token_data) raise 'token generations not possible is token is blank' if token_data.blank? t = "#{token_data}|#{Time.now.to_i}" get_cipher.encrypt(t) end
Private Instance Methods
get_cipher()
click to toggle source
# File lib/omniauth/whichsignupapi/token_tools.rb, line 25 def get_cipher Gibberish::AES::CBC.new(@password) end