ReproductionCapsule class
Combines ReplayRecorder (recorded input/decision events), SeededRandomService (per-namespace RNG state), and TrustedClockService (clock-tamper judgement) into 1 redacted, signed artifact serving 2 purposes: (a) support — a dev imports it to reproduce exactly the event sequence that led to a bug; (b) anti-cheat — verify a played session wasn't tampered with, by replaying it and comparing outcomes (and, independently, RNG state) against what was recorded.
Deliberately a thin glue layer, not a reimplementation: signing reuses
save_integrity.dart's signExport/verifyAndStrip (same convention
every other signed artifact in this package already uses — see
ReplayCapsule.exportSigned/DiagnosticsExportBundle.sign), and event
replay reuses replayCapsule/findFirstDivergence unchanged.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
capture(
{required ReplayRecorder recorder, required SeededRandomService rng, required String appVersion, required String secret, TrustedClockService? trustedClock, Set< String> redactedKeys = defaultRedactedKeys, int maxBytes = defaultMaxBytes}) → Map<String, Object?> -
Captures everything needed to reproduce/verify
recorder's current session: its ReplayCapsule (redacted perredactedKeys),rng's current per-namespace RNG state, andtrustedClock's most recent ClockJudgement (if any) — signed viasecretso a receiver can detect tampering before trusting it. -
replay(
Map< String, Object?> signed, String secret, Object? handler(ReplayEvent event, SeededRandomService rng)) → ReproductionReplayResult -
Verifies
signedviasecret(throws FormatException on a missing/tampered checksum or a malformedreplaysection — same "fail loud on untrusted input" posture RandomSnapshot.fromJson/ ReplayEvent.fromJson already use), then replays its events throughhandlerand reports how faithfully the replay reproduced the original session — see ReproductionReplayResult.
Constants
- defaultMaxBytes → const int
- ~50KB — deliberately tighter than DiagnosticsExportBundle's 200KB default: this is meant to be pasted inline into a support ticket or an anti-cheat log line, not attached as a file.
-
defaultRedactedKeys
→ const Set<
String> -
ReplayEvent.payload keys replaced with
'<redacted>'by default — same default-deny, opt-in-by-name posture DiagnosticsExportBundle.build'sconfigAllowedKeysalready established, inverted here (a replay payload is free-form game data, not a fixed config map, so a deny list fits better than an allow list). - schemaVersion → const int