          handler (create-http-kit-handler! "ws://127.0.0.1:9090/")
          ;; remote server to sync to
          remote-store (<!! (new-mem-store))
-         local-users {"john" "haskell" "jane" "lisp"}
-         input-users {"john" "haskell" "jane" "lisp"}
-         auth-fn (fn [users] (go (into {} (filter #(users (key %)) input-users ))))
-         cred-fn (fn [token] (if (= (:password token) (get local-users (:username token))) true nil))
          _ (def remote-peer (server-peer handler remote-store (comp (partial logger log-atom :remote-core)
                                                                     (partial fetch remote-store)
                                                                     (partial publish-on-request remote-store))))

                                   :branches {"master" #{2}}
                                   :schema {:type :geschichte
                                            :version 1}}}}})
     ;; auth required
     (<!! in) => {:topic :geschichte.p2p.auth/auth-required, :users #{"john"},:tries-left 5}
     ;; send some credentials
     (>!! out {:topic :geschichte.p2p.auth/auth :users {"john" "häßkl"}})
     ;; ups
     (<!! in) => {:topic :geschichte.p2p.auth/auth-required, :users #{"john"},:tries-left 4}
     ;; let's try again
     (>!! out {:topic :geschichte.p2p.auth/auth :users {"john" "häskl"}})
     ;; wrong, how could that be?
     (<!! in) => {:topic :geschichte.p2p.auth/auth-required, :users #{"john"},:tries-left 3}
     ;; oh my, next try
     (>!! out {:topic :geschichte.p2p.auth/auth :users {"john" "häskel"}})
     ;; wrong again
     (<!! in) => {:topic :geschichte.p2p.auth/auth-required, :users #{"john"},:tries-left 2}
     ;; it's getting close
     (>!! out {:topic :geschichte.p2p.auth/auth :users {"john" "häsckl"}})
     ;; doh, wrong again
     (<!! in) => {:topic :geschichte.p2p.auth/auth-required, :users #{"john"},:tries-left 1}
     ;; last try
     (>!! out {:topic :geschichte.p2p.auth/auth :users {"john" "häskil"}})
     ;; oh no, epic fail
     (<!! in) => {:topic :geschichte.p2p.auth/auth-failed, :users #{"john"}}
     ;; let's try again
     (>!! out {:topic :meta-pub,
               :peer "STAGE",
               :metas {"john" {42 {:id 42
                                   :causal-order {1 []
                                                  2 [1]}
                                   :last-update (java.util.Date. 0)
                                   :description "Bookmark collection."
                                   :head "master"
                                   :branches {"master" #{2}}
                                   :schema {:type :geschichte
                                            :version 1}}}}})
     ;; auth required again
     (<!! in) => {:topic :geschichte.p2p.auth/auth-required, :users #{"john"},:tries-left 5}
     ;; this time with correct password
     (>!! out {:topic :geschichte.p2p.auth/auth :users {"john" "haskell"}})
     ;; authed
     (<!! in) => {:topic :geschichte.p2p.auth/authed, :users #{"john"}}
     ;; the peer replies with a request for missing commit values
     (<!! in) => {:topic :fetch,
                  :ids #{1 2}}

                                   :branches {"master" #{3}}
                                   :schema {:type :geschichte
                                            :version 1}}}}})
     ;; again a new commit value is needed
     (<!! in) => {:topic :fetch,
                  :ids #{3}}
