remove v8, merge all changes to one version

This commit is contained in:
Evgeny Poberezkin
2024-02-13 18:28:15 +00:00
parent 93ae9c4a35
commit f21b4310ed
10 changed files with 107 additions and 127 deletions
+3 -3
View File
@@ -149,10 +149,10 @@ defaultAgentConfig :: AgentConfig
defaultAgentConfig =
AgentConfig
{ tcpPort = "5224",
-- while the current client version supports X25519, it can only be enabled once support for SMP v7 is dropped,
-- and all servers are required to support v8 to be compatible.
-- while the current client version supports X25519, it can only be enabled once support for SMP v6 is dropped,
-- and all servers are required to support v7 to be compatible.
rcvAuthAlg = C.AuthAlg C.SEd25519, -- this will stay as Ed25519
sndAuthAlg = C.AuthAlg C.SEd25519, -- TODO replace with X25519 when switching to v8
sndAuthAlg = C.AuthAlg C.SEd25519, -- TODO replace with X25519 when switching to v7
connIdBytes = 12,
tbqSize = 64,
smpCfg = defaultSMPClientConfig {defaultTransport = (show defaultSMPPort, transport @TLS)},
+1 -1
View File
@@ -155,7 +155,7 @@ clientStub g sessionId thVersion thAuth = do
thVersion,
thAuth,
blockSize = smpBlockSize,
encrypt = thVersion >= dontSendSessionIdSMPVersion,
encrypt = thVersion >= authEncryptCmdsSMPVersion,
batch = True
},
sessionTs = undefined,
@@ -22,17 +22,14 @@ import Simplex.Messaging.Util (liftEitherWith)
ntfBlockSize :: Int
ntfBlockSize = 512
dontSendSessionIdNTFVersion :: Version
dontSendSessionIdNTFVersion = 2
authEncryptCmdsNTFVersion :: Version
authEncryptCmdsNTFVersion = 3
authEncryptCmdsNTFVersion = 2
currentClientNTFVersion :: Version
currentClientNTFVersion = 2
currentClientNTFVersion = 1
currentServerNTFVersion :: Version
currentServerNTFVersion = 2
currentServerNTFVersion = 1
supportedClientNTFVRange :: VersionRange
supportedClientNTFVRange = mkVersionRange 1 currentClientNTFVersion
@@ -129,7 +126,7 @@ ntfThHandle :: forall c. THandle c -> Version -> C.PrivateKeyX25519 -> Maybe C.P
ntfThHandle th@THandle {params} v privKey k_ =
-- TODO drop SMP v6: make thAuth non-optional
let thAuth = (\k -> THandleAuth {peerPubKey = k, privKey}) <$> k_
params' = params {thVersion = v, thAuth, encrypt = v >= dontSendSessionIdNTFVersion}
params' = params {thVersion = v, thAuth, encrypt = v >= authEncryptCmdsNTFVersion}
in (th :: THandle c) {params = params'}
ntfTHandle :: Transport c => c -> THandle c
+4 -8
View File
@@ -33,7 +33,6 @@ module Simplex.Messaging.Transport
currentServerSMPRelayVersion,
basicAuthSMPVersion,
subModeSMPVersion,
dontSendSessionIdSMPVersion,
authEncryptCmdsSMPVersion,
simplexMQVersion,
smpBlockSize,
@@ -126,17 +125,14 @@ basicAuthSMPVersion = 5
subModeSMPVersion :: Version
subModeSMPVersion = 6
dontSendSessionIdSMPVersion :: Version
dontSendSessionIdSMPVersion = 7
authEncryptCmdsSMPVersion :: Version
authEncryptCmdsSMPVersion = 8
authEncryptCmdsSMPVersion = 7
currentClientSMPRelayVersion :: Version
currentClientSMPRelayVersion = 7
currentClientSMPRelayVersion = 6
currentServerSMPRelayVersion :: Version
currentServerSMPRelayVersion = 7
currentServerSMPRelayVersion = 6
-- minimal supported protocol version is 4
-- TODO remove code that supports sending commands without batching
@@ -474,7 +470,7 @@ smpThHandle :: forall c. THandle c -> Version -> C.PrivateKeyX25519 -> Maybe C.P
smpThHandle th@THandle {params} v privKey k_ =
-- TODO drop SMP v6: make thAuth non-optional
let thAuth = (\k -> THandleAuth {peerPubKey = k, privKey}) <$> k_
params' = params {thVersion = v, thAuth, encrypt = v >= dontSendSessionIdSMPVersion, batch = v >= batchCmdsSMPVersion}
params' = params {thVersion = v, thAuth, encrypt = v >= authEncryptCmdsSMPVersion, batch = v >= batchCmdsSMPVersion}
in (th :: THandle c) {params = params'}
sendHandshake :: (Transport c, Encoding smp) => THandle c -> smp -> ExceptT TransportError IO ()