smp-server: add serverInfoBytes to THandleParams and related functions#1825
Open
ed-asriyan wants to merge 1 commit into
Open
smp-server: add serverInfoBytes to THandleParams and related functions#1825ed-asriyan wants to merge 1 commit into
ed-asriyan wants to merge 1 commit into
Conversation
epoberezkin
reviewed
Jul 10, 2026
| serviceAuth :: Bool | ||
| serviceAuth :: Bool, | ||
| -- | JSON-encoded ServerPublicInfo from handshake, present when server version >= serverInfoSMPVersion | ||
| serverInfoBytes :: Maybe ByteString |
Member
There was a problem hiding this comment.
why not include the actual type here, and parse JSON in parser? Or you think there is a value in lenient parser? but then you could just include Nothing if JSON fails to parse, or Either String ServerInfo (it would help to know in test that info was sent but was invalid).
Suggested change
| serverInfoBytes :: Maybe ByteString | |
| serverInfo :: Either String ServerPublicInfo |
epoberezkin
reviewed
Jul 10, 2026
| authPubKey :: Maybe CertChainPubKey | ||
| authPubKey :: Maybe CertChainPubKey, | ||
| -- | optional server public information (JSON-encoded ServerPublicInfo), sent when version >= serverInfoSMPVersion | ||
| serverInfo :: Maybe ByteString |
Member
There was a problem hiding this comment.
Suggested change
| serverInfo :: Maybe ByteString | |
| serverInfo :: Either String ServerPublicInfo |
epoberezkin
reviewed
Jul 10, 2026
| import Control.Monad.Trans.Except | ||
| import Crypto.Random (ChaChaDRG) | ||
| import qualified Data.Aeson as J | ||
| import qualified Data.Aeson as Aeson |
Member
There was a problem hiding this comment.
Suggested change
| import qualified Data.Aeson as Aeson |
Already imported above as J, but it'll move to transport if we put it into handshake
epoberezkin
reviewed
Jul 10, 2026
| deriving (Eq, Show) | ||
|
|
||
| runSMPServerTest :: AgentClient -> NetworkRequestMode -> UserId -> SMPServerWithAuth -> AM' (Maybe ProtocolTestFailure) | ||
| runSMPServerTest :: AgentClient -> NetworkRequestMode -> UserId -> SMPServerWithAuth -> AM' (Either ProtocolTestFailure (Maybe ServerPublicInfo)) |
Member
There was a problem hiding this comment.
Suggested change
| runSMPServerTest :: AgentClient -> NetworkRequestMode -> UserId -> SMPServerWithAuth -> AM' (Either ProtocolTestFailure (Maybe ServerPublicInfo)) | |
| runSMPServerTest :: AgentClient -> NetworkRequestMode -> UserId -> SMPServerWithAuth -> AM' (Either ProtocolTestFailure (Either String ServerPublicInfo)) |
It would help differentiate info not sent/failed to parse scenarios, and this type would already be included into handshake and handle, so all parsing would be in one place, and not split between transport and client.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.