Sha256: 4c431810b7f00eda1830c48d11cc6fc806fed6b8630c75b901c27121dbd24171
Contents?: true
Size: 489 Bytes
Versions: 21
Compression:
Stored size: 489 Bytes
Contents
module Impersonation ## # Returns a hash based on the given id. # def self.hash_for(id) raise(ArgumentError, "Must provide an id") unless id generate_hash(id) end ## # Returns +true+ if the given hash is valid for the given id. # def self.valid_hash?(id, hash) hash == generate_hash(id) end private def self.generate_hash(id) Digest::MD5.hexdigest("----#{id}-----#{Headstart.configuration.impersonation_hash}-----") end end
Version data entries
21 entries across 21 versions & 1 rubygems