 ;;     On your backend server, verify that the code is valid and exchange it for a long-lived token, which is stored in your database and sent back to be stored on the client device as well.
 ;;     The user is now logged in, and doesn’t have to repeat this process again until their token expires or they want to authenticate on a new device.
 
-(defn- meta-published [pub-ch store trusted-hosts sessions [new-in out]]
+(defn- meta-published
+  "Checks wether the user has a running session, the host is trusted und verifies credentials if the user ist not authenticated"
+  [pub-ch store trusted-hosts sessions credential-fn [new-in out]]
   (go-loop [{:keys [metas topic] :as p} (<! pub-ch)]
     (when (= topic :meta-pub)
      (let [nc (<! (new-commits! store metas))]

  [meta]
  (set (keys (:causal-order meta))))

(defn- new-commits! [store metas]
  (go (->> (for [[user repos] metas
                 [repo meta] repos]
             (go {:new meta

      (recur (<! auth-req-ch)))))


(defn- in-dispatch
  "Dispatches incoming requests"
  [{:keys [topic]}]
  (case topic
    :meta-pub :meta-pub
    ::auth-required ::auth-required
    ::auth :meta-pub
    :unrelated))


