box_ :: Maybe Chain
     -> KeyPair
     -> Maybe KeyPair          -- ^ Sender keys
     -> PublicKey Noise   -- ^ Receiver public key
     -> Word32                 -- ^ Padding length
     -> ByteString             -- ^ Plaintext
     -> IO (ByteString, Chain)
box_ chain eph sender recvPK pad plaintext = do
  (Box hdr ct, chainOut) <- boxInternal chain eph sender recvPK pad plaintext
  let
    (Header (PublicKey hdrPK) hdrESPK (Poly1305.Auth hdrMAC)) = hdr
    (Ciphertext ct' (Poly1305.Auth ctMAC)) = ct
    result = hdrPK
          <> hdrESPK
          <> hdrMAC
          <> ct'
          <> ctMAC
  return (result, chainOut)
box_ :: Maybe Chain
     -> KeyPair
     -> Maybe KeyPair          -- ^ Sender keys
     -> PublicKey Noise   -- ^ Receiver public key
     -> Word32                 -- ^ Padding length
     -> ByteString             -- ^ Plaintext
     -> IO (ByteString, Chain)
box_ chain eph sender recvPK pad plaintext = do
  (Box hdr ct, chainOut) <- boxInternal chain eph sender recvPK pad plaintext
  let
    (Header (PublicKey hdrPK) hdrESPK (Poly1305.Auth hdrMAC)) = hdr
    (Ciphertext ct' (Poly1305.Auth ctMAC)) = ct
    result = hdrPK
          <> hdrESPK
          <> hdrMAC
          <> ct'
          <> ctMAC
  return (result, chainOut)
box_ chain eph sender recvPK pad plaintext = do
  (Box hdr ct, chainOut) <- boxInternal chain eph sender recvPK pad plaintext
  let
    (Header (PublicKey hdrPK) hdrESPK (Poly1305.Auth hdrMAC)) = hdr
    (Ciphertext ct' (Poly1305.Auth ctMAC)) = ct
    result = hdrPK
          <> hdrESPK
          <> hdrMAC
          <> ct'
          <> ctMAC
  return (result, chainOut)