Class: Refinery::AuthKey

Inherits:
Object
  • Object
show all
Defined in:
lib/refinery/auth_key.rb

Class Method Summary collapse

Class Method Details

.make_auth_key(seed = '') ⇒ Object


make_auth_key – returns a SHA-encrypted randomized key from time & seed




30
31
32
# File 'lib/refinery/auth_key.rb', line 30

def self.make_auth_key( seed='' )
  return Digest::SHA1.hexdigest( (Time.now.to_s + seed.to_s ).split(//).sort_by {rand}.join )
end

.make_tokenObject





23
24
25
# File 'lib/refinery/auth_key.rb', line 23

def self.make_token
  secure_digest(Time.now, (1..10).map{ rand.to_s })
end

.secure_digest(*args) ⇒ Object





17
18
19
# File 'lib/refinery/auth_key.rb', line 17

def self.secure_digest(*args)
  Digest::SHA1.hexdigest(args.flatten.join('--'))
end