class Attio::Util::WebhookSignature

def verify_timestamp!(timestamp, tolerance)

def verify_timestamp!(timestamp, tolerance)
  timestamp_int = timestamp.to_i
  current_time = Time.now.to_i
  if timestamp_int < (current_time - tolerance)
    raise SignatureVerificationError, "Timestamp too old"
  end
  if timestamp_int > (current_time + tolerance)
    raise SignatureVerificationError, "Timestamp too far in the future"
  end
end