@@ -405,8 +405,8 @@ createConnection c nm userId enableNtfs checkNotices = withAgentEnv c .::. newCo
405405-- Caller provides root signing key pair and link entity ID.
406406-- Returns the created link and internal params.
407407-- The link address is fully determined at this point.
408- prepareConnectionLink :: AgentClient -> UserId -> C. KeyPairEd25519 -> ByteString -> Bool -> Maybe CRClientData -> AE (CreatedConnLink 'CMContact, PreparedLinkParams )
409- prepareConnectionLink c userId rootKey linkEntityId checkNotices = withAgentEnv c . prepareConnectionLink' c userId rootKey linkEntityId checkNotices
408+ prepareConnectionLink :: AgentClient -> UserId -> C. KeyPairEd25519 -> ByteString -> Bool -> Maybe CRClientData -> Maybe SMPServerWithAuth -> AE (CreatedConnLink 'CMContact, PreparedLinkParams )
409+ prepareConnectionLink c userId rootKey linkEntityId checkNotices clientData srv_ = withAgentEnv c $ prepareConnectionLink' c userId rootKey linkEntityId checkNotices clientData srv_
410410{-# INLINE prepareConnectionLink #-}
411411
412412-- | Create connection for prepared link (single network call).
@@ -925,10 +925,10 @@ newConn c nm userId enableNtfs checkNotices cMode linkData_ clientData pqInitKey
925925
926926-- | Prepare connection link for contact mode (no network, no database).
927927-- Caller provides root signing key pair and link entity ID.
928- prepareConnectionLink' :: AgentClient -> UserId -> C. KeyPairEd25519 -> ByteString -> Bool -> Maybe CRClientData -> AM (CreatedConnLink 'CMContact, PreparedLinkParams )
929- prepareConnectionLink' c userId rootKey@ (_, plpRootPrivKey) linkEntityId checkNotices clientData = do
928+ prepareConnectionLink' :: AgentClient -> UserId -> C. KeyPairEd25519 -> ByteString -> Bool -> Maybe CRClientData -> Maybe SMPServerWithAuth -> AM (CreatedConnLink 'CMContact, PreparedLinkParams )
929+ prepareConnectionLink' c userId rootKey@ (_, plpRootPrivKey) linkEntityId checkNotices clientData srv_ = do
930930 g <- asks random
931- plpSrvWithAuth@ (ProtoServerWithAuth srv _) <- getSMPServer c userId
931+ plpSrvWithAuth@ (ProtoServerWithAuth srv _) <- maybe ( getSMPServer c userId) pure srv_
932932 when checkNotices $ checkClientNotices c plpSrvWithAuth
933933 AgentConfig {smpClientVRange, smpAgentVRange} <- asks config
934934 plpNonce@ (C. CbNonce corrId) <- atomically $ C. randomCbNonce g
0 commit comments