From bc0b119f7ec7ef7aa2d4faa9879633a7926bd2a6 Mon Sep 17 00:00:00 2001 From: joe Date: Fri, 15 Sep 2017 20:18:32 -0400 Subject: Exempt DataToRoute requests from decryption. --- src/Network/Tox/Onion/Transport.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/Network') 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 data OnionMessage (f :: * -> *) = OnionAnnounce (Assym (f (AnnounceRequest,Nonce8))) | OnionAnnounceResponse Nonce8 Nonce24 (f AnnounceResponse) - | OnionToRoute PublicKey (Assym (f DataToRoute)) -- destination key, aliased Assym - | OnionToRouteResponse (Assym (f DataToRoute)) + | OnionToRoute PublicKey (Assym (Encrypted DataToRoute)) -- destination key, aliased Assym + | OnionToRouteResponse (Assym (Encrypted DataToRoute)) deriving instance ( Show (f (AnnounceRequest, Nonce8)) , Show (f AnnounceResponse) @@ -557,13 +557,13 @@ decryptMessage crypto n (Left e) = _todo -- OnionAnnounceResponse has no sender sequenceMessage :: Applicative m => OnionMessage (m ∘ f) -> m (OnionMessage f) sequenceMessage (OnionAnnounce a) = fmap OnionAnnounce $ sequenceA $ fmap uncomposed a -sequenceMessage (OnionToRoute pub a) = fmap (OnionToRoute pub) $ sequenceA $ fmap uncomposed a -sequenceMessage (OnionToRouteResponse a) = fmap OnionToRouteResponse $ sequenceA $ fmap uncomposed a sequenceMessage (OnionAnnounceResponse n8 n24 dta) = OnionAnnounceResponse n8 n24 <$> uncomposed dta +sequenceMessage (OnionToRoute pub a) = pure $ OnionToRoute pub a +sequenceMessage (OnionToRouteResponse a) = pure $ OnionToRouteResponse a transcode :: forall f g. (forall a. Serialize a => Nonce24 -> Either (f a) (Assym (f a)) -> g a) -> OnionMessage f -> OnionMessage g transcode f (OnionAnnounce a) = OnionAnnounce $ a { assymData = f (assymNonce a) (Right a) } -transcode f (OnionToRoute pub a) = OnionToRoute pub $ a { assymData = f (assymNonce a) (Right a) } -transcode f (OnionToRouteResponse a) = OnionToRouteResponse $ a { assymData = f (assymNonce a) (Right a) } transcode f (OnionAnnounceResponse n8 n24 dta) = OnionAnnounceResponse n8 n24 $ f n24 $ Left dta +transcode f (OnionToRoute pub a) = OnionToRoute pub a +transcode f (OnionToRouteResponse a) = OnionToRouteResponse a -- cgit v1.2.3