feat: add obfuscation utilities and precomputed DTOs #238
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.
Motivation
The precomputed client receives server-side computed flag assignments in an obfuscated wire format. This PR adds the data transfer objects (DTOs) and utilities needed to parse and work with this format.
Changes
Utilities:
ObfuscationUtils- MD5 hashing for flag key obfuscation lookupsDTOs:
PrecomputedFlag- Represents a precomputed flag assignment (allocation, variation, type, value, logging config)PrecomputedBandit- Represents a precomputed bandit assignment (action, probability, attributes)PrecomputedConfigurationResponse- Wire protocol response with flags, bandits, salt, and metadataBanditResult- Simple container for bandit action lookup resultsExceptions:
MissingSubjectKeyException- Thrown when subject key is required but not providedTests:
ObfuscationUtilsTest- MD5 hash consistency and standard test vectorsPrecomputedConfigurationResponseTest- Serialization round-trips, null handling, environment parsingDecisions
@JsonCreatorconstructors@JsonIgnoreProperties(ignoreUnknown = true)for forward compatibilityPR Stack
This PR is part of the precomputed client feature, split for easier review:
Why this structure: DTOs and utilities have no dependencies on other new code, making them independently reviewable and testable. They form the "vocabulary" that the rest of the feature uses.