 (ns com.frereth.common.curve.server
   "Implement the server half of the CurveCP protocol"
-  (:require [byte-streams :as bs]
+  (:require [byte-streams :as b-s]
             [clojure.spec :as s]
             ;; TODO: Really need millisecond precision (at least)
             ;; associated with this log formatter

          ;; failure on my part
          (b-t/byte-copy! (get-in state [::current-client ::shared/extension])
                             extension)
          (let [packet-type-id (char (aget header (dec shared/header-length)))]
            (try
              (case packet-type-id
                \H (handle-hello! state packet)

      (let [msg (str "Trying to open "
                     K/hello-crypto-box-length
                     " bytes of\n"
                     (with-out-str (b-s/print-bytes (b-t/sub-byte-array text 0 (+ 32 K/hello-crypto-box-length))))
                     "\nusing nonce\n"
                     (with-out-str (b-s/print-bytes working-nonce))
                     "\nencrypted from\n"
                     (with-out-str (b-s/print-bytes client-short-pk))
                     "\nto\n"
                     (with-out-str (b-s/print-bytes (.getPublicKey long-keys)))
                     "\nwhich generated shared secret\n"
                     (with-out-str (b-s/print-bytes shared-secret)))]
        (log/info msg))
      {::opened (crypto/open-after
                 text
