Sha256: 1ab10fd97acec5a9818ceecd0b6c3704a3b061253a82306dcc42b4f5a8c409fc
Contents?: true
Size: 556 Bytes
Versions: 1
Compression:
Stored size: 556 Bytes
Contents
require 'securerandom' class Tabulatr class Security def self.sign(arglist, salt=nil) salt ||= SecureRandom.base64 str = "#{Tabulatr.secret_tokens.first}-#{salt}-#{arglist}-#{Rails.application.config.secret_token}-#{Tabulatr.secret_tokens.last}" hash = Digest::SHA1.hexdigest(str) "#{arglist}-#{salt}-#{hash[5..40]}" end def self.validate(str) arglist, salt, hash = str.split('-') str == sign(arglist, salt) end def self.validate!(str) validate(str) or raise "SECURITY!" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tabulatr2-0.6.0 | lib/tabulatr/tabulatr/security.rb |