remove public header from all messages, fix envelope sizes (#251)

* fix envelope sizes

* only send sender DH pub key for per-queue E2E with confirmation message
This commit is contained in:
Evgeny Poberezkin
2022-01-03 14:33:30 +00:00
committed by GitHub
parent 83d085cadc
commit 4a73a7ecd4
10 changed files with 80 additions and 86 deletions
+9
View File
@@ -1,5 +1,6 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
@@ -66,6 +67,14 @@ instance Encoding ByteString where
smpEncode s = B.cons (w2c len) s where len = fromIntegral $ B.length s
smpP = A.take . fromIntegral . c2w =<< A.anyChar
instance Encoding a => Encoding (Maybe a) where
smpEncode s = maybe "\0" (("\1" <>) . smpEncode) s
smpP =
smpP >>= \case
'\0' -> pure Nothing
'\1' -> Just <$> smpP
_ -> fail "invalid Maybe tag"
newtype Tail = Tail {unTail :: ByteString}
instance Encoding Tail where