Read server keys from files or create if absent (#79)

* move server keys to config

* add server keys from files

* create server keys if key files do not exist

* validate loaded server key pair

* refactor fromString functions

* key files in /etc/opt/simplex
This commit is contained in:
Evgeny Poberezkin
2021-04-07 22:59:57 +01:00
committed by GitHub
parent 0fbf406800
commit ad73298936
6 changed files with 110 additions and 46 deletions
+1 -1
View File
@@ -60,7 +60,7 @@ runSMPServer cfg@ServerConfig {tcpPort} = do
runClient :: (MonadUnliftIO m, MonadReader Env m) => Handle -> m ()
runClient h = do
keyPair <- asks serverKeyPair
keyPair <- asks $ serverKeyPair . config
liftIO (runExceptT $ serverHandshake h keyPair) >>= \case
Right th -> runClientTransport th
Left _ -> pure ()