PatchManifest class
The one description of an available patch, for both platforms.
Why one class and not two
Android and iOS had separate manifests with separate parsers: Android keyed a
patch on versionCode + engineVersion and called the artifact libUrl,
iOS added a required releaseId and called it patchUrl. Nothing was shared,
so every rule had to be implemented twice — and the rollout gate, the hash
check and the staged-rollout clamp were each slightly different on the two
sides. A signature scheme cannot survive that: the signed field list has to be
identical or a manifest signed for one platform fails to verify on the other
for reasons that look like tampering.
So there is one shape. The platforms still differ in what they do with it —
Android replaces a whole libapp.so, iOS loads a small bytecode module — but
they agree on what they were told.
Why Android gained a releaseId
It only ever checked versionCode and engineVersion, which cannot tell two
builds of the same version apart. Rebuild 1.6.5+65 with a one-line change and
both builds accept the same patch; one of them is wrong. iOS already had to
solve this because bytecode resolves names against one exact kernel. Android
now carries the same id for the same reason, one release earlier than it
becomes a crash.
Constructors
-
PatchManifest({required String appId, required PatchPlatform platform, required String releaseId, required String engineVersion, required int versionCode, required String versionName, required int patchNumber, required String artifactUrl, required String artifactSha256, required int artifactSizeBytes, int rolloutPercent = 100, List<
String> notes = const <String>[], bool revoked = false, String? revokedReason, String? signature, String? keyId, int sigVersion = OverPushSignedPayload.version, PatchDelta? delta, String? signatureV2}) -
const
Properties
- appId → String
-
The registered app this manifest is for. Inside the signature, so one
app's patch cannot be served to another.
final
- artifactSha256 → String
-
final
- artifactSizeBytes → int
-
final
- artifactUrl → String
-
final
- delta → PatchDelta?
-
A smaller artifact for devices already on patch
PatchDelta.fromPatch. Only to be used through verifiedDelta.final - engineVersion → String
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- keyId → String?
-
final
-
notes
→ List<
String> -
final
- patchNumber → int
-
Monotonic per release. Also the artifact's immutable address, so a device
that fetched patch 7 never sees patch 7 change underneath it.
final
- platform → PatchPlatform
-
final
- releaseId → String
-
The exact build this patch was compiled against.
final
- revoked → bool
-
The kill switch. A device that has applied a revoked patch reverts to the
base build on its next cold start; one that has not stops fetching it.
final
- revokedReason → String?
-
final
- rolloutPercent → int
-
What fraction of devices should take this patch, 0–100.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- signature → String?
-
final
- signatureV2 → String?
-
The app key's signature over the v2 payload, which covers delta.
final
- sigVersion → int
-
final
- versionCode → int
-
final
- versionName → String
-
final
Methods
-
copyWith(
{int? rolloutPercent, bool? revoked, String? revokedReason, String? signature, String? keyId}) → PatchManifest -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
signablePayload(
) → List< int> - The bytes a publisher signs. Exposed so the CLI signs exactly what a device will verify, rather than rebuilding the field list by hand.
-
toJson(
{bool legacyAliases = false}) → Map< String, Object?> - The JSON a device reads.
-
toString(
) → String -
A string representation of this object.
override
-
verifiedDelta(
String publicKeyBase64) → PatchDelta? - delta, if the app's key signed it together with every v1 field; otherwise null, and the full artifact is the only one to fetch. Call after verify has passed.
-
verify(
String publicKeyBase64) → SignatureFailure? -
Verifies this manifest against the public key baked into the running
build.
nullmeans it is trustworthy.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
parse(
Map< String, Object?> json) → PatchManifest - Thrown for a manifest that cannot be read at all, as distinct from one that reads fine and fails verification. The two want different logs.