From cbdcc6500d6bda9948268312fc0bfb17955e53c5 Mon Sep 17 00:00:00 2001 From: joe Date: Sat, 21 Oct 2017 21:35:37 -0400 Subject: Now searches using store command when we own the key. This gives us a usable token for storing when the search is complete. --- src/Network/Tox/Onion/Transport.hs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/Network/Tox/Onion/Transport.hs') diff --git a/src/Network/Tox/Onion/Transport.hs b/src/Network/Tox/Onion/Transport.hs index e52c8faa..82f2c8a7 100644 --- a/src/Network/Tox/Onion/Transport.hs +++ b/src/Network/Tox/Onion/Transport.hs @@ -101,8 +101,8 @@ msgNonce (OnionAnnounceResponse _ n24 _) = n24 msgNonce (OnionToRoute _ a) = assymNonce a msgNonce (OnionToRouteResponse a) = assymNonce a -data AliasSelector = SearchingAlias | AnnouncingAlias NodeId - deriving (Eq,Ord,Show) +data AliasSelector = SearchingAlias | AnnouncingAlias SecretKey PublicKey + deriving (Eq,Show) data OnionDestination r = OnionToOwner @@ -611,12 +611,8 @@ instance Sized OnionData where selectKey :: TransportCrypto -> OnionMessage f -> OnionDestination r -> IO (SecretKey, PublicKey) -selectKey crypto _ rpath@(OnionDestination (AnnouncingAlias pkey) _ _) - = atomically $ do ks <- filter (\(sk,pk) -> pk == id2key pkey) - <$> readTVar (userKeys crypto) - maybe (return $ aliasKey crypto rpath) - return - (listToMaybe ks) +selectKey crypto _ rpath@(OnionDestination (AnnouncingAlias skey pkey) _ _) + = return (skey, pkey) selectKey crypto msg rpath = return $ aliasKey crypto rpath encrypt :: TransportCrypto -> OnionMessage Identity -> OnionDestination r -> IO (OnionMessage Encrypted, OnionDestination r) -- cgit v1.2.3