mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-05-24 08:05:25 +00:00
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:
committed by
GitHub
parent
83d085cadc
commit
4a73a7ecd4
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user