 (defn build-initiate-interior
   "This is the 368+M cryptographic box that's the real payload/Vouch+message portion of the Initiate pack"
   [{log-state ::log/state
+    inner-nonce-suffix ::specs/inner-i-nonce
+    :keys [::shared/work-area]
     :as this} msg outer-nonce-suffix]
   ;; Important detail: we can use up to 640 bytes that we've
   ;; received from the client/child.
   (let [msg-length (count msg)
         _ (assert (< 0 msg-length))
         tmplt (assoc-in K/vouch-wrapper [::K/child-message ::K/length] msg-length)
-        srvr-name (get-in this [::shared/my-keys ::specs/srvr-name])
-        _ (assert srvr-name)
-        inner-nonce-suffix (::state/inner-i-nonce this)
-        ^TweetNaclFast$Box$KeyPair long-pair (get-in this [::shared/my-keys ::shared/long-pair])
-        src {::K/client-long-term-key (.getPublicKey long-pair)
-             ::K/inner-i-nonce inner-nonce-suffix
-             ::K/inner-vouch (::state/vouch this)
-             ::specs/srvr-name srvr-name
-             ::K/child-message msg}
-        work-area (::shared/work-area this)
-        secret (get-in this [::state/shared-secrets ::state/client-short<->server-short])
-        log-state (log/info log-state
-                            ::build-initiate-interior
-                            "Encrypting\nFIXME: Do not log the shared secret!"
-                            {::source src
-                             ::inner-nonce-suffix (b-t/->string inner-nonce-suffix)
-                             ::shared-secret (b-t/->string secret)})]
-    {::crypto-box (crypto/build-crypto-box tmplt
-                                           src
-                                           (::shared/text work-area)
-                                           secret
-                                           K/initiate-nonce-prefix
-                                           outer-nonce-suffix)
-     ::log/state log-state}))
+        ;; This is actually ::K/server-name.
+        ;; Which doesn't make any sense, since it isn't a constant.
+        ;; FIXME: Make it sensible.
+        srvr-name (get-in this [::shared/my-keys ::specs/srvr-name])]
+    (if srvr-name
+      (let [^TweetNaclFast$Box$KeyPair long-pair (get-in this [::shared/my-keys ::shared/long-pair])
+            src {::K/client-long-term-key (.getPublicKey long-pair)
+                 ::specs/inner-i-nonce inner-nonce-suffix
+                 ::K/inner-vouch (::specs/vouch this)
+                 ::specs/srvr-name srvr-name
+                 ::K/child-message msg}
+            secret (get-in this [::state/shared-secrets ::state/client-short<->server-short])
+            log-state (log/info log-state
+                                ::build-initiate-interior
+                                "Encrypting\nFIXME: Do not log the shared secret!"
+                                {::source src
+                                 ::inner-nonce-suffix (b-t/->string inner-nonce-suffix)
+                                 ::shared-secret (b-t/->string secret)})]
+        {::crypto-box (crypto/build-crypto-box tmplt
+                                               src
+                                               (::shared/text work-area)
+                                               secret
+                                               K/initiate-nonce-prefix
+                                               outer-nonce-suffix)
+         ::log/state log-state})
+      {::log/state (log/warn log-state
+                             ::build-initiate-interior
+                             "Missing server name"
+                             (select-keys this [::shared/my-keys]))})))
 
 (s/fdef build-initiate-packet!
         :args (s/cat :this ::state/state
-                     :msg-bytes (s/and bytes?
+                     :msg-bytes (s/and ::specs/msg-bytes
                                        ;; Just be explicit about the
                                        ;; the legal incoming length.
                                        ;; This is mostly for the sake of

                                       "(FIXME: Don't log the shared secret)")
                                  {::shared/working-nonce (b-t/->string working-nonce)
                                   ::state/shared-secret (b-t/->string shared-secret)
                                   ::state/vouch (b-t/->string vouch)})]
            (b-t/byte-copy! vouch
                            0
                            (+ K/box-zero-bytes K/key-length)
                            encrypted)
            {::K/inner-i-nonce nonce-suffix
             ::log/state log-state
             ::state/vouch vouch})
          (throw (ex-info "Missing long-term shared keys"
                          {::problem shared-secrets}))))
      (assert false (str "Missing nonce in packet-management:\n"
                         (keys packet-management))))))

(s/fdef build-vouch
        :args (s/cat :this ::state/state
                     :message bytes?)
        :ret (s/keys :req [::state/state ::vouch]))
(defn build-vouch
  [this
   ^bytes message]
  (let [{log-state ::log/state
         :keys [::K/inner-i-nonce ::state/vouch]
         :as this} (build-inner-vouch this)]
    (throw (RuntimeException. "Need to build/return the rest of the nonce"))))

(s/fdef cookie->vouch
        :args (s/cat :this ::state/state
                     :packet ::shared/network-packet)
        :ret ::state/state)
(defn cookie->vouch
  "Got a cookie from the server.

  Replace those bytes

      ;; It kind-of made sense with the original approach, which involved
      ;; locking down strict access from a single thread, using an agent.
      ;; Note that this approach is worse than I thought at first glance:
      ;; I'm really just reusing the last-used nonce (which, in theory,
      ;; should be the one sent by the server for its cookie).
      ;; That seems wrong all around. After all, the client can send Initiate
      ;; packets any time it likes.
      ;; c.f. lines 329-334 in the reference spec.
      (let [working-nonce (byte-array K/nonce-length)
            ;; Just reuse a subset of whatever the server sent us.
            ;; Legal because a) it uses a different prefix and b) it's a different number anyway
