module JumpIn::Tokenator
Constants
- DELIMITER
Public Instance Methods
decode_and_split_token(token)
click to toggle source
# File lib/jump_in/tokenator.rb, line 12 def decode_and_split_token(token) Base64.urlsafe_decode64(token).split(DELIMITER) rescue raise JumpIn::InvalidTokenError end
decode_time(token)
click to toggle source
# File lib/jump_in/tokenator.rb, line 18 def decode_time(token) token_time = decode_and_split_token(token)[1] Time.parse(token_time) rescue raise JumpIn::InvalidTokenError end
generate_token()
click to toggle source
# File lib/jump_in/tokenator.rb, line 7 def generate_token Base64.urlsafe_encode64 [SecureRandom.hex(12), Time.now.xmlschema] .join(DELIMITER) end