Add pluggable Logon authentication for custom FIX signers - #416
Closed
0-jake-0 wants to merge 1 commit into
Closed
Conversation
The FIX adapter only supported LMAX-style Username/Password (tags 553/554) in the Logon message. Venues like Binance authenticate with a signature computed over the Logon header, which the fixed encoder couldn't express. Add a generic `FixLogon` (None / Password / Custom) plus a `LogonContext` carrying the SenderCompID, TargetCompID, MsgSeqNum and the exact SendingTime string the Logon will carry. `FixSession::send_with` now computes the sequence number and SendingTime once and hands both to the field builder and the encoder, so a signer signs exactly what goes on the wire. SendingTime gains millisecond precision. `fix_connect_tls` is unchanged (delegates to a new `fix_connect_tls_logon` that takes a `FixLogon`). wingfoil stays free of any venue/crypto specifics — the Ed25519 signer lives in the caller. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q96qpjaqcpywW3rdy1eHjW
Contributor
Author
|
Superseded by #418 (same commit; branch renamed to drop the venue name). Closing this one. Generated by Claude Code |
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.
Summary
Extends FIX adapter to support custom authentication schemes beyond simple passwords. Introduces
FixLogonenum andLogonContextto allow venues like Binance to attach cryptographic signatures (e.g., Ed25519) bound to the exact Logon message bytes on the wire.Key Changes
New
FixLogonenum with three variants:None— no authentication fields (EncryptMethod/HeartBtInt/ResetSeqNumFlag only)Password(String)— LMAX-style Username (tag 553) + Password (tag 554)Custom(Arc<dyn Fn>)— caller-supplied builder for custom fieldsNew
LogonContextstruct passed to custom builders, exposing:msg_type,sender_comp_id,target_comp_id(header fields)msg_seq_num,sending_time(exact values the Logon carries)Refactored message encoding:
SendingTimenow formatted with millisecond precision (YYYYMMDD-HH:MM:SS.sss) to match venue requirements (e.g., Binance)now_sending_time()helper to ensure consistent formattingencode_message()takessending_timeparameter instead of computing it internallyNew
send_with()method onFixSession:SendingTimeonceNew public API:
fix_connect_tls_logon()— acceptsFixLogoninstead ofOption<&str>FixLogon::custom()— convenience constructor wrapping a builder inArcimpl From<Option<&str>> for FixLogon— backward-compatible conversionUpdated
FixThreadedSourceto storeFixLogoninstead ofOption<String>Documentation in module-level comments and
CLAUDE.mdexplaining the authentication flow and Binance Ed25519 exampleImplementation Details
FixLogonisCloneto allow capture in closures passed to the session loopArc-wrapped to supportSend + Syncacross thread boundariesFixSession::send_logon()usessend_with()to ensure the builder receives the exact sequence number and formatted time the Logon will carryfix_connect_tls(password: Option<&str>)now delegates tofix_connect_tls_logon()viaFixLogon::from()custom_logon_fields_are_sent) verifying custom fields are encoded and accessible in the wire messageNotes
kesBinance adapter)SendingTimeis required by Binance and is now the standard for all venueshttps://claude.ai/code/session_01Q96qpjaqcpywW3rdy1eHjW