31 Commits
Author SHA1 Message Date
Majd Alfhaily abd86cb01a feat(auth): replace App Store login with SAP signing 2026-08-28 23:22:55 +02:00
Rudra Sarkar dcddce4650 Fix 429 rate limit handling and context key type mismatch in login #480 (#481)
fix: handle 429 rate limit and context key type mismatch in login issue #480
2026-05-26 06:21:29 +02:00
Lakr a3fa2f09b3 feat: add tvOS app search and download support (#478) 2026-05-25 13:19:30 +02:00
4142ab48ad feat: use auth endpoint from Bag on retries (#468)
* Fix purchase retry to resolve auth endpoint via Bag() before re-login

The retry logic in purchase, download, get-version-metadata, and
list-versions called Login() without an Endpoint when re-authenticating
after a password token expiry. This caused silent failures because the
auth endpoint was empty.

- Add Bag() call before Login() in all retry blocks to resolve the auth
  endpoint dynamically
- Fall back to hardcoded auth endpoint when bag.xml omits
  authenticateAccount
- Detect "Your password has changed." customer message as a token expiry
  trigger alongside failure type 2034
- Increase download retry attempts to 3 to handle license-required then
  token-expired chain

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Address PR review: make auth path constant consistent, add password-changed test

- Rename PrivateAppStoreAPIPathAuthenticate to store only the path
  (consistent with other *APIPath* constants), constructing the full
  URL in the Bag() fallback
- Add test for CustomerMessagePasswordChanged triggering
  ErrPasswordTokenExpired in purchaseWithParams

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix purchase "already purchased" detection for Apple API changes

Apple now returns HTTP 200 with FailureType "5002" for already-purchased
apps instead of HTTP 500. Also treat FailureType "1008" (device
verification failed) as a stale token that triggers re-authentication.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix download retry to handle new Apple failure types (5002, 1008)

Map FailureType "5002" (license already exists) and "1008" (device
verification failed) to ErrPasswordTokenExpired in the download flow,
triggering re-auth retry consistent with the purchase fix in 438e8e8.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix zip corruption on re-download when .ipa already exists

applyPatches opened the destination file with O_CREATE|O_WRONLY but no
O_TRUNC. On re-download, the existing .ipa (which includes sinf data
from ReplicateSinf) is larger than what applyPatches writes (zip entries
+ metadata, no sinf yet). The leftover bytes at the end corrupt the ZIP
end-of-central-directory record, causing ReplicateSinf's zip.OpenReader
to fail with "failed to open zip reader".

Fix: add O_TRUNC to truncate the file before writing, and add a missing
defer dstFile.Close() to prevent file descriptor leaks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Treat "license already exists" as success in purchase and download

When the user already owns an app, purchase should report success
(with alreadyOwned=true) instead of failing with an error. Applied
to both the standalone purchase command and the --purchase flag in
the download command.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Remove Bag() fallback in retry paths, use DefaultAuthEndpoint directly

The bag response from init.itunes.apple.com/bag.xml does not contain
an authenticateAccount key, so the fallback was firing 100% of the time.
Replace the Bag()+Login() pattern in retry paths with Login() using a
DefaultAuthEndpoint constant directly, avoiding an unnecessary network
round-trip. The cmd/auth.go login flow still uses Bag() as before.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Use bag auth endpoint for retry login

---------

Co-authored-by: Barnabas Birmacher <birmacher@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-16 18:23:09 +00:00
Majd AlfhailyandBasil 1858ad7a72 chore(deps): update keyring module to maintained fork (#466)
Co-authored-by: Basil <basil@basil.cafe>
2026-04-14 20:39:55 +02:00
Majd Alfhaily 496595a039 Update auth command to retrieve bag and pass custom endpoint to auth API 2026-02-16 20:12:00 +01:00
Majd Alfhaily b4bd8d6580 Rename field to external-version-id 2025-06-09 17:18:53 +02:00
Majd Alfhaily 79250ae2a3 Implement GetVersionMetadata command 2025-06-09 17:18:53 +02:00
Majd Alfhaily 805678138e Fix running golangci-lint on GitHub Actions 2025-06-09 12:13:32 +02:00
Majd Alfhaily ac081fa19d Use internal version ID in filename of app 2025-06-09 12:13:32 +02:00
Majd Alfhaily 7136f81fd1 Refactor VersionHistory subcommand to ListVersions 2025-06-09 12:13:32 +02:00
koraytutuncu 0bb134e9d7 Add version history and old app version download support (#370) 2025-06-08 15:44:15 +02:00
Max e5291ba16b Log if app purchase was required and executed (#339) 2025-02-10 23:33:02 +01:00
Max Foxie 169af4b2ea Add ability to download .ipa by the app ID (#263)
* Add ability to download .ipa by the app ID
* Update `download` command usage in README
* Fix the linter warnings
2024-04-07 16:07:45 +02:00
dleovl f68a119963 Fix auth flag parenthesis (#267) 2024-04-06 18:59:58 +02:00
双草酸酯 6ccb4a7f0b Hide progress bar in non-interactive mode (#229) 2023-09-23 14:29:49 +02:00
Majd Alfhaily b031cd20d1 Make --keychain-passphrase flag persistent (#203) 2023-06-07 22:31:43 +00:00
Majd Alfhaily e1141bd6d2 Default to FileBackend keyring when other options are not available (#197) 2023-06-03 22:07:32 +00:00
Majd Alfhaily 6a7adabbfa Fix reading config directory (#193) 2023-05-29 17:55:20 +00:00
Majd Alfhaily 74e7588c6d Add v2 suffix to module path (#190) 2023-05-29 13:27:28 +00:00
Majd Alfhaily 67e557e9a7 Add golangci-lint linter (#188) 2023-05-27 21:21:13 +00:00
Majd Alfhaily 95c3aa6629 Refactor API interfaces (#185)
- Move logging to command level.
- Simplify and unify interfaces for `appstore` package.
- Move sinf replication from "Download" API to "ReplicateSinf" API.
- Handle retries and command specific logic in the command level.
- Rename "Info" API to "AccountInfo".
2023-05-27 18:48:22 +02:00
Majd Alfhaily cf926d7911 Set build version using linker flags (#183) 2023-05-20 15:54:56 +00:00
Majd Alfhaily 8762eaf192 Refactor API to return output to caller (#171)
* Refactor auth.info implementation to return output

* Refactor auth.revoke implementation to return output

* Refactor auth.login implementation to return output

* Refactor search implementation to return output

* Refactor purchase implementation to return output

* Refactor download implementation to return output
2023-04-09 18:24:10 +00:00
Majd Alfhaily a3b322c8da Fix reading from stdin on Windows (#121) 2022-12-05 22:04:44 +00:00
Majd Alfhaily 15dbfe423a Update GitHub workflows 2022-12-05 18:46:02 +01:00
Majd Alfhaily f77b0d94d9 Fix building for windows 2022-12-05 18:46:02 +01:00
Majd Alfhaily 99c1bf1013 Wire CLI commands with logic 2022-12-05 18:46:02 +01:00
Majd Alfhaily 915c70dcfa Implement HTTP client 2022-12-05 18:46:02 +01:00
Majd Alfhaily 9c00557474 Wire commands 2022-12-05 18:46:02 +01:00
Majd Alfhaily 5e06154ccb Add Go project skeleton 2022-12-05 18:46:02 +01:00