def check_that_request_is_timely(raw_body)
      request_json = JSON.parse(raw_body)

      raise AlexaVerifier::InvalidRequestError, 'Timestamp field not present in request' if request_json.fetch('request', {}).fetch('timestamp', nil).nil?

      request_is_timely = (Time.parse(request_json['request']['timestamp'].to_s) >= (Time.now - REQUEST_THRESHOLD))
      raise AlexaVerifier::InvalidRequestError, "Request is from more than #{REQUEST_THRESHOLD} seconds ago" unless request_is_timely
    end
def check_that_request_is_timely(raw_body)
      request_json = JSON.parse(raw_body)

      raise AlexaVerifier::InvalidRequestError, 'Timestamp field not present in request' if request_json.fetch('request', {}).fetch('timestamp', nil).nil?

      request_is_timely = (Time.parse(request_json['request']['timestamp'].to_s) >= (Time.now - REQUEST_THRESHOLD))
      raise AlexaVerifier::InvalidRequestError, "Request is from more than #{REQUEST_THRESHOLD} seconds ago" unless request_is_timely
    end
Prevent replays of requests by checking that they are timely.

 @param [String] raw_body the raw body of our https request
 @raise [AlexaVerifier::InvalidRequestError] raised when the timestamp is not timely, or is not set