module JunglePath::Authentication::Helpers

Public Class Methods

expires_in_timestamp(days: 0, hours: 0, minutes: 0, seconds: 0) click to toggle source
# File lib/jungle_path/authentication/helpers.rb, line 13
def self.expires_in_timestamp(days: 0, hours: 0, minutes: 0, seconds: 0)
  s = seconds + (minutes * 60) + (hours * 60 * 60) + (days * 24 * 60 * 60)
  expires_timestamp = Time.new + s
end
generate_api_key(prefix="sk_") click to toggle source
# File lib/jungle_path/authentication/helpers.rb, line 6
def self.generate_api_key(prefix="sk_")
  begin
    key = SecureRandom.urlsafe_base64(18)
  end while key.include? ?_
  key = prefix + key
end