Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ Payload/
*.ipa
xcuserdata/
Vendor/
.build/
.swiftpm/
.xtool/
xtool/
ZSignKit/zsign
24 changes: 24 additions & 0 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 57 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// swift-tools-version: 6.0
import PackageDescription

// For local builds with xtool (`xtool dev build`). The release IPA is still built
// from project.yml by GitHub Actions. Run Scripts/fetch-dependencies.sh first,
// it puts zsign (ZSignKit/zsign) and the OpenSSL headers in place.
let zsignCSettings: [CSetting] = [
.define("SWIFTIPA_HAS_ZSIGN", to: "1"),
.headerSearchPath("zsign"),
.headerSearchPath("zsign/common"),
.headerSearchPath("../Vendor/openssl-include"),
]
let zsignCXXSettings: [CXXSetting] = [
.define("SWIFTIPA_HAS_ZSIGN", to: "1"),
.headerSearchPath("zsign"),
.headerSearchPath("zsign/common"),
.headerSearchPath("../Vendor/openssl-include"),
]

let package = Package(
name: "SwiftIPA",
platforms: [.iOS(.v16)],
products: [.library(name: "SwiftIPA", targets: ["SwiftIPA"])],
dependencies: [
.package(url: "https://github.com/weichsel/ZIPFoundation.git", exact: "0.9.20"),
.package(url: "https://github.com/krzyzanowskim/OpenSSL.git", exact: "3.6.5000"),
],
targets: [
.target(
name: "ZSignKit",
dependencies: [.product(name: "OpenSSL", package: "OpenSSL")],
path: "ZSignKit",
exclude: [
"zsign/zsign.cpp",
"zsign/certcheck.cpp",
"zsign/certcheck.h",
"zsign/metadata.cpp",
"zsign/metadata.h",
"zsign/third-party",
"zsign/common/archive.cpp",
"zsign/common/archive.h",
],
publicHeadersPath: "include",
cSettings: zsignCSettings,
cxxSettings: zsignCXXSettings,
linkerSettings: [.linkedLibrary("z")]
),
.target(
name: "SwiftIPA",
dependencies: ["ZSignKit", .product(name: "ZIPFoundation", package: "ZIPFoundation")],
path: "SwiftIPA",
exclude: ["Resources", "Signing/ZSign"]
),
],
swiftLanguageModes: [.v5],
cxxLanguageStandard: .cxx17
)
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ There's no account and no tracking. The app only goes online when you ask it to:
## Features

- Change the bundle ID, name, version, build, minimum iOS version, icon and entitlements, or take the bundle ID straight from your certificate's provisioning profile
- The imported IPA stays untouched. Signing always starts from it, so signing again with other settings doesn't stack changes, and you can export the original any time
- Re-signing the same app with the same certificate and settings is almost instant, because the result gets cached
- Fast Packaging (on by default) skips compressing the signed IPA, so signing big apps takes a fraction of the time
- Sign several apps in one go
Expand All @@ -22,6 +23,9 @@ There's no account and no tracking. The app only goes online when you ask it to:
- Remove extensions, the Watch app or the embedded profile, force file sharing, and a few more tweaks like that
- Add AltStore or ESign sources and pull apps from them
- See when a certificate is about to expire, with a reminder a few days before
- Adding a certificate checks the .p12 password and that the .p12 belongs to the provisioning profile
- If signing fails, Show Log has zsign's full output to copy or share
- Sort the library by name, size, or when an app was added or signed
- Look inside an IPA before signing it (architectures, encryption, linked libraries, extensions)
- Six color themes, English and German
- Report bugs from Settings → Bugs & Issues, which opens a prefilled issue on GitHub
Expand Down Expand Up @@ -66,14 +70,24 @@ xcodegen generate
open SwiftIPA.xcodeproj
```

The fetch script downloads zsign and the OpenSSL headers into `Vendor/`, which isn't checked in. The app talks to zsign through one small Objective-C++ file (`Signing/ZSign/ZSignBridge.mm`), everything else is Swift and SwiftUI.
The fetch script downloads zsign and the OpenSSL headers into `Vendor/`, which isn't checked in. Both are pinned to fixed versions in the script. The app talks to zsign through one small Objective-C++ file (`ZSignKit/ZSignBridge.mm`), everything else is Swift and SwiftUI.

### With xtool (Linux or macOS)

With [xtool](https://xtool.sh) and its Darwin SDK set up:

```bash
./Scripts/xtool-build.sh # unsigned IPA in xtool/SwiftIPA.ipa
./Scripts/xtool-build.sh install # build, sign and install on the connected iPhone
```

This uses `Package.swift` and `xtool.yml`. Release builds still come from `project.yml` on GitHub Actions. The xtool build has no German strings yet, because the String Catalog can't be compiled outside Xcode.

## Known issues

- `.deb` tweaks only work if they're gzip-compressed. For `xz` or `zstd` ones, extract the `.dylib` and import that instead.
- `.deb` tweaks work with gzip and xz compression. For `zstd` or `bzip2` ones, extract the `.dylib` and import that instead.
- Installing needs api.palera.in to be reachable. If it's down, use Export IPA for now.
- Revoked certificates are only detected through the profile and expiry date, the app doesn't ask Apple directly.
- The Share Sheet extension is English only.
- No special iPad layout yet.

Found a bug or have an idea? Open an issue, I read all of them.
Expand Down
27 changes: 17 additions & 10 deletions Scripts/fetch-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,28 @@ ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
VENDOR="$ROOT/Vendor"
ZSIGN_DIR="$VENDOR/zsign"
ZSIGN_REPO="https://github.com/zhlynn/zsign.git"
ZSIGN_REF="${ZSIGN_REF:-master}"
# Pinned so a change on zsign's master can't break the build or signing unnoticed.
# To update: set a newer commit here, build, sign a few apps, then commit.
ZSIGN_REF="${ZSIGN_REF:-9299685bab7ef99827e06e5dfda93af747386590}"
OPENSSL_INCLUDE_DIR="$VENDOR/openssl-include/openssl"
OPENSSL_RELEASE_API="https://api.github.com/repos/krzyzanowskim/OpenSSL/releases/latest"
# Must match the OpenSSL package version in project.yml and Package.swift.
OPENSSL_TAG="${OPENSSL_TAG:-3.6.5000}"
OPENSSL_RELEASE_API="https://api.github.com/repos/krzyzanowskim/OpenSSL/releases/tags/$OPENSSL_TAG"

mkdir -p "$VENDOR"

if [ -d "$ZSIGN_DIR/.git" ]; then
echo "==> Updating zsign"
git -C "$ZSIGN_DIR" fetch --depth 1 origin "$ZSIGN_REF"
git -C "$ZSIGN_DIR" checkout -q FETCH_HEAD
else
if [ ! -d "$ZSIGN_DIR/.git" ]; then
echo "==> Cloning zsign"
rm -rf "$ZSIGN_DIR"
git clone --depth 1 --branch "$ZSIGN_REF" "$ZSIGN_REPO" "$ZSIGN_DIR"
git init -q "$ZSIGN_DIR"
git -C "$ZSIGN_DIR" remote add origin "$ZSIGN_REPO"
fi
echo "==> Checking out zsign $ZSIGN_REF"
git -C "$ZSIGN_DIR" fetch -q --depth 1 origin "$ZSIGN_REF"
git -C "$ZSIGN_DIR" checkout -q FETCH_HEAD

# The SwiftPM/xtool build (Package.swift) expects zsign's sources here.
ln -sfn ../Vendor/zsign/src "$ROOT/ZSignKit/zsign"

echo "==> Checking the sources SwiftIPA expects"
for file in src/bundle.cpp src/bundle.h src/openssl.cpp src/openssl.h src/macho.cpp src/macho.h src/archo.cpp src/archo.h src/signing.cpp src/signing.h src/common/common.h src/common/mach-o.h; do
Expand Down Expand Up @@ -72,5 +79,5 @@ cp "$HEADERS_SRC"/*.h "$OPENSSL_INCLUDE_DIR/"

echo
echo "Done. Now run:"
echo " xcodegen generate"
echo " open SwiftIPA.xcodeproj"
echo " xcodegen generate && open SwiftIPA.xcodeproj (Xcode)"
echo " Scripts/xtool-build.sh (xtool, e.g. on Linux)"
19 changes: 19 additions & 0 deletions Scripts/xtool-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
# Local build with xtool (https://xtool.sh), e.g. on Linux.
# Scripts/xtool-build.sh unsigned IPA in xtool/SwiftIPA.ipa
# Scripts/xtool-build.sh install build, sign and install on the connected iPhone (xtool dev)
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT"

if [ ! -f Vendor/zsign/src/bundle.cpp ] || [ ! -d Vendor/openssl-include/openssl ]; then
./Scripts/fetch-dependencies.sh
fi
ln -sfn ../Vendor/zsign/src ZSignKit/zsign

export PKG_CONFIG_PATH="$ROOT/Support/pkgconfig"

if [ "${1:-}" = "install" ]; then
exec xtool dev
fi
xtool dev build --ipa "$@"
6 changes: 0 additions & 6 deletions ShareExtension/Info.plist

This file was deleted.

113 changes: 0 additions & 113 deletions ShareExtension/ShareViewController.swift

This file was deleted.

8 changes: 8 additions & 0 deletions Support/pkgconfig/zlib.pc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# ZIPFoundation asks pkg-config for zlib when the build host isn't an Apple
# platform (xtool on Linux). The host's zlib.pc would add -L/usr/lib64, which
# breaks the iOS link, so this one only links the SDK's libz.
Name: zlib
Description: zlib from the iOS SDK
Version: 1.2.12
Libs: -lz
Cflags:
Loading
Loading