stealth_enum 2.2.4
stealth_enum: ^2.2.4 copied to clipboard
Obfuscates Dart enums into zero-cost extension types backed by high-entropy integers, eliminating enum metadata from Flutter AOT binaries.
2.2.4 #
Security & Hardening #
- Documentation refinement: Clarified feature table conditions and updated security recommendations to emphasize secret
key:(min 24 chars) over low-entropy 32-bitseed:. - Zero hash churn: 100% byte-for-byte backwards compatible with 2.2.0, 2.2.1, 2.2.2, and 2.2.3.
2.2.3 #
Fixes & Compatibility #
- Dependency lower bounds: Raised
metadependency lower-bound constraint to>=1.14.0 <2.0.0(from>=1.9.0) so thatTargetKind.enumValueis recognized duringdart pub downgrade, resolving pana downgrade analysis errors and achieving a 160/160 pub score. - Documentation: Cleaned up dartdoc bracket references to eliminate all doc generation warnings.
- Zero hash churn: 100% byte-for-byte backwards compatible with 2.2.0, 2.2.1, and 2.2.2.
2.2.2 #
Security & CI Transparency #
- Documented
require_key: trueoption inbuild.yamlandSTEALTH_ENUM_REQUIRE_KEY="1"CI environment variable to prevent silent fallbacks to the public default salt. - Documented
dart run build_runner cleanrecommendation for key rotation and caching awareness. - Documented generated key fingerprint auditing (
// Key fingerprint: <8-char hex>). - Enhanced AOT empirical verification documentation with
STEALTH_STRINGSandCONTROL_APKcomparison instructions. - Zero hash churn: 100% byte-for-byte backwards compatible with 2.2.0 and 2.2.1.
2.2.1 #
Documentation & Security Transparency #
- Enhanced documentation and docstrings detailing the security boundaries between default salt, 32-bit
seed, and secretkey. - Documented mathematical irreversibility of keyed HMAC-SHA256 when configured with high-entropy secret keys against dictionary and rainbow-table attacks.
- Documented project-wide key configuration via
build.yaml(options.config['key']) andSTEALTH_ENUM_KEYCI environment variable. - Added security warning regarding 32-bit brute-force vulnerability of integer
seed:values (~1.7h search space on a single CPU core). - Updated empirical verification script and sample output.
- Zero hash churn: HMAC-SHA256 derivation is 100% identical and backwards-compatible with 2.2.0.
2.2.0 #
Security & Hardening #
- Added
key: String?parameter to@StealthEnum(key: '...')for custom keyed HMAC derivation. - Hashing upgraded from linear FNV-1a to keyed HMAC-SHA256: satisfies the strict avalanche criterion and eliminates XOR differential attacks (
valA ^ valBno longer cancels the key or enum name). - Added range validation to
@StealthValue: values must be positive 32-bit unsigned integers (0x0to0xFFFFFFFF), requiring>= 0x1000to prevent low sequential jump tables. - Added compile-time validation enforcing private enums (leading
_) to ensure Dart AOT tree-shaking. - Added compile-time check preventing constant names from colliding with generated extension type members.
Migration from 2.0.x / 2.1.0: The HMAC-SHA256 upgrade modifies the derived integer values for un-annotated constants. If you persisted 2.0.x / 2.1.0 raw integer values into databases or storage, freeze those values using
@StealthValue(0x...)before regenerating.
2.1.0 #
New Features #
- Added
@StealthValue(int value)annotation: assign explicit, frozen raw integer values to specific enum constants (e.g., for backwards compatibility with backend API contracts or databases). - Decoupled
toJson()andfromJson(int)fromgenerateLabel: integer-based serialization helpers are now generated by default on all extension types with zero string footprint. - Deterministic 32-bit FNV-1a hashing replaces SDK-dependent
hashCode: constant values are generated using(seed ?? 0xDEADBEEF) ^ fnv1a(publicName) ^ fnv1a(fieldName). Each constant is computed independently—inserting, removing, or reordering enum constants no longer shifts the values of existing constants. - Empirical verification: Side-by-side verification script (
scripts/verify_aot_strings.sh) compares standard enum vs StealthEnum binaries, confirming that standard enums leak their identifiers while StealthEnum leaves zero strings in AOT output.
2.0.1 #
- Updated package-level
llms.txtwith complete 2.0.x feature documentation, migration guide, JSON serialization patterns, and safe parsing guarantees. - Synchronized documentation and examples across the package.
2.0.0 #
New Features #
- Added
generateLabelannotation parameter (defaultfalse). When enabled, the generator emits.labelgetter,byLabel(String),toJson(), andfromJson(int)helpers — equivalent to.name,byName(), and JSON converters on standard enums. - Added comprehensive Migration Guide in README covering pattern matching, JSON serialization (including
json_serializablecustom converter pattern), logging, persistence, and side-by-side standard enum → stealth_enum cheatsheet. - Added AOT Verification Script (
scripts/verify_aot_strings.sh) that compiles the example to a native AOT binary and asserts all enum identifier strings are absent using thestringsCLI tool. - Updated feature table to include Safe Parsing row comparing
tryFromRawValuevsbyName(which throws on unknown values).
Breaking Changes #
- Generator version constraint updated:
stealth_enum_generator: ^2.0.0requiresstealth_enum: ^2.0.0. Update both packages together.
1.0.5 #
- Added
tryFromRawValue()for safe, null-returning parsing of untrusted inputs (APIs, JSON, databases) to prevent runtime crashes. - Added
isValidboolean getter to verify if an instance holds a recognized enum variant. - Documented compile-time and runtime safety guarantees in README and llms.txt.
1.0.4 #
- Hardened generated pattern matching: all cases are now explicit and wildcard branches fail closed.
- Updated documentation and examples.
1.0.3 #
- Added unit test suite for
StealthEnumannotation. - Enhanced example and documentation.
- Updated CI/CD workflow actions.
1.0.1 #
- Improved README formatting and line breaks in documentation.
- Updated badges and preview graphics.
1.0.0 #
- Production ready 1.0.0 release.
- Zero runtime overhead and complete enum metadata erasure in Flutter AOT binaries.
- Full compatibility with Dart 3.3+ and Flutter 3.19+.
0.1.1 #
- Added package example in
example/example.dart. - Added dartdoc comments for
StealthEnumconstructor. - Refined package description to adhere to pub.dev length guidelines.
0.1.0 #
- Initial release.
@StealthEnumannotation withseed,generateWhen, andnameparameters.- Dart 3.3+
extension typeoutput backed by deterministic, collision-free 32-bit hex integers. - Inlined exhaustive
.when()and.maybeWhen()helpers with@pragma('vm:prefer-inline'). - No
StateErrorstrings in the binary — finalwhenbranch uses wildcard_ =>. - Compatible with
SharedPartBuilderalongsidejson_serializable,freezed, andriverpod_generator.