summaryrefslogtreecommitdiff
path: root/src/Network/Tox/Onion
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2017-09-15 20:18:32 -0400
committerjoe <joe@jerkface.net>2017-09-15 20:18:32 -0400
commitbc0b119f7ec7ef7aa2d4faa9879633a7926bd2a6 (patch)
treeb6d55ba06f5490d73469cfe26492d260af27fb2e /src/Network/Tox/Onion
parent4eba2c53f7a2bb9c6694fdfacd057516e8710174 (diff)
Exempt DataToRoute requests from decryption.
Diffstat (limited to 'src/Network/Tox/Onion')
-rw-r--r--src/Network/Tox/Onion/Transport.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Network/Tox/Onion/Transport.hs b/src/Network/Tox/Onion/Transport.hs
index f3727fad..8c4df694 100644
--- a/src/Network/Tox/Onion/Transport.hs
+++ b/src/Network/Tox/Onion/Transport.hs
@@ -79,8 +79,8 @@ putOnionAssym typ p a = put typ >> p >> putAliasedAssym a
79data OnionMessage (f :: * -> *) 79data OnionMessage (f :: * -> *)
80 = OnionAnnounce (Assym (f (AnnounceRequest,Nonce8))) 80 = OnionAnnounce (Assym (f (AnnounceRequest,Nonce8)))
81 | OnionAnnounceResponse Nonce8 Nonce24 (f AnnounceResponse) 81 | OnionAnnounceResponse Nonce8 Nonce24 (f AnnounceResponse)
82 | OnionToRoute PublicKey (Assym (f DataToRoute)) -- destination key, aliased Assym 82 | OnionToRoute PublicKey (Assym (Encrypted DataToRoute)) -- destination key, aliased Assym
83 | OnionToRouteResponse (Assym (f DataToRoute)) 83 | OnionToRouteResponse (Assym (Encrypted DataToRoute))
84 84
85deriving instance ( Show (f (AnnounceRequest, Nonce8)) 85deriving instance ( Show (f (AnnounceRequest, Nonce8))
86 , Show (f AnnounceResponse) 86 , Show (f AnnounceResponse)
@@ -557,13 +557,13 @@ decryptMessage crypto n (Left e) = _todo -- OnionAnnounceResponse has no sender
557 557
558sequenceMessage :: Applicative m => OnionMessage (m ∘ f) -> m (OnionMessage f) 558sequenceMessage :: Applicative m => OnionMessage (m ∘ f) -> m (OnionMessage f)
559sequenceMessage (OnionAnnounce a) = fmap OnionAnnounce $ sequenceA $ fmap uncomposed a 559sequenceMessage (OnionAnnounce a) = fmap OnionAnnounce $ sequenceA $ fmap uncomposed a
560sequenceMessage (OnionToRoute pub a) = fmap (OnionToRoute pub) $ sequenceA $ fmap uncomposed a
561sequenceMessage (OnionToRouteResponse a) = fmap OnionToRouteResponse $ sequenceA $ fmap uncomposed a
562sequenceMessage (OnionAnnounceResponse n8 n24 dta) = OnionAnnounceResponse n8 n24 <$> uncomposed dta 560sequenceMessage (OnionAnnounceResponse n8 n24 dta) = OnionAnnounceResponse n8 n24 <$> uncomposed dta
561sequenceMessage (OnionToRoute pub a) = pure $ OnionToRoute pub a
562sequenceMessage (OnionToRouteResponse a) = pure $ OnionToRouteResponse a
563 563
564transcode :: forall f g. (forall a. Serialize a => Nonce24 -> Either (f a) (Assym (f a)) -> g a) -> OnionMessage f -> OnionMessage g 564transcode :: forall f g. (forall a. Serialize a => Nonce24 -> Either (f a) (Assym (f a)) -> g a) -> OnionMessage f -> OnionMessage g
565transcode f (OnionAnnounce a) = OnionAnnounce $ a { assymData = f (assymNonce a) (Right a) } 565transcode f (OnionAnnounce a) = OnionAnnounce $ a { assymData = f (assymNonce a) (Right a) }
566transcode f (OnionToRoute pub a) = OnionToRoute pub $ a { assymData = f (assymNonce a) (Right a) }
567transcode f (OnionToRouteResponse a) = OnionToRouteResponse $ a { assymData = f (assymNonce a) (Right a) }
568transcode f (OnionAnnounceResponse n8 n24 dta) = OnionAnnounceResponse n8 n24 $ f n24 $ Left dta 566transcode f (OnionAnnounceResponse n8 n24 dta) = OnionAnnounceResponse n8 n24 $ f n24 $ Left dta
567transcode f (OnionToRoute pub a) = OnionToRoute pub a
568transcode f (OnionToRouteResponse a) = OnionToRouteResponse a
569 569