From b5b1709c249f9b1b7b1bf89f31b8ebbc8e3548d6 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin Date: Sat, 10 Feb 2024 12:13:05 +0000 Subject: [PATCH] rename version --- src/Simplex/Messaging/Client.hs | 2 +- src/Simplex/Messaging/Notifications/Transport.hs | 6 +++--- src/Simplex/Messaging/Transport.hs | 8 ++++---- tests/CoreTests/BatchingTests.hs | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Simplex/Messaging/Client.hs b/src/Simplex/Messaging/Client.hs index 0d1eb5f7b..70e1f512b 100644 --- a/src/Simplex/Messaging/Client.hs +++ b/src/Simplex/Messaging/Client.hs @@ -155,7 +155,7 @@ clientStub sessionId thVersion thAuth = do thVersion, thAuth, blockSize = smpBlockSize, - encrypt = thVersion >= encryptTransmissionSMPVersion, + encrypt = thVersion >= dontSendSessionIdSMPVersion, batch = True }, sessionTs = undefined, diff --git a/src/Simplex/Messaging/Notifications/Transport.hs b/src/Simplex/Messaging/Notifications/Transport.hs index 780edd811..c3289d177 100644 --- a/src/Simplex/Messaging/Notifications/Transport.hs +++ b/src/Simplex/Messaging/Notifications/Transport.hs @@ -18,8 +18,8 @@ import Simplex.Messaging.Version ntfBlockSize :: Int ntfBlockSize = 512 -encryptTransmissionNTFVersion :: Version -encryptTransmissionNTFVersion = 2 +dontSendSessionIdNTFVersion :: Version +dontSendSessionIdNTFVersion = 2 authEncryptCmdsNTFVersion :: Version authEncryptCmdsNTFVersion = 3 @@ -108,7 +108,7 @@ ntfThHandle :: forall c. THandle c -> Version -> C.PrivateKeyX25519 -> Maybe C.P ntfThHandle th@THandle {params} v pk k_ = -- TODO drop SMP v6: make thAuth non-optional let thAuth = (\k -> THandleAuth {peerPubKey = k, privKey = pk, dhSecret = C.dh' k pk}) <$> k_ - params' = params {thVersion = v, thAuth, encrypt = v >= encryptTransmissionNTFVersion} + params' = params {thVersion = v, thAuth, encrypt = v >= dontSendSessionIdNTFVersion} in (th :: THandle c) {params = params'} ntfTHandle :: Transport c => c -> THandle c diff --git a/src/Simplex/Messaging/Transport.hs b/src/Simplex/Messaging/Transport.hs index 4ae363313..1fe00a253 100644 --- a/src/Simplex/Messaging/Transport.hs +++ b/src/Simplex/Messaging/Transport.hs @@ -33,7 +33,7 @@ module Simplex.Messaging.Transport currentServerSMPRelayVersion, basicAuthSMPVersion, subModeSMPVersion, - encryptTransmissionSMPVersion, + dontSendSessionIdSMPVersion, authEncryptCmdsSMPVersion, simplexMQVersion, smpBlockSize, @@ -122,8 +122,8 @@ basicAuthSMPVersion = 5 subModeSMPVersion :: Version subModeSMPVersion = 6 -encryptTransmissionSMPVersion :: Version -encryptTransmissionSMPVersion = 7 +dontSendSessionIdSMPVersion :: Version +dontSendSessionIdSMPVersion = 7 authEncryptCmdsSMPVersion :: Version authEncryptCmdsSMPVersion = 8 @@ -440,7 +440,7 @@ smpThHandle :: forall c. THandle c -> Version -> C.PrivateKeyX25519 -> Maybe C.P smpThHandle th@THandle {params} v pk k_ = -- TODO drop SMP v6: make thAuth non-optional let thAuth = (\k -> THandleAuth {peerPubKey = k, privKey = pk, dhSecret = C.dh' k pk}) <$> k_ - params' = params {thVersion = v, thAuth, encrypt = v >= encryptTransmissionSMPVersion, batch = v >= batchCmdsSMPVersion} + params' = params {thVersion = v, thAuth, encrypt = v >= dontSendSessionIdSMPVersion, batch = v >= batchCmdsSMPVersion} in (th :: THandle c) {params = params'} sendHandshake :: (Transport c, Encoding smp) => THandle c -> smp -> ExceptT TransportError IO () diff --git a/tests/CoreTests/BatchingTests.hs b/tests/CoreTests/BatchingTests.hs index be4928672..83787bb90 100644 --- a/tests/CoreTests/BatchingTests.hs +++ b/tests/CoreTests/BatchingTests.hs @@ -319,7 +319,7 @@ testTHandleParams v sessionId = blockSize = smpBlockSize, thVersion = v, thAuth = Nothing, - encrypt = v >= encryptTransmissionSMPVersion, + encrypt = v >= dontSendSessionIdSMPVersion, batch = True }