diff options
author | joe <joe@jerkface.net> | 2017-09-15 20:18:32 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2017-09-15 20:18:32 -0400 |
commit | bc0b119f7ec7ef7aa2d4faa9879633a7926bd2a6 (patch) | |
tree | b6d55ba06f5490d73469cfe26492d260af27fb2e /src/Network/Tox | |
parent | 4eba2c53f7a2bb9c6694fdfacd057516e8710174 (diff) |
Exempt DataToRoute requests from decryption.
Diffstat (limited to 'src/Network/Tox')
-rw-r--r-- | src/Network/Tox/Onion/Transport.hs | 12 |
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 | |||
79 | data OnionMessage (f :: * -> *) | 79 | data 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 | ||
85 | deriving instance ( Show (f (AnnounceRequest, Nonce8)) | 85 | deriving 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 | ||
558 | sequenceMessage :: Applicative m => OnionMessage (m ∘ f) -> m (OnionMessage f) | 558 | sequenceMessage :: Applicative m => OnionMessage (m ∘ f) -> m (OnionMessage f) |
559 | sequenceMessage (OnionAnnounce a) = fmap OnionAnnounce $ sequenceA $ fmap uncomposed a | 559 | sequenceMessage (OnionAnnounce a) = fmap OnionAnnounce $ sequenceA $ fmap uncomposed a |
560 | sequenceMessage (OnionToRoute pub a) = fmap (OnionToRoute pub) $ sequenceA $ fmap uncomposed a | ||
561 | sequenceMessage (OnionToRouteResponse a) = fmap OnionToRouteResponse $ sequenceA $ fmap uncomposed a | ||
562 | sequenceMessage (OnionAnnounceResponse n8 n24 dta) = OnionAnnounceResponse n8 n24 <$> uncomposed dta | 560 | sequenceMessage (OnionAnnounceResponse n8 n24 dta) = OnionAnnounceResponse n8 n24 <$> uncomposed dta |
561 | sequenceMessage (OnionToRoute pub a) = pure $ OnionToRoute pub a | ||
562 | sequenceMessage (OnionToRouteResponse a) = pure $ OnionToRouteResponse a | ||
563 | 563 | ||
564 | transcode :: forall f g. (forall a. Serialize a => Nonce24 -> Either (f a) (Assym (f a)) -> g a) -> OnionMessage f -> OnionMessage g | 564 | transcode :: forall f g. (forall a. Serialize a => Nonce24 -> Either (f a) (Assym (f a)) -> g a) -> OnionMessage f -> OnionMessage g |
565 | transcode f (OnionAnnounce a) = OnionAnnounce $ a { assymData = f (assymNonce a) (Right a) } | 565 | transcode f (OnionAnnounce a) = OnionAnnounce $ a { assymData = f (assymNonce a) (Right a) } |
566 | transcode f (OnionToRoute pub a) = OnionToRoute pub $ a { assymData = f (assymNonce a) (Right a) } | ||
567 | transcode f (OnionToRouteResponse a) = OnionToRouteResponse $ a { assymData = f (assymNonce a) (Right a) } | ||
568 | transcode f (OnionAnnounceResponse n8 n24 dta) = OnionAnnounceResponse n8 n24 $ f n24 $ Left dta | 566 | transcode f (OnionAnnounceResponse n8 n24 dta) = OnionAnnounceResponse n8 n24 $ f n24 $ Left dta |
567 | transcode f (OnionToRoute pub a) = OnionToRoute pub a | ||
568 | transcode f (OnionToRouteResponse a) = OnionToRouteResponse a | ||
569 | 569 | ||