stealth_enum_generator 2.2.1
stealth_enum_generator: ^2.2.1 copied to clipboard
Code generator for stealth_enum that transforms private enums into zero-cost obfuscated extension types to eliminate AOT binary metadata.
2.2.1 #
Improvements & Hardening #
- Added support for project-wide secret keys via
build.yaml(options.config['key']) andSTEALTH_ENUM_KEYCI environment variable. - Added
'fromRawValue'to_reservedNamesvalidation set to prevent constructor collisions when defining enum constants. - Hardened empirical AOT verification script (
scripts/verify_aot_strings.sh) with-S <symbols>to strip debug symbols on Dart AOT compiles and added real Flutter arm64 APK inspection support. - Comprehensive unit tests covering
defaultKeyoptions andfromRawValuecollision validation. - Requires
stealth_enum: ">=2.2.1 <3.0.0". - Zero hash churn: preserves exact 2.2.0 HMAC-SHA256 derivation for existing constants.
2.2.0 #
Security & Hardening #
- Hashing upgraded from linear FNV-1a to keyed HMAC-SHA256: eliminates XOR differential attacks (
valA ^ valBno longer cancels the key or enum name). - Added support for
key: String?parameter in@StealthEnum(key: '...'). - Enforced private enum declarations: generates a descriptive
InvalidGenerationSourceErrorif@StealthEnumis placed on a public enum without a leading underscore (_). - Added keyword reservation check: throws a compile-time error if an enum constant collides with a generated extension type member (
when,orElse,isValid, etc.). - Added strict range validation to
@StealthValue: throws a compile-time error on negative integers or values below0x1000. - 15 comprehensive unit tests verifying code emission and non-vacuous validation error logging.
2.1.0 #
New Features & Improvements #
- Deterministic 32-bit FNV-1a hashing: Replaced Dart runtime
hashCodewith 32-bit FNV-1a hashing over(seed ?? 0xDEADBEEF) ^ fnv1a(publicName) ^ fnv1a(fieldName). Provides independent per-constant hash values: inserting, reordering, or removing constants leaves other values untouched. - Added
@StealthValue(int)support: Enum constants annotated with@StealthValue(value)use the exact specified 32-bit hex/int value, allowing frozen values for database and external API stability. - Decoupled
toJson()andfromJson(int): Integer-based serialization helpers are now generated by default on all extension types with zero string overhead. generateLabel: truenow exclusively generates.labelandbyLabel()string helpers.- 10 comprehensive unit tests using
build_testtesting actual generated code across all options, FNV-1a stability,@StealthValue, and error handling.
2.0.1 #
- Updated
README.md, example code, and package-levelllms.txtto accurately referencestealth_enum: ^2.0.0andstealth_enum_generator: ^2.0.0. - Synchronized documentation and examples across the package.
2.0.0 #
- Added
generateLabelcode path inStealthEnumGenerator. When@StealthEnum(generateLabel: true), the generator emits.labelgetter,byLabel(String),toJson(), andfromJson(int)helpers alongside the existing int-backed extension type. - Added inline security comment block in generated label section explaining the string-in-binary trade-off.
- Requires
stealth_enum: ^2.0.0.
1.0.5 #
- Added
tryFromRawValue()generation for safe, null-returning integer parsing. - Added
isValidboolean getter generation for variant validation. - 100% test coverage maintained.
1.0.4 #
- Security hardening:
.when()now generates explicit hex conditions for every enum constant. - Wildcard branch
_ => throw StateError('')fails closed on unknown or corrupted integers without leaking strings. - 100% test coverage maintained.
1.0.3 #
- Added
fromRawValuefactory constructor to generated extension types for zero-cost runtime deserialization. - Added unit test suite for generator and builder.
- Achieved 100% test coverage.
- Updated CI/CD workflow actions.
1.0.1 #
- Improved README formatting and documentation.
- Updated badges.
1.0.0 #
- Production ready 1.0.0 release.
- Updated dependency to support
stealth_enum^1.0.0.
0.1.1 #
- Added package example in
example/example.dart. - Added dartdoc comment for
StealthEnumGeneratorconstructor. - Fixed unresolved doc reference
build.yamlinbuilder.dart. - Refined package description to adhere to pub.dev length guidelines.
- Broadened analyzer compatibility for
EnumElementconstants across versions.
0.1.0 #
- Initial release.
StealthEnumGeneratorusingsource_gen 4.xandanalyzer 14.x.- Deterministic collision-free 32-bit value generation (seeded from
enumName ^ fieldName ^ 0xDEADBEEF). SharedPartBuilderintegration for.g.dartsharing.- Security-first code emission: wildcard final branch,
@pragma('vm:prefer-inline').