Class: Mach::Validation::TimestampValidator
- Inherits:
-
Object
- Object
- Mach::Validation::TimestampValidator
- Defined in:
- lib/mach/validation/timestamp_validator.rb
Class Method Summary collapse
Class Method Details
.valid?(hmac_request) ⇒ Boolean
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/mach/validation/timestamp_validator.rb', line 8 def valid?(hmac_request) = Mach::Timestamp.now.to_i = hmac_request..to_i delta = Mach::Delta.present_for(hmac_request.mac_id) #do we have a delta for this client unless delta delta = Mach::Delta.create(hmac_request.mac_id, , ) end #make sure the client timestamp is not older than what we're willing to accept - ( + delta.to_i) < Mach.configuration.stale_request_window end |