refactor: Migrate from Static ASM Patcher to Runtime ByteBuddy Agent#9
Merged
sanasol merged 77 commits intosanasol:masterfrom Feb 8, 2026
Merged
refactor: Migrate from Static ASM Patcher to Runtime ByteBuddy Agent#9sanasol merged 77 commits intosanasol:masterfrom
sanasol merged 77 commits intosanasol:masterfrom
Conversation
added 30 commits
February 3, 2026 08:57
- Removes all hardcoded F2P domains (sanasol.ws, etc.) from the internal logic.
- Implements a two-tier priority system for server identity:
1. Primary (Pre-fetched): Official hytale.com and the user-defined HYTALE_AUTH_DOMAIN.
2. Dynamic (On-demand): Any other incoming issuer is resolved via a secondary cache layer.
- Refined routing logic:
- Standard flows use pre-fetched tokens.
- Omni-Auth tokens (embedded private keys) use self-signing bypass.
- Unknown Public issuers now trigger a dynamic /server/auto-auth fetch instead of
failing with an empty-key self-sign error. These issuers need to follow the
sanasol/hytale-auth-server /auto-auth API endpoint standard.
added 11 commits
February 4, 2026 06:34
Owner
|
😮 |
added 8 commits
February 5, 2026 15:00
Contributor
Author
Owner
|
Tested, seems to be working for all cases. Updated Hytale F2P to work with it: amiayweb/Hytale-F2P#277 |
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.

This PR represents a major architectural shift from the static
DualAuthPatcher(raw ASM) to a dynamic Java Agent using ByteBuddy.This migration solves several critical limitations of the static patcher approach while significantly improving maintainability, performance, and stability.
Key Changes & Benefits:
HytaleServer.jaron disk. Required re-patching after every game update.EmbeddedJwkVerifierdirectly into the validation pipeline usingAdvicehooks, bypassing strictnimbus-josechecks without needing to rewrite entire methods.Architecture Overview:
JWTValidator,SessionServiceClient, etc.) now has its own isolated Transformer class incom.hytale.dualauth.agent.transformers.DualAuthContextusesThreadLocalvariables but now utilizes "Reset Hooks" on Netty channel reads to ensure a clean slate for every incoming connection.DualJwksFetcherlogic now includes smart caching and automatic issuer detection for Federated setups.Verification:
Tested against the latest Hytale server build. Verified successful connections from:
🚀 How to Execute (The Migration Guide)
Since this changes the deployment method, here are the new instructions for building and running the DualAuth Agent.
1. Build the Agent
Prerequisites: JDK 21+ and an internet connection (for Gradle dependencies).
This produces a jar file at:
build/libs/dualauth-agent.jar(Updated the github actions workflow to make a release of the dualauth-agent.jar, so launchers can fetch it from the repo)
2. Run the Server (Non-Destructive)
Do not use the old patched JAR. Use the original, unmodified
HytaleServer.jar. The agent applies the magic at runtime.3. Configuration (Environment Variables)
The agent accepts the same configuration as the old patcher
HYTALE_AUTH_DOMAINauth.sanasol.ws)HYTALE_TRUST_ALL_ISSUERStrueto enable Omni-Auth (embedded keys),falseto restrict.dualauth.debugtrue(system property) to see verbose transformer logs.4. Comparison Check (Verification)
To verify the agent is working, watch the console logs during startup:
If you see these checks, the logic was migrated successfully.