Module: Utilities::RandomToken

Defined in:
lib/utilities/random_token.rb

Class Method Summary (collapse)

Class Method Details

+ (Digest::SHA1) digest(token)

Parameters:

  • token (String)

Returns:

  • (Digest::SHA1)


9
10
11
# File 'lib/utilities/random_token.rb', line 9

def self.digest(token)
  Digest::SHA1.hexdigest(token.to_s)
end

+ (String) generate

Returns:

  • (String)


3
4
5
# File 'lib/utilities/random_token.rb', line 3

def self.generate
  SecureRandom.urlsafe_base64
end