additional lazy crypto for XRCP (#890)

This commit is contained in:
Evgeny Poberezkin
2023-11-10 11:16:43 +00:00
committed by GitHub
parent bd06b47a9d
commit 6a2e6b040e
6 changed files with 78 additions and 11 deletions
+5 -1
View File
@@ -74,6 +74,7 @@ module Simplex.Messaging.Agent.Client
removeSubscription,
hasActiveSubscription,
agentClientStore,
agentDRG,
getAgentSubscriptions,
SubscriptionsInfo (..),
SubInfo (..),
@@ -117,7 +118,7 @@ import Control.Monad
import Control.Monad.Except
import Control.Monad.IO.Unlift
import Control.Monad.Reader
import Crypto.Random (getRandomBytes)
import Crypto.Random (ChaChaDRG, getRandomBytes)
import qualified Data.Aeson.TH as J
import Data.Bifunctor (bimap, first, second)
import Data.ByteString.Base64
@@ -380,6 +381,9 @@ newAgentClient InitialAgentServers {smp, ntf, xftp, netCfg} agentEnv = do
agentClientStore :: AgentClient -> SQLiteStore
agentClientStore AgentClient {agentEnv = Env {store}} = store
agentDRG :: AgentClient -> TVar ChaChaDRG
agentDRG AgentClient {agentEnv = Env {random}} = random
class (Encoding err, Show err) => ProtocolServerClient err msg | msg -> err where
type Client msg = c | c -> msg
getProtocolServerClient :: AgentMonad m => AgentClient -> TransportSession msg -> m (Client msg)