Skip to content

Install: show when the signature expires, and renew it at any time without rebuilding - #156

Merged
LNPANDY merged 2 commits into
mainfrom
task-145-resign-expiry
Oct 28, 2026
Merged

LNPANDY merged 2 commits into
mainfrom
task-145-resign-expiry

Conversation

@LNPANDY

@LNPANDY LNPANDY commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Second half of #145. Supersedes #151, which GitHub closed when #149's branch was deleted after its merge; this is the same branch rebased onto main (with #147/#148 in it), plus the follow-up the owner asked for: the re-sign is offered at any time, not only in the last two days.

Rebased over #157's revert of #149: this PR now carries the expiry/re-sign half and the reinstall/save-IPA half it builds on, so merging #156 then #155 restores the whole feature set in two reviewed steps.

A free Apple ID's provisioning profile lasts 7 days. The game stops starting a week after install, no sideloader can renew it, and the only way back was a full rebuild.

What changes

  • Expiry, read from the signature. The app's embedded.mobileprovision (CMS-wrapped plist) is read with security cms -D and its ExpirationDate shown: the game card's status line gets "· 3 days of signature left" (orange at two days or fewer, help text with the date), and the hero shows the full date. Whole calendar days, so the switch happens on the day iOS would refuse to start the app.
  • Re-sign in the hero, at any time (the count only changes colour at two days or fewer, the button is always offered): the install's xcodebuild line — same project, scheme, destination, -derivedDataPath, -allowProvisioningUpdates, DEVELOPMENT_TEAM, DM_COPY_ROMFS=NO — so Xcode reuses every compiled product and only signs again; then devicectl device install app over itself.
    • PRODUCT_BUNDLE_IDENTIFIER is passed as the installed app's own, not re-derived: the device keeps the app's Documents (game data, saves). The install's taken-App-ID retry must not run here for exactly that reason.
    • Project and derived data are derived from the installed app's path (<work>/xcode-derived-data/Build/Products/...), so no stored build state is needed.
    • An installed app whose profile cannot be read still offers the button (the line says the expiry is unknown).
  • Actionable failures: no cached project (build once more), no signing team, and a failed sign (devicectl's/xcodebuild's own error line plus the Manage Certificates next step), in both languages.

Verified

  • swift test --package-path frontend → 192 tests, 6 skipped, 0 failures (L10n.selfCheck() included).
  • New cases: profile plist → date (and missing/garbage), calendar-day arithmetic and the 2-day threshold, the wording in en + zh, the exact re-sign command (install line + app's bundle ID), the paths derived from an installed app, the re-sign flow through the fake-xcrun fixture (one more xcodebuild -project, no second romfs pack, then devicectl install), and the missing-project/no-team messages.

Not verified

  • A real 7-day expiry and a real re-sign on a device — the owner's. The profile is also only present on installed apps; a Mac app or a build never installed shows nothing, by design.

…ding

A free Apple ID's provisioning profile lasts 7 days: the game stops starting a
week after it was installed, and nothing in the launcher said when. A sideloader
cannot renew it either, so the only way back was a full rebuild.

The launcher now reads the date from the profile the install signed with
(<app>/embedded.mobileprovision, `security cms -D`):

- the game's status line says how many days are left, orange at two days or
  fewer, and the hero shows the date;
- at two days or fewer the hero offers Re-sign: the install's xcodebuild line
  (same project, scheme, destination, derived data, team, DM_COPY_ROMFS=NO),
  which reuses every compiled product and only signs again, then devicectl
  installs the app over itself. PRODUCT_BUNDLE_IDENTIFIER is passed as the
  installed app's own, so the device keeps its Documents (game data, saves);
- a missing cached project, no chosen team and a failed sign each say what
  happened and what to do (the certificate in Xcode → Settings → Accounts →
  Manage Certificates, or the network).

Verified: swift test --package-path frontend -> 192 tests, 6 skipped, 0 failures
(9 new: the profile parse, calendar-day count, urgency, the wording in both
languages, the re-sign command and the paths derived from the installed app,
the re-sign flow through the fake xcrun, and its missing-project/team paths).
Not verified: a real 7-day expiry and a real re-sign on a device (the owner's).
Renewing an app's signature early is as valid as renewing it just in time (a
trip, a demo, a device handed to someone else), and the owner asked for the
button at any time. The hero shows the line for every app installed on a
device; the count stays orange at two days or fewer, and the button is always
there. When the profile cannot be read (an app signed by something else), the
line says unknown and still offers the re-sign.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant