Compare commits

..

93 Commits

211 changed files with 3538 additions and 1001 deletions
+37
View File
@@ -0,0 +1,37 @@
---
name: Bug report
about: Report a bug
title: ''
labels: bug
assignees: ''
---
## Description
A clear and concise description of what the bug is.
## Environment
Please provide as much of the following information as is relevant.
Host OS (macOS/Linux/WSL):
Host OS version:
<!-- macOS: Apple Logo > About this Mac -->
<!-- Linux: -->
<!-- cat /etc/*-release -->
<!-- Windows: -->
<!-- Get-WinVer; wsl -l -v -->
iOS device version:
<!-- Settings > General > About > iOS Version -->
Swift version:
<!-- swift --version -->
SDK version:
<!-- macOS: -->
<!-- xcodebuild -version; xcrun -sdk iphoneos -show-sdk-version -->
<!-- Linux/WSL: -->
<!-- swift sdk configure darwin arm64-apple-ios --show-configuration | grep -o 'iPhoneOS[0-9.]*\.sdk$' -->
+10
View File
@@ -0,0 +1,10 @@
---
name: Feature request
about: Suggest an idea
title: ''
labels: enhancement
assignees: ''
---
+14 -2
View File
@@ -16,7 +16,7 @@ jobs:
uses: actions/checkout@v4
- name: Build
run: |
docker compose run --build --rm supersign -c "swift build --product SupersignCLI"
docker compose run --build --rm xtool swift build --product xtool
build-macos:
runs-on: macos-15
steps:
@@ -24,4 +24,16 @@ jobs:
uses: actions/checkout@v4
- name: Build
run: |
swift build --product SupersignCLI
swift build --product xtool
build-ios:
runs-on: macos-15
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build
run: |
set -o pipefail \
&& xcodebuild build \
-skipMacroValidation -skipPackagePluginValidation \
-scheme XKit -destination generic/platform=iOS \
| xcbeautify
-49
View File
@@ -1,49 +0,0 @@
on:
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
host:
- runner: ubuntu-24.04
arch: x86_64
- runner: ubuntu-24.04-arm
arch: aarch64
runs-on: ${{ matrix.host.runner }}
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build
run: |
docker compose run --build --rm supersign -c "Linux/build.sh && mv Linux/packages/Supersign{,-${{ matrix.host.arch }}}.AppImage"
- name: Upload artifact
id: upload_artifact
uses: actions/upload-artifact@v4
with:
name: Supersign-${{ matrix.host.arch }}
path: Linux/packages/Supersign-${{ matrix.host.arch }}.AppImage
release:
needs: build
runs-on: ubuntu-24.04
permissions:
contents: write
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
- name: Download artifact
id: download_artifact
uses: actions/download-artifact@v4
with:
pattern: Supersign-*
path: output
- name: Create and publish release
id: publish_release
run: |
TAG="${GITHUB_REF##*/}-${GITHUB_SHA:0:7}"
gh release create "$TAG" --draft --title "Draft Release"
gh release upload "$TAG" output/**/*.AppImage
+82
View File
@@ -0,0 +1,82 @@
on:
push:
tags:
- "*"
jobs:
build-linux:
strategy:
fail-fast: false
matrix:
host:
- runner: ubuntu-24.04
arch: x86_64
- runner: ubuntu-24.04-arm
arch: aarch64
runs-on: ${{ matrix.host.runner }}
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build
run: |
docker compose run --build \
-e XTOOL_VERSION=${{ github.ref_name }} \
--rm xtool Linux/build.sh
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: xtool-${{ matrix.host.arch }}
path: |
Linux/packages/xtool-${{ matrix.host.arch }}.AppImage
Linux/packages/xtool-${{ matrix.host.arch }}.AppImage.zsync
build-mac:
runs-on: macos-15
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
working-directory: macOS
bundler-cache: true
- name: Build
env:
APP_STORE_CONNECT_API_KEY_KEY_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_KEY_ID }}
APP_STORE_CONNECT_API_KEY_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_ISSUER_ID }}
APP_STORE_CONNECT_API_KEY_KEY: ${{ secrets.APP_STORE_CONNECT_API_KEY_KEY }}
IDENTITY_P12: ${{ secrets.IDENTITY_P12 }}
DEVELOPMENT_TEAM: ${{ secrets.DEVELOPMENT_TEAM }}
XTOOL_VERSION: ${{ github.ref_name }}
run: |
cd macOS
bundle exec fastlane package
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: xtool-mac
path: |
macOS/Build/Output/xtool.app.zip
macOS/Build/Output/xtool.app.dSYM.zip
release:
needs: [build-linux, build-mac]
runs-on: ubuntu-24.04
permissions:
contents: write
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
pattern: xtool-*
path: output
- name: Create and publish release
run: |
TAG="${{ github.ref_name }}"
gh release create "$TAG" --draft --title "v$TAG"
gh release upload "$TAG" output/**/*.{AppImage,AppImage.zsync,app.zip,app.dSYM.zip}
+3 -2
View File
@@ -1,5 +1,5 @@
/Tests/SupersignTests/config/*
!/Tests/SupersignTests/config/config-template.json
/Tests/XKitTests/config/*
!/Tests/XKitTests/config/config-template.json
*.ipa
.DS_Store
/.build
@@ -9,5 +9,6 @@ DerivedData/
.swiftpm/configuration/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
.docc-build
/openapi
-14
View File
@@ -1,14 +0,0 @@
version: 1
builder:
configs:
- scheme: SupersignCLI
platform: macosSpm
documentation_targets:
- SupersignCLI
- scheme: SupersignCLI
platform: macosXcodebuild
# - scheme: SupersignCLI
# platform: linux
# image: # TODO: we need to use our own Docker image for this
- scheme: Supersign
platform: ios
@@ -1,67 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1410"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "Supersign"
BuildableName = "Supersign"
BlueprintName = "Supersign"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "Supersign"
BuildableName = "Supersign"
BlueprintName = "Supersign"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
+128
View File
@@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
conduct@xtool.sh.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
+31
View File
@@ -0,0 +1,31 @@
# Contributing to xtool
## Bug reports and feature requests
We welcome all bug reports and feature requests! Please create a [new issue](https://github.com/xtool-org/xtool/issues/new/choose) via GitHub.
## Documentation
The xtool documentation at <https://xtool.sh> is built with [swift-docc](https://github.com/swiftlang/swift-docc) and resides at [Documentation/xtool.docc](/Documentation/xtool.docc). It's hosted on Netlify, the configuration for which is in [netlify.toml](/netlify.toml).
When editing the DocC bundle, you can preview it with `make docs-preview`.
Once you make a pull request with your changes, we'll also generate a [Netlify Deploy Preview](https://docs.netlify.com/site-deploys/deploy-previews/) under your pull request. You can open this preview to see how the changes will look in production.
## Code
When making code changes, please make sure to test them on both macOS and Linux if possible. If you can also test on Windows with WSL, that is ideal.
To build xtool for debugging, run `make` in the project directory. There are a few considerations depending on your host OS:
### macOS
On macOS, you'll firstly need to have Xcode set up.
The first time you run `make`, we'll try to detect your codesigning identity. If you have multiple, you'll see an interactive prompt to select the team you want to use. The team ID is saved to `./macOS/Support/Private-Team.xcconfig`. You can run `make team` to update it (or do so by hand).
After building, a symlink to the product will be created at `./macOS/Build/xtool`. We generate an Xcode project at `./macOS/XToolMac.xcodeproj` that you can open in order to work in Xcode.
### Linux
You need to have a few dependencies on Linux; see [Dockerfile](/Dockerfile) for specifics. It's often easiest to develop within Docker itself: see [Linux/README.md](/Linux/README.md) for details.
+9 -9
View File
@@ -1,7 +1,7 @@
# Note: We use 20.04 since AppImage recommends building on the
# Note: We use 22.04 since AppImage recommends building on the
# oldest configuration that you support
FROM swift:6.1-focal AS build-base
FROM swift:6.1-jammy AS build-base
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
@@ -66,23 +66,23 @@ RUN cd libimobiledevice \
&& make install DESTDIR=/prefix
FROM build-base AS build-supersette
FROM build-base AS build-xadi
RUN mkdir -p /prefix/usr/lib
RUN curl -fsS https://dlang.org/install.sh | bash -s ldc
ADD https://github.com/SuperchargeApp/SupersetteD.git#main /SupersetteD
ADD https://github.com/xtool-org/xadi.git#main /xadi
RUN cd SupersetteD \
RUN cd xadi \
&& /bin/bash -c 'source $(/root/dlang/install.sh ldc -a) && dub build --build=release' \
&& cp -r bin/libsupersette.so /prefix/usr/lib/libsupersette.so
&& cp -r bin/libxadi.so /prefix/usr/lib/libxadi.so
FROM build-base
COPY --from=build-limd /prefix/usr /usr
COPY --from=build-supersette /prefix/usr /usr
COPY --from=build-xadi /prefix/usr /usr
# Docker doesn't support FUSE
ENV APPIMAGE_EXTRACT_AND_RUN=1
@@ -92,6 +92,6 @@ ENV APPIMAGE_EXTRACT_AND_RUN=1
# socat -dd TCP-LISTEN:27015,range=127.0.0.1/32,reuseaddr,fork UNIX-CLIENT:/var/run/usbmuxd
ENV USBMUXD_SOCKET_ADDRESS=host.docker.internal:27015
WORKDIR /Supersign
WORKDIR /xtool
ENTRYPOINT [ "/bin/bash" ]
CMD [ "/bin/bash" ]
+25
View File
@@ -0,0 +1,25 @@
#!/bin/bash
set -euo pipefail
cd "$(dirname "$0")"
rm -rf docs
if type -p xcrun &>/dev/null; then
docc="$(xcrun -f docc)"
else
docc="docc"
fi
if [[ $# == 0 ]]; then
command="convert"
elif [[ $# == 1 && ( "$1" == "preview" || "$1" == "convert" ) ]]; then
command="$1"
else
echo "Usage: $0 [convert|preview]"
exit 1
fi
"$docc" "$command" xtool.docc \
--experimental-enable-custom-templates
+109
View File
@@ -0,0 +1,109 @@
# Control your app's structure
Add resources, modify your `Info.plist`, and more.
## Overview
When building your app, xtool provides many knobs to add resources and modify files in its `.app` bundle. This article explains how to perform some common tasks along these lines.
Many of the tasks here involve modifying the `xtool.yml` file. The default `xtool new` template should generate this file for you. If you don't have it, make sure you create one first.
```bash
cat > xtool.yml << EOF
version: 1
bundleID: com.example.Hello
EOF
```
## Change your bundle ID
You can update your app's bundle ID by editing the `bundleID` field in `xtool.yml`.
> Note:
>
> xtool adds a prefix to your bundle ID when signing and installing the app on a real device. For example, it may update the above bundle id to `XTL-1234.com.example.Hello`. This is because, at least with free accounts (those not enrolled in the Apple Developer Program), two accounts cannot use the same bundle ID. Prefixing ensures that if you share your app with someone else, they won't run into a bundle ID conflict when installing it.
>
> With additional engineering effort, this limitation could be lifted for paid Developer Program users by leveraging wildcard provisioning profiles. If you have a concrete use case for this and/or wish to contribute, please [file an issue](https://github.com/xtool-org/xtool/issues/new).
## Customize Info.plist
xtool automatically generates a bare-bones `Info.plist` file for you. However, you may need to add new `Info.plist` keys or edit existing ones.
To do this, create an `Info.plist` file in your project containing just the keys you want to add/update, and tell xtool about it by adding the `infoPath` key:
```yaml
infoPath: path/to/Info.plist
```
> Tip:
>
> After running `xtool dev [build]`, you can inspect the built app bundle at `./xtool/YourApp.app` to view its `Info.plist` and other resources.
For example, you might create an `Info.plist` file that looks something like
```plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>CFBundleDisplayName</key>
<string>My App</string>
</dict>
</plist>
```
- The default `Info.plist` has a `UISupportedInterfaceOrientations` value of portrait. This will replace it with landscape-only.
- We don't include a `CFBundleDisplayName` by default, so this will add the key and specify a display name of "My App".
## Copy resources (SwiftPM)
If you need to include non-code resource files, like images, the easiest way to do so is to use [SwiftPM Resources](https://developer.apple.com/documentation/xcode/bundling-resources-with-a-swift-package). These "just work" with xtool.
For example, if you have `Sources/Hello/Blob.png`, you can include it in your app by updating the `targets` in your `Package.swift` to
```swift
targets: [
.target(
name: "Hello",
resources: [.copy("Blob.png")]
),
]
```
Then, to draw it on screen, you can use
```swift
Image("Blob", bundle: Bundle.module)
```
## Copy resources (top level)
SwiftPM resources are copied into `.bundle` directories nested inside your `.app`. Sometimes, you need to place a file in a specific location in the app directory instead.
To achieve this, you can include a `resources` array in your `xtool.yml` containing a list of files that should be directly included at the root level of the app bundle.
For example, if you use Firebase, you usually need to include a [`GoogleServices-Info.plist`](https://firebase.google.com/docs/ios/setup#add-config-file) file in your root bundle. If you saved this file in your project directory at `./Resources/GoogleServices-Info.plist`, you can update your `xtool.yml` with
```yaml
resources:
- Resources/GoogleServices-Info.plist
```
The file will be copied to `Hello.app/GoogleServices-Info.plist`.
## Add an app icon
Say your app icon is saved at `Resources/AppIcon.png`. You can make this your app icon by setting the `iconPath` key in `xtool.yml`:
```yaml
iconPath: Resources/AppIcon.png
```
> Tip:
>
> Your app icon must be a png, and it should ideally have a resolution of 1024x1024px.
@@ -0,0 +1,5 @@
Hello$
Planning...
Building for debugging...
[8/8] Linking Hello-App
Build of product 'Hello-App' complete! (4.94s)
@@ -0,0 +1,5 @@
Hello$ xtool dev
Planning...
Building for debugging...
[8/8] Linking Hello-App
Build of product 'Hello-App' complete! (4.94s)
@@ -0,0 +1,6 @@
Hello$ xtool dev
Planning...
Building for debugging...
[8/8] Linking Hello-App
Build of product 'Hello-App' complete! (4.94s)
Waiting for device to be connected...
@@ -0,0 +1,17 @@
Hello$ xtool dev
Planning...
Building for debugging...
[8/8] Linking Hello-App
Build of product 'Hello-App' complete! (4.94s)
Waiting for device to be connected...
Installing to device: Kabir's iPhone (udid: *****)
[Unpacking app] 100%
[Logging in] 100%
[Preparing device] 100%
[Provisioning] 100%
[Signing] 100%
[Packaging] 100%
[Connecting] 100%
[Installing] 100%
[Verifying] 100%
@@ -0,0 +1,13 @@
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text("Hello, world!")
}
.padding()
}
}
@@ -0,0 +1,15 @@
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text("Hello, world!")
.bold()
.foregroundStyle(.purple)
}
.padding()
}
}
@@ -0,0 +1,17 @@
Hello$
Planning...
Building for debugging...
[8/8] Linking Hello-App
Build of product 'Hello-App' complete! (5s)
Waiting for device to be connected...
Installing to device: Kabir's iPhone (udid: *****)
[Unpacking app] 100%
[Logging in] 100%
[Preparing device] 100%
[Provisioning] 100%
[Signing] 100%
[Packaging] 100%
[Connecting] 100%
[Installing] 100%
[Verifying] 100%
@@ -0,0 +1,17 @@
Hello$ xtool dev
Planning...
Building for debugging...
[8/8] Linking Hello-App
Build of product 'Hello-App' complete! (5s)
Waiting for device to be connected...
Installing to device: Kabir's iPhone (udid: *****)
[Unpacking app] 100%
[Logging in] 100%
[Preparing device] 100%
[Provisioning] 100%
[Signing] 100%
[Packaging] 100%
[Connecting] 100%
[Installing] 100%
[Verifying] 100%
@@ -0,0 +1,17 @@
Hello$ xtool dev
Planning...
Building for debugging...
[8/8] Linking Hello-App
Build of product 'Hello-App' complete! (5s)
Waiting for device to be connected...
Installing to device: Kabir's iPhone (udid: *****)
[Unpacking app] 100%
[Logging in] 100%
[Preparing device] 100%
[Provisioning] 100%
[Signing] 100%
[Packaging] 100%
[Connecting] 100%
[Installing] 100%
[Verifying] 100%
@@ -0,0 +1,10 @@
Developer$
Creating package: Hello
Creating Package.swift
Creating xtool.yml
Creating .gitignore
Creating .sourcekit-lsp/config.json
Creating Sources/Hello/HelloApp.swift
Creating Sources/Hello/ContentView.swift
Finished generating project Hello.
@@ -0,0 +1,10 @@
Developer$ xtool new Hello
Creating package: Hello
Creating Package.swift
Creating xtool.yml
Creating .gitignore
Creating .sourcekit-lsp/config.json
Creating Sources/Hello/HelloApp.swift
Creating Sources/Hello/ContentView.swift
Finished generating project Hello.
@@ -0,0 +1,18 @@
Developer$ xtool new Hello
Creating package: Hello
Creating Package.swift
Creating xtool.yml
Creating .gitignore
Creating .sourcekit-lsp/config.json
Creating Sources/Hello/HelloApp.swift
Creating Sources/Hello/ContentView.swift
Finished generating project Hello.
Developer$
Hello$
-rw-rw-r-- 1 user user 187 .gitignore
drwxrwxr-x 2 user user 4096 .sourcekit-lsp
-rw-rw-r-- 1 user user 463 Package.swift
drwxrwxr-x 3 user user 4096 Sources
-rw-rw-r-- 1 user user 39 xtool.yml
@@ -0,0 +1,18 @@
Developer$ xtool new Hello
Creating package: Hello
Creating Package.swift
Creating xtool.yml
Creating .gitignore
Creating .sourcekit-lsp/config.json
Creating Sources/Hello/HelloApp.swift
Creating Sources/Hello/ContentView.swift
Finished generating project Hello.
Developer$ cd Hello
Hello$ ls -la
-rw-rw-r-- 1 user user 187 .gitignore
drwxrwxr-x 2 user user 4096 .sourcekit-lsp
-rw-rw-r-- 1 user user 463 Package.swift
drwxrwxr-x 3 user user 4096 Sources
-rw-rw-r-- 1 user user 39 xtool.yml
@@ -0,0 +1,22 @@
Developer$ xtool new Hello
Creating package: Hello
Creating Package.swift
Creating xtool.yml
Creating .gitignore
Creating .sourcekit-lsp/config.json
Creating Sources/Hello/HelloApp.swift
Creating Sources/Hello/ContentView.swift
Finished generating project Hello.
Developer$ cd Hello
Hello$ ls -la
-rw-rw-r-- 1 user user 187 .gitignore
drwxrwxr-x 2 user user 4096 .sourcekit-lsp
-rw-rw-r-- 1 user user 463 Package.swift
drwxrwxr-x 3 user user 4096 Sources
-rw-rw-r-- 1 user user 39 xtool.yml
Hello$
version: 1
bundleID: com.example.Hello
@@ -0,0 +1,22 @@
Developer$ xtool new Hello
Creating package: Hello
Creating Package.swift
Creating xtool.yml
Creating .gitignore
Creating .sourcekit-lsp/config.json
Creating Sources/Hello/HelloApp.swift
Creating Sources/Hello/ContentView.swift
Finished generating project Hello.
Developer$ cd Hello
Hello$ ls -la
-rw-rw-r-- 1 user user 187 .gitignore
drwxrwxr-x 2 user user 4096 .sourcekit-lsp
-rw-rw-r-- 1 user user 463 Package.swift
drwxrwxr-x 3 user user 4096 Sources
-rw-rw-r-- 1 user user 39 xtool.yml
Hello$ cat xtool.yml
version: 1
bundleID: com.example.Hello
@@ -0,0 +1,25 @@
Developer$ xtool new Hello
Creating package: Hello
Creating Package.swift
Creating xtool.yml
Creating .gitignore
Creating .sourcekit-lsp/config.json
Creating Sources/Hello/HelloApp.swift
Creating Sources/Hello/ContentView.swift
Finished generating project Hello.
Developer$ cd Hello
Hello$ ls -la
-rw-rw-r-- 1 user user 187 .gitignore
drwxrwxr-x 2 user user 4096 .sourcekit-lsp
-rw-rw-r-- 1 user user 463 Package.swift
drwxrwxr-x 3 user user 4096 Sources
-rw-rw-r-- 1 user user 39 xtool.yml
Hello$ cat xtool.yml
version: 1
bundleID: com.example.Hello
Hello$
{ "swiftPM": { "swiftSDK": "arm64-apple-ios" } }
@@ -0,0 +1,25 @@
Developer$ xtool new Hello
Creating package: Hello
Creating Package.swift
Creating xtool.yml
Creating .gitignore
Creating .sourcekit-lsp/config.json
Creating Sources/Hello/HelloApp.swift
Creating Sources/Hello/ContentView.swift
Finished generating project Hello.
Developer$ cd Hello
Hello$ ls -la
-rw-rw-r-- 1 user user 187 .gitignore
drwxrwxr-x 2 user user 4096 .sourcekit-lsp
-rw-rw-r-- 1 user user 463 Package.swift
drwxrwxr-x 3 user user 4096 Sources
-rw-rw-r-- 1 user user 39 xtool.yml
Hello$ cat xtool.yml
version: 1
bundleID: com.example.Hello
Hello$ cat .sourcekit-lsp/config.json
{ "swiftPM": { "swiftSDK": "arm64-apple-ios" } }
+161
View File
@@ -0,0 +1,161 @@
@Tutorial(time: 30) {
@Intro(title: "Build your first iOS app on Linux / Windows") {
Once you've completed <doc:Installation-Linux>, use xtool to build and deploy an iOS app from your Linux/Windows machine.
}
@Section(title: "Create an xtool project") {
We'll start by creating a project from xtool's default template.
@Steps {
@Step {
xtool comes with a template for iOS-capable Swift Packages. Run `xtool new` to create a new package.
@Code(name: "Terminal", file: "template-1b.sh", previousFile: "template-1a.sh") {}
}
@Step {
At this point, feel free to poke around.
Observe that the package is structured a lot like a regular SwiftPM library, with a few extra files.
@Code(name: "Terminal", file: "template-2b.sh", previousFile: "template-2a.sh") {}
}
@Step {
Read `xtool.yml`.
This file describes how to bundle the Swift library into an iOS app. At minimum, you need to provide a Bundle ID. This defaults to `com.example.<PackageName>`, in this case `com.example.Hello`.
@Code(name: "Terminal", file: "template-3b.sh", previousFile: "template-3a.sh") {}
}
@Step {
Read `.sourcekit-lsp/config.json`.
This file tells SourceKit to build for the `arm64-apple-ios` system defined in `darwin.artifactbundle`. This is the [Swift SDK](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0387-cross-compilation-destinations.md) that we built during the setup process. It contains the necessary modules for building iOS apps, such as UIKit and SwiftUI, as well as tools for building and manipulating iOS binaries. Under the hood, xtool also calls `swift build` with `--swift-sdk arm64-apple-ios` for the same reason.
@Code(name: "Terminal", file: "template-4b.sh", previousFile: "template-4a.sh") {}
}
}
}
@Section(title: "Build and run") {
Now that we have a skeleton project, let's get it running on your device.
@Steps {
@Step {
From inside the package directory, run `xtool dev`.
The first time you run this, SwiftPM might take a few minutes to build the app. This is because it needs to build the Swift Modules for the iOS SDK. Subsequent runs should be a lot faster since SwiftPM caches these modules globally.
@Code(name: "Terminal", file: "build-1b.sh", previousFile: "build-1a.sh")
}
@Step {
After the build is complete, xtool will attempt to install it on your device.
At this point, connect your iOS device to your computer via USB. If you installed `libimobiledevice-utils` during setup, you can verify that your device is connected by running `ideviceinfo`. xtool will continue after automatically detecting that your device is connected.
@Code(name: "Terminal", file: "build-2.sh", reset: true)
}
@Step {
Pair your device if prompted.
The first time you run `xtool dev`, you may see a "Trust" dialog on your iOS device to proceed with pairing. Tap **Trust** and enter your passcode on iOS. xtool may throw an error after this: if so, just run `xtool dev` again.
@Code(name: "Terminal", file: "build-2.sh", reset: true) {
@Image(source: "Trust", alt: "Prompt alerting user to trust device")
}
}
@Step {
xtool will now connect to Apple Developer Services, register your device with your Apple ID, generate a Certificate + App ID + Provisioning Profile, sign the app, and then install it.
@Code(name: "Terminal", file: "build-3.sh", reset: true) {}
}
@Step {
Enable Developer Mode if needed.
At this point, you may run into an error asking you to enable **Development Mode** on your iOS device. Follow [these instructions](https://developer.apple.com/documentation/xcode/enabling-developer-mode-on-a-device) and then run `xtool dev` again.
@Code(name: "Terminal", file: "build-3.sh", reset: true) {
@Image(source: "Developer", alt: "Developer mode in Settings")
}
}
@Step {
You should now see the app on your iOS device's home screen / App Library. Tap it to launch the app.
@Image(source: "Home", alt: "Hello app on the home screen")
}
@Step {
The first time you launch the app, observe that you may get an "Untrusted Developer" alert.
@Image(source: "UntrustedDev", alt: "Alert prompting user to trust certificate")
}
@Step {
Go to **Settings** > **General** > **VPN & Device Management** > _[your email]_ > **Trust**.
@Image(source: "Verified", alt: "Trust settings")
}
@Step {
You should now be able to launch the app!
@Image(source: "HelloWorld", alt: "Hello world app")
}
}
}
@Section(title: "Edit and re-run") {
We'll make a small change to the app in your favorite code editor, and then re-run it.
@Steps {
@Step {
Follow the instructions to configure [SourceKit-LSP](https://github.com/swiftlang/sourcekit-lsp/blob/242609dcad55824d9eb23269c0aeead187fd0faa/Documentation/Editor%20Integration.md) for your IDE.
For example, if you're using Visual Studio Code, this means you need to install the [Swift extension](https://marketplace.visualstudio.com/items?itemName=swiftlang.swift-vscode). If you're on Windows, make sure you're [connected to the WSL remote](https://code.visualstudio.com/docs/remote/wsl).
@Image(source: "SwiftExtension", alt: "Swift extension for VSCode")
}
@Step {
Open the project folder in your editor, and drill down to `Sources/Hello/ContentView.swift`.
@Code(name: "ContentView.swift", file: "edit-2.swift") {}
}
@Step {
If you've configured SourceKit-LSP correctly, you should see rich documentation when you hover over the various types and methods.
@Code(name: "ContentView.swift", file: "edit-2.swift") {
@Image(source: "Hover", alt: "Intellisense")
}
}
@Step {
Let's update the "Hello, world!" text to be bold and purple.
@Code(name: "ContentView.swift", file: "edit-4.swift") {}
}
@Step {
Run `xtool dev` again to re-build and re-install. This should go a lot faster than the first time.
@Code(name: "Terminal", file: "rerun-5b.sh", previousFile: "rerun-5a.sh") {}
}
@Step {
Launch the app again to see the updated text!
@Code(name: "Terminal", file: "rerun-6.sh") {
@Image(source: "HelloWorld-Purple", alt: "Updated Hello app")
}
}
}
}
}
@@ -0,0 +1,139 @@
# Installation (Linux/Windows)
Set up xtool for iOS app development on Linux or Windows.
## Overview
This article outlines the steps to install `xtool` and begin developing iOS apps on Linux (or Windows via WSL).
## Prerequisites
### WSL (for Windows users)
If you're on Windows, you can use xtool via [Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/install) (WSL).
Once you install WSL, you'll also need to set up USB passthrough. See Microsoft's instructions on [installing USBIPD](https://learn.microsoft.com/en-us/windows/wsl/connect-usb). Make sure you're able to bind your iOS device to WSL via USB.
### Swift
Install the Swift 6.1 toolchain for your Linux distribution from <https://swift.org/install/linux>.
After following the steps there, confirm that Swift is installed correctly:
```bash
swift --version
# should say something like:
# Swift version 6.1 (swift-6.1-RELEASE)
```
### usbmuxd
xtool relies on [usbmuxd](https://github.com/libimobiledevice/usbmuxd) to talk to your iOS device from Linux.
Your Linux distro probably offers this package, and it may be preinstalled. To check if it is, run
```bash
usbmuxd --help
# Usage: usbmuxd [OPTIONS]
# ...
```
If instead you get "command not found", you need to install `usbmuxd` yourself. On Ubuntu/Debian, for example, you can do this with
```bash
sudo apt-get install usbmuxd
```
> Other useful tools:
>
> `usbmuxd` is part of the [libimobiledevice](https://libimobiledevice.org) project. You may want to install other libimobiledevice tools, such as `ideviceinfo`, that offer many ways to interact with your iOS device from the command line. On Ubuntu/Debian, you can run
>
> ```bash
> sudo apt-get install libimobiledevice-utils
> # The following NEW packages will be installed:
> # libimobiledevice-utils
> # 0 upgraded, 1 newly installed
> ideviceinfo
> # DeviceName: Kabir's iPhone
> # SerialNumber: ...
> # UniqueDeviceID: ...
> # ...
> ```
### Xcode.xip
Download **Xcode 16.3** from <https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_16.3/Xcode_16.3.xip>. Note the path where `Xcode_16.3.xip` is saved.
> Note:
>
> The URL above requires authentication, so make sure to visit it in your browser rather than running `curl`. You'll be asked to log in with your Apple ID and accept the license agreement to download Xcode.
## Installation
### 1. Download xtool
Once you have the prerequisites, download the [latest GitHub Release](https://github.com/xtool-org/xtool/releases/latest) of `xtool.AppImage` for your architecture. Rename it to `xtool` and add it to a location in your `PATH`.
```bash
curl -fL \
"https://github.com/xtool-org/xtool/releases/latest/download/xtool-$(uname -m).AppImage" \
-o xtool
chmod +x xtool
sudo mv xtool /usr/local/bin/
```
Confirm that xtool is installed correctly:
```bash
xtool --help
# OVERVIEW: Cross-platform Xcode replacement
# ...
```
### 2. Configure xtool: log in
Perform one-time setup with
```bash
xtool setup
```
You'll be asked to log in:
```
Select login mode
0: API Key (requires paid Apple Developer Program membership)
1: Password (works with any Apple ID but uses private APIs)
Choice (0-1):
```
> Choosing a login mode:
>
> **API Key:** If you have a paid [Apple Developer Program](https://developer.apple.com/programs/enroll/) membership, this is the recommended option. It relies on the public App Store Connect API. You'll want to follow the [instructions](https://developer.apple.com/documentation/appstoreconnectapi/creating-api-keys-for-app-store-connect-api) to generate a **Team Key** with the **App Manager** role.
>
> **Password:** If you aren't enrolled in the paid developer program, you'll want to use password-based authentication. This relies on private Apple APIs to authenticate, so you may want to create a throwaway Apple ID to be extra cautious.
Once you select a login mode, you'll be asked to provide the corresponding credentials (API key or email+password+2FA). Needless to say, *your credentials are only sent to Apple* and nobody else (feel free to build xtool from source and check!)
### 3. Configure xtool: SDK
After you're logged in, you'll be asked to provide the path to the `Xcode.xip` file you downloaded earlier.
```
Choice (0-1): 0
...
Path to Xcode.xip:
```
Enter the path (for example `~/Downloads/Xcode_16.3.xip`) and hit enter. xtool will extract the Xcode XIP to generate and install an iOS Swift SDK for you.
Confirm that it worked:
```bash
swift sdk list
# darwin
```
## Next steps
You're now ready to use xtool! See <doc:First-app>.
@@ -0,0 +1,81 @@
# Installation (macOS)
Set up xtool for declarative, Xcode-free iOS app development on macOS.
## Overview
This article outlines the steps to install `xtool` for declarative, SwiftPM-driven iOS app development on macOS.
## Prerequisites
### Xcode
Though we don't rely on the Xcode build system, you still need to install Xcode for the iOS SDK and toolchain. You'll want to [install Xcode](https://developer.apple.com/xcode/) and launch it once, completing any installation prompts.
Confirm that Xcode is set up with the iOS SDK:
```bash
xcrun -sdk iphoneos -show-sdk-path
# /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.4.sdk
```
As well as Swift:
```bash
swift --version
# swift-driver version: 1.120.5 Apple Swift version 6.1 (swiftlang-6.1.0.110.21 clang-1700.0.13.3)
# Target: arm64-apple-macosx15.0
```
## Installation
### 1. Download xtool
If you have [Homebrew](https://brew.sh), you can install xtool with
```bash
brew install xtool-org/tap/xtool
```
Otherwise, you can download `xtool.app` from the [latest GitHub release](https://github.com/xtool-org/xtool/releases/latest). After moving it into `/Applications`, launch it and run the suggested script to add the `xtool` command to your `PATH`.
> Note:
>
> If you install xtool manually, you'll also need to check for new GitHub releases and update it yourself. If you're interested in contributing support for auto-updates through Sparkle, pull requests are appreciated. See [issue #34 on GitHub](https://github.com/xtool-org/xtool/issues/34).
Confirm that xtool is installed correctly:
```bash
xtool --help
# OVERVIEW: Cross-platform Xcode replacement
# ...
```
### 2. Configure xtool: log in
Perform one-time setup with
```bash
xtool setup
```
You'll be asked to log in:
```
Select login mode
0: API Key (requires paid Apple Developer Program membership)
1: Password (works with any Apple ID but uses private APIs)
Choice (0-1):
```
> Choosing a login mode:
>
> **API Key:** If you have a paid [Apple Developer Program](https://developer.apple.com/programs/enroll/) membership, this is the recommended option. It relies on the public App Store Connect API. You'll want to follow the [instructions](https://developer.apple.com/documentation/appstoreconnectapi/creating-api-keys-for-app-store-connect-api) to generate a **Team Key** with the **App Manager** role.
>
> **Password:** If you aren't enrolled in the paid developer program, you'll want to use password-based authentication. This relies on private Apple APIs to authenticate, so you may want to create a throwaway Apple ID to be extra cautious.
Once you select a login mode, you'll be asked to provide the corresponding credentials (API key or email+password+2FA). Needless to say, *your credentials are only sent to Apple* and nobody else (feel free to build xtool from source and check!)
## Next steps
You're now ready to use xtool! See <doc:First-app>. (The tutorial is tailored to Linux, but it works the same on macOS.)

Before

Width:  |  Height:  |  Size: 286 KiB

After

Width:  |  Height:  |  Size: 286 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 948 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 61 KiB

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

+19
View File
@@ -0,0 +1,19 @@
<style>
footer {
display: flex;
justify-content: center;
padding: 0.5rem 0.8rem;
background-color: var(--color-fill-secondary);
text-align: center;
}
a, a:visited {
color: var(--color-text);
}
</style>
<footer>
<span>
&copy; xtool maintainers. This site is powered by <a href="https://www.netlify.com">Netlify</a>.
</span>
</footer>
+33
View File
@@ -0,0 +1,33 @@
# xtool
@Metadata {
@TechnologyRoot
@TitleHeading("Command-line Tool")
@CallToAction(url: "https://github.com/xtool-org/xtool", label: "View on GitHub")
}
Cross-platform Xcode replacement.
## Overview
xtool is a cross-platform (Linux/WSL/macOS) tool that replicates Xcode functionality with open standards.
✅ Build a SwiftPM package into an iOS app
✅ Sign and install iOS apps
✅ Interact with Apple Developer Services programmatically
![A screenshot of xtool being invoked from VSCode](Cover.png)
## Topics
### Getting started
- <doc:Installation-Linux>
- <doc:Installation-macOS>
- <doc:First-app>
### Common tasks
- <doc:Control>
+11
View File
@@ -0,0 +1,11 @@
@Tutorials(name: "xtool") {
@Intro(title: "Tutorials") {
Install xtool and build your first iOS app on Linux.
}
@Chapter(name: "Getting Started") {
@Image(source: "HelloWorld", alt: "Getting Started")
@TutorialReference(tutorial: "doc:First-app")
}
}
+5 -5
View File
@@ -1,6 +1,6 @@
# Supersign + Linux = <3
# xtool + Linux = <3
Supersign currently uses AppImage to build its Linux CLI. It is possible to build and run the AppImage on a native Linux host, as well as through Docker (natively or through Docker Desktop on macOS).
xtool currently uses AppImage to build its Linux CLI. It is possible to build and run the AppImage on a native Linux host, as well as through Docker (natively or through Docker Desktop on macOS).
## Setup
@@ -10,9 +10,9 @@ Make sure `usbmuxd` is installed on your host machine. On macOS, `usbmuxd` is pr
You can build and run a container with standard Docker Compose commands, for example:
```
docker compose run --rm supersign
docker compose run --rm xtool
```
This will spawn a shell inside the container. The Supersign root directory will be bind-mounted at `/Supersign`.
This will spawn a shell inside the container. The xtool root directory will be bind-mounted at `/xtool`.
To actually access iOS devices from inside Docker, you'll also need to forward the host's `usbmuxd` to a port which the Docker container's libusbmuxd will connect to. Keep this command running on your host machine:
```
@@ -21,4 +21,4 @@ socat -dd TCP-LISTEN:27015,range=127.0.0.1/32,reuseaddr,fork UNIX-CLIENT:/var/ru
## Building
Simply run `./build.sh` in this directory. This will output an AppImage to `packages/Supersign.AppImage`, which can directly be invoked.
Simply run `./build.sh` in this directory. This will output an AppImage to `packages/xtool.AppImage`, which can directly be invoked.
+12 -11
View File
@@ -5,9 +5,6 @@ shopt -s nullglob
cd "$(dirname "$0")"
# installer version
export LINUXDEPLOY_OUTPUT_VERSION="1.0.0"
if ! command -v fusermount &>/dev/null; then
# Docker doesn't support FUSE
export APPIMAGE_EXTRACT_AND_RUN=1
@@ -16,11 +13,12 @@ fi
rm -rf staging/tmp
mkdir -p staging/tmp staging/linuxdeploy
swift build --package-path .. -c release --product SupersignCLI --static-swift-stdlib
swift build --package-path .. -c release --product xtool --static-swift-stdlib
bin="$(swift build --package-path .. -c release --show-bin-path)"
strip "${bin}/SupersignCLI"
strip "${bin}/xtool"
curr_git_info="$(curl -fsSL https://api.github.com/repos/linuxdeploy/linuxdeploy/git/refs/tags/continuous)"
curr_arch="$(uname -m)"
if [[ -f staging/linuxdeploy/git.json ]]; then
if ! cmp -s staging/linuxdeploy/git.json <(echo "$curr_git_info"); then
@@ -33,7 +31,7 @@ else
fi
if [[ ! -f staging/linuxdeploy/linuxdeploy.AppImage ]]; then
curl -fsSL "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-$(arch).AppImage" \
curl -fsSL "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-${curr_arch}.AppImage" \
-o staging/linuxdeploy/linuxdeploy.AppImage
chmod +x staging/linuxdeploy/linuxdeploy.AppImage
echo "$curr_git_info" > staging/linuxdeploy/git.json
@@ -42,14 +40,17 @@ fi
mkdir -p staging/tmp/AppDir/usr/bin
find "${bin}"/ -name '*.resources' -print0 | xargs -0 -I {} cp -a {} "${PWD}/staging/tmp/AppDir/usr/bin/"
LDAI_OUTPUT="staging/tmp/Supersign.AppImage" ./staging/linuxdeploy/linuxdeploy.AppImage \
export LINUXDEPLOY_OUTPUT_VERSION="${XTOOL_VERSION:-unversioned}"
export LDAI_OUTPUT="staging/tmp/xtool-${curr_arch}.AppImage"
export LDAI_UPDATE_INFORMATION="gh-releases-zsync|xtool-org|xtool|latest|xtool-${curr_arch}.AppImage.zsync"
./staging/linuxdeploy/linuxdeploy.AppImage \
--appdir staging/tmp/AppDir \
--output appimage \
-e "${bin}/SupersignCLI" \
-d Supersign.desktop \
-i Supersign.png
-e "${bin}/xtool" \
-d xtool.desktop \
-i xtool.png
mkdir -p packages
mv -f staging/tmp/Supersign.AppImage packages/Supersign.AppImage
mv -f "staging/tmp/xtool-${curr_arch}.AppImage" "./xtool-${curr_arch}.AppImage.zsync" packages/
rm -rf staging/tmp
@@ -1,9 +1,9 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=Supersign
Name=xtool
Categories=Development;
Exec=SupersignCLI
Icon=Supersign
Exec=xtool
Icon=xtool
# TODO: remove
Terminal=true

Before

Width:  |  Height:  |  Size: 119 KiB

After

Width:  |  Height:  |  Size: 119 KiB

+133 -3
View File
@@ -1,7 +1,135 @@
ifeq ($(shell uname -s),Darwin)
IS_MAC = 1
ifneq ($(VERBOSE),1)
ifeq ($(shell type -p xcbeautify &>/dev/null && echo 1),1)
XC_FORMAT = | xcbeautify
endif
endif
endif
ifeq ($(RELEASE),1)
INTERNAL_SWIFTFLAGS = -c release
INTERNAL_XCFLAGS = -configuration Release
else
INTERNAL_SWIFTFLAGS = -c debug
INTERNAL_XCFLAGS = -configuration Debug
endif
ALL_SWIFTFLAGS = $(INTERNAL_SWIFTFLAGS) $(SWIFTFLAGS)
ALL_XCFLAGS = $(INTERNAL_XCFLAGS) $(XCFLAGS)
TEAM_CONFIG = macOS/Support/Private-Team.xcconfig
.PHONY: all
# dev build for the current platform
all:
ifeq ($(IS_MAC),1)
@+$(MAKE) mac
else
@+$(MAKE) linux
endif
.PHONY: clean
# clean build artifacts
clean:
ifeq ($(IS_MAC),1)
@+$(MAKE) mac-clean
else
@+$(MAKE) linux-clean
endif
.PHONY: linux
# dev build for Linux
linux:
swift build --product xtool $(ALL_SWIFTFLAGS)
.PHONY: linux-clean
# clean build artifacts for Linux
linux-clean:
rm -rf .build
.PHONY: linux-dist
# dist build for Linux
linux-dist:
docker compose run --build --rm xtool Linux/build.sh
.PHONY: mac
# dev build for macOS
mac: project
@rm -rf macOS/Build/XcodeInstall
@set -o pipefail && cd macOS && \
xcodebuild install \
-skipMacroValidation -skipPackagePluginValidation \
-scheme XToolMac -destination generic/platform=macOS \
-derivedDataPath Build/DerivedData \
DSTROOT="$$PWD"/Build/XcodeInstall INSTALL_PATH=/ \
$(ALL_XCFLAGS) $(XC_FORMAT)
@ln -fs XcodeInstall/xtool.app/Contents/Resources/bin/xtool macOS/Build/xtool
@echo "Output: ./macOS/Build/xtool"
.PHONY: mac-clean
# clean build artifacts for macOS
mac-clean:
rm -rf macOS/Build
.PHONY: mac-dist
# dist build for macOS
# requires a few secrets in the env (see .github/workflows/release.yml)
mac-dist:
@echo "bundle exec fastlane package"
@cd macOS && bundle exec fastlane package
.PHONY: reload
# update Xcode project and restart Xcode
reload:
killall Xcode || :
@+$(MAKE) project
xed macOS/XToolMac.xcodeproj
.PHONY: project
# update Xcode project
project: $(TEAM_CONFIG)
@echo "xcodegen"
@cd macOS && xcodegen
.PHONY: team
# update development team
team:
@+$(MAKE) -B $(TEAM_CONFIG)
# update development team if needed.
#
# will prompt interactively if there are multiple valid options.
# set DEVELOPMENT_TEAM=... to force a specific value.
$(TEAM_CONFIG):
ifeq ($(DEVELOPMENT_TEAM),)
@mkdir -p macOS/Support
@team=$$(./scripts/select-identity.sh); \
echo "echo \"DEVELOPMENT_TEAM = $$team\" > $@"; \
echo "DEVELOPMENT_TEAM = $$team" > $@
else
@mkdir -p macOS/Support
echo "DEVELOPMENT_TEAM = $(DEVELOPMENT_TEAM)" > $@
.PHONY: $(TEAM_CONFIG)
endif
.PHONY: docs
# build documentation
docs:
./Documentation/build.sh
.PHONY: docs-preview
# preview documentation
docs-preview:
./Documentation/build.sh preview
SPEC_URL = https://developer.apple.com/sample-code/app-store-connect/app-store-connect-openapi-specification.zip
.PHONY: api update-api
.PHONY: api
# Regenerate the OpenAPI client code
api: openapi/openapi.json
swift run swift-openapi-generator generate \
openapi/openapi.json \
@@ -11,11 +139,13 @@ api: openapi/openapi.json
sed -i '' -e 's/[[:<:]]Client[[:>:]]/DeveloperAPIClient/g' $$file; \
done
.PHONY: update-api
# Update OpenAPI spec and regenerate the client code
update-api:
@+$(MAKE) -B api
openapi/openapi.json: openapi/base.json Sources/DeveloperAPI/openapi-overlay.yaml
npx bump-cli overlay openapi/base.json Sources/DeveloperAPI/openapi-overlay.yaml > openapi/openapi.json
npx --yes bump-cli overlay openapi/base.json Sources/DeveloperAPI/openapi-overlay.yaml > openapi/openapi.json
openapi/base.json:
@mkdir -p openapi
+41 -23
View File
@@ -1,5 +1,5 @@
{
"originHash" : "7d8342a181303ec948ba0a80e3bdadfdefbde5ca30e750282a9caf834410fae7",
"originHash" : "6980154be7e8da0aace058cc72033471d7d9573fa77fdbf53972129e4cd1d0a2",
"pins" : [
{
"identity" : "aexml",
@@ -82,19 +82,10 @@
"version" : "0.10.1"
}
},
{
"identity" : "superchargecore",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SuperchargeApp/SuperchargeCore",
"state" : {
"revision" : "e409f42fd5736fac149c8288eba69c50e7eac5c2",
"version" : "1.2.0"
}
},
{
"identity" : "swift-algorithms",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-algorithms",
"location" : "https://github.com/apple/swift-algorithms.git",
"state" : {
"revision" : "87e50f483c54e6efd60e885f7f5aa946cee68023",
"version" : "1.2.1"
@@ -132,8 +123,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-certificates",
"state" : {
"revision" : "86eca758281a7187191fcb4e0ae5a87dbd876095",
"version" : "1.9.0"
"revision" : "999fd70c7803da89f3904d635a6815a2a7cd7585",
"version" : "1.10.0"
}
},
{
@@ -181,6 +172,24 @@
"version" : "1.9.2"
}
},
{
"identity" : "swift-docc-plugin",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-docc-plugin",
"state" : {
"revision" : "85e4bb4e1cd62cec64a4b8e769dcefdf0c5b9d64",
"version" : "1.4.3"
}
},
{
"identity" : "swift-docc-symbolkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/swiftlang/swift-docc-symbolkit",
"state" : {
"revision" : "b45d1f2ed151d057b54504d653e0da5552844e34",
"version" : "1.0.0"
}
},
{
"identity" : "swift-http-structured-headers",
"kind" : "remoteSourceControl",
@@ -213,8 +222,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio",
"state" : {
"revision" : "6e17bc946821e550b88d22fd964423f70f1ce42d",
"version" : "2.82.0"
"revision" : "0f54d58bb5db9e064f332e8524150de379d1e51c",
"version" : "2.82.1"
}
},
{
@@ -328,10 +337,10 @@
{
"identity" : "swiftymobiledevice",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SuperchargeApp/SwiftyMobileDevice",
"location" : "https://github.com/xtool-org/SwiftyMobileDevice",
"state" : {
"revision" : "a7fb063c3819618773c2a9a10c19be7682fd8395",
"version" : "1.3.1"
"revision" : "5ee5f680d065519dd6ac56c96435a7db0d599ade",
"version" : "1.4.0"
}
},
{
@@ -357,8 +366,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/vapor/websocket-kit.git",
"state" : {
"revision" : "4232d34efa49f633ba61afde365d3896fc7f8740",
"version" : "2.15.0"
"revision" : "014ccd52891b8c098d7e1033d5e72ed76fef7a86",
"version" : "2.16.0"
}
},
{
@@ -388,6 +397,15 @@
"version" : "1.5.2"
}
},
{
"identity" : "xtool-core",
"kind" : "remoteSourceControl",
"location" : "https://github.com/xtool-org/xtool-core",
"state" : {
"revision" : "63c644eef014f7faff53daaebe8bad37c31fbbe5",
"version" : "1.3.0"
}
},
{
"identity" : "yams",
"kind" : "remoteSourceControl",
@@ -400,10 +418,10 @@
{
"identity" : "zsign",
"kind" : "remoteSourceControl",
"location" : "https://github.com/kabiroberai/zsign",
"location" : "https://github.com/xtool-org/zsign",
"state" : {
"revision" : "c3fea016227f595cd51f037450650a2ff362f7db",
"version" : "1.3.0"
"revision" : "e9853fd3be36ea1a61fa9d4b7f71f4b4d8244369",
"version" : "1.4.0"
}
}
],
+49 -31
View File
@@ -2,34 +2,47 @@
import PackageDescription
let xtoolVersion: String? = {
if let explicitVersion = Context.environment["XTOOL_VERSION"] {
return explicitVersion
} else if let info = Context.gitInformation {
let gitCommit = info.currentCommit
let gitTag = info.currentTag
let gitRef = gitTag ?? "commit \(gitCommit)"
return "\(gitRef)\(info.hasUncommittedChanges ? " (dirty)" : "")"
} else {
return nil
}
}()
let cSettings: [CSetting] = [
.define("_GNU_SOURCE", .when(platforms: [.linux])),
]
let package = Package(
name: "Supersign",
name: "xtool",
platforms: [
.iOS(.v15),
.macOS(.v12),
],
products: [
.library(
name: "Supersign",
targets: ["Supersign"]
name: "XKit",
targets: ["XKit"]
),
.library(
name: "SupersignCLISupport",
targets: ["SupersignCLISupport"]
name: "XToolSupport",
targets: ["XToolSupport"]
),
.executable(
name: "SupersignCLI",
targets: ["SupersignCLI"]
name: "xtool",
targets: ["xtool"]
),
],
dependencies: [
.package(url: "https://github.com/SuperchargeApp/SuperchargeCore", .upToNextMinor(from: "1.2.0")),
.package(url: "https://github.com/SuperchargeApp/SwiftyMobileDevice", .upToNextMinor(from: "1.3.1")),
.package(url: "https://github.com/kabiroberai/zsign", .upToNextMinor(from: "1.3.0")),
.package(url: "https://github.com/xtool-org/xtool-core", .upToNextMinor(from: "1.3.0")),
.package(url: "https://github.com/xtool-org/SwiftyMobileDevice", .upToNextMinor(from: "1.4.0")),
.package(url: "https://github.com/xtool-org/zsign", .upToNextMinor(from: "1.4.0")),
.package(url: "https://github.com/apple/swift-system", from: "1.4.0"),
.package(url: "https://github.com/apple/swift-http-types", from: "1.3.1"),
@@ -40,6 +53,7 @@ let package = Package(
.package(url: "https://github.com/apple/swift-openapi-runtime", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-openapi-urlsession", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-nio", from: "2.77.0"),
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
.package(url: "https://github.com/swift-server/async-http-client.git", from: "1.23.0"),
.package(url: "https://github.com/swift-server/swift-openapi-async-http-client", from: "1.0.0"),
@@ -51,19 +65,23 @@ let package = Package(
.package(url: "https://github.com/attaswift/BigInt", from: "5.5.0"),
.package(url: "https://github.com/mxcl/Version", from: "2.1.0"),
.package(url: "https://github.com/jpsim/Yams", from: "5.1.3"),
.package(url: "https://github.com/saagarjha/unxip", from: "3.1.0"),
.package(url: "https://github.com/saagarjha/unxip", from: "3.1.0"),
// TODO: just depend on tuist/XcodeProj instead
.package(url: "https://github.com/yonaskolb/XcodeGen", from: "2.43.0"),
],
targets: [
.systemLibrary(name: "CSupersette"),
.systemLibrary(name: "XADI"),
.target(
name: "CSupersign",
name: "CXKit",
dependencies: [
.product(name: "OpenSSL", package: "SuperchargeCore")
.product(name: "OpenSSL", package: "xtool-core")
],
cSettings: cSettings
cSettings: cSettings + (
xtoolVersion
.map { [.define("XTOOL_VERSION", to: "\"\($0)\"")] }
?? []
)
),
.target(
name: "DeveloperAPI",
@@ -73,18 +91,18 @@ let package = Package(
exclude: ["openapi-generator-config.yaml", "openapi-overlay.yaml"]
),
.target(
name: "Supersign",
name: "XKit",
dependencies: [
"DeveloperAPI",
"CSupersign",
.byName(name: "CSupersette", condition: .when(platforms: [.linux])),
"CXKit",
.byName(name: "XADI", condition: .when(platforms: [.linux])),
.product(name: "ConcurrencyExtras", package: "swift-concurrency-extras"),
.product(name: "Dependencies", package: "swift-dependencies"),
.product(name: "SwiftyMobileDevice", package: "SwiftyMobileDevice"),
.product(name: "Zupersign", package: "zsign"),
.product(name: "SignerSupport", package: "SuperchargeCore"),
.product(name: "ProtoCodable", package: "SuperchargeCore"),
.product(name: "Superutils", package: "SuperchargeCore"),
.product(name: "SignerSupport", package: "xtool-core"),
.product(name: "ProtoCodable", package: "xtool-core"),
.product(name: "Superutils", package: "xtool-core"),
.product(name: "Crypto", package: "swift-crypto"),
.product(name: "_CryptoExtras", package: "swift-crypto"),
.product(name: "X509", package: "swift-certificates"),
@@ -111,16 +129,16 @@ let package = Package(
cSettings: cSettings
),
.testTarget(
name: "SupersignCLITests",
name: "XToolTests",
dependencies: [
"SupersignCLISupport",
"XToolSupport",
]
),
.testTarget(
name: "SupersignTests",
name: "XKitTests",
dependencies: [
"Supersign",
.product(name: "SuperutilsTestSupport", package: "SuperchargeCore")
"XKit",
.product(name: "SuperutilsTestSupport", package: "xtool-core")
],
exclude: [
"config/config-template.json",
@@ -131,10 +149,10 @@ let package = Package(
]
),
.target(
name: "SupersignCLISupport",
name: "XToolSupport",
dependencies: [
"SwiftyMobileDevice",
"Supersign",
"XKit",
"PackLib",
.product(name: "ArgumentParser", package: "swift-argument-parser"),
.product(name: "SystemPackage", package: "swift-system"),
@@ -152,11 +170,11 @@ let package = Package(
]
),
.executableTarget(
name: "SupersignCLI",
name: "xtool",
dependencies: [
"SwiftyMobileDevice",
"Supersign",
"SupersignCLISupport",
"XKit",
"XToolSupport",
],
cSettings: cSettings
),
+43 -19
View File
@@ -1,43 +1,67 @@
# Supersign
# xtool
An all-in-one tool/library for sideloading iOS apps and talking to Apple Developer Services. Supports macOS and Linux.
Cross-platform Xcode replacement. Build and deploy iOS apps with SwiftPM on Linux, Windows, and macOS.
## Prerequisites
## Overview
- Supersign works out of the box on macOS.
- On Linux, you'll need the development packages of [libimobiledevice](https://github.com/libimobiledevice/libimobiledevice) + its dependencies.
- Alternatively, we provide a Dockerfile that does this for you. See [Linux/README.md](/Linux/README.md).
xtool is a cross-platform (Linux/WSL/macOS) tool that replicates Xcode functionality with open standards.
## Installation (CLI)
✅ Build a SwiftPM package into an iOS app
✅ Sign and install iOS apps
✅ Interact with Apple Developer Services programmatically
## Getting Started
1. Follow the guide to install `xtool`
- [Installation (Linux/Windows)](https://xtool.sh/documentation/xtooldocs/installation-linux)
- [Installation (macOS)](https://xtool.sh/documentation/xtooldocs/installation-macos)
2. Create and run your first xtool-powered app by following the [tutorial](https://xtool.sh/tutorials/xtooldocs/first-app)!
## Examples
### Screenshot
![A screenshot of xtool being invoked from VSCode](Documentation/xtool.docc/Resources/Cover.png)
### Command line interface
```bash
$ git clone https://github.com/SuperchargeApp/Supersign
$ cd Supersign
$ swift run SupersignCLI --help
OVERVIEW: The Supersign command line tool
$ xtool --help
OVERVIEW: Cross-platform Xcode replacement
USAGE: supersign <subcommand>
USAGE: xtool <subcommand>
OPTIONS:
-h, --help Show help information.
SUBCOMMANDS:
CONFIGURATION SUBCOMMANDS:
setup Set up xtool for iOS development
auth Manage Apple Developer Services authentication
sdk Manage the Darwin Swift SDK
DEVELOPMENT SUBCOMMANDS:
new Create a new xtool SwiftPM project
dev Build and run an xtool SwiftPM project
ds Interact with Apple Developer Services
DEVICE SUBCOMMANDS:
devices List devices
install Install an ipa file to your device
uninstall Uninstall an installed app
run Run an installed app
launch Launch an installed app
See 'supersign help <subcommand>' for detailed help.
See 'xtool help <subcommand>' for detailed help.
```
## Installation (Library)
### Library
Just add it as a SwiftPM dependency!
xtool includes a library that you can use to interact with Apple Developer Services, iOS devices, and more from your own app. You can use this by adding `XKit` as a SwiftPM dependency.
```swift
// package dependency:
.package(url: "https://github.com/SuperchargeApp/Supersign", .upToNextMinor(from: "1.2.0"))
.package(url: "https://github.com/xtool-org/xtool", .upToNextMinor(from: "1.2.0"))
// target dependency:
.product(name: "Supersign", package: "Supersign")
.product(name: "XKit", package: "xtool")
```
+5
View File
@@ -0,0 +1,5 @@
# Security Policy
## Reporting a Vulnerability
To report a vulnerability, please use GitHub's ["Report a Vulnerability"](https://github.com/xtool-org/xtool/security/advisories/new) tab. We'll be in touch regarding next steps.
-4
View File
@@ -1,4 +0,0 @@
module CSupersette [extern_c] {
header "supersette.h"
link "supersette"
}
-13
View File
@@ -1,13 +0,0 @@
#include <stdint.h>
void supersette_Load(const char *path);
int32_t supersette_SetAndroidID(const char *identifier, uint32_t length);
int32_t supersette_SetProvisioningPath(const char *path);
int32_t supersette_ProvisioningErase(uint64_t dsId);
int32_t supersette_Synchronize(uint64_t dsId, const void *serverIntermediateMetadata, uint32_t serverIntermediateMetadataLength, void **machineIdentifier, uint32_t *machineIdentifierLength, void **synchronizationResumeMetadata, uint32_t *synchronizationResumeMetadataLength);
int32_t supersette_ProvisioningDestroy(uint32_t session);
int32_t supersette_ProvisioningEnd(uint32_t session, const void *persistentTokenMetadata, uint32_t persistentTokenMetadataLength, const void *trustKey, uint32_t trustKeyLength);
int32_t supersette_ProvisioningStart(uint64_t dsId, const void *serverProvisioningIntermediateMetadata, uint32_t serverProvisioningIntermediateMetadataLength, void **clientProvisioningIntermediateMetadata, uint32_t *clientProvisioningIntermediateMetadataLength, uint32_t *session);
int32_t supersette_GetLoginCode(uint64_t dsId);
int32_t supersette_Dispose(void *ptr);
int32_t supersette_OTPRequest(uint64_t dsId, void **machineIdentifier, uint32_t *machineIdentifierLength, void **oneTimePassword, uint32_t *oneTimePasswordLength);
@@ -1,6 +1,6 @@
//
// mobileprovision_utils.h
// supersign
// XKit
//
// Created by Kabir Oberai on 05/07/19.
// Copyright © 2019 Kabir Oberai. All rights reserved.
+1
View File
@@ -0,0 +1 @@
const char * _Nonnull xtl_version(void);
@@ -1,6 +1,6 @@
//
// mobileprovision_utils.c
// supersign
// XKit
//
// Created by Kabir Oberai on 05/07/19.
// Copyright © 2019 Kabir Oberai. All rights reserved.
+9
View File
@@ -0,0 +1,9 @@
#include "version.h"
const char *xtl_version(void) {
#ifdef XTOOL_VERSION
return XTOOL_VERSION;
#else
return "unversioned";
#endif
}
+201
View File
@@ -2017,6 +2017,207 @@ public struct DeveloperAPIClient: APIProtocol {
}
)
}
/// - Remark: HTTP `PATCH /v1/certificates/{id}`.
/// - Remark: Generated from `#/paths//v1/certificates/{id}/patch(certificates_updateInstance)`.
public func certificatesUpdateInstance(_ input: Operations.CertificatesUpdateInstance.Input) async throws -> Operations.CertificatesUpdateInstance.Output {
try await client.send(
input: input,
forOperation: Operations.CertificatesUpdateInstance.id,
serializer: { input in
let path = try converter.renderedPath(
template: "/v1/certificates/{}",
parameters: [
input.path.id
]
)
var request: HTTPTypes.HTTPRequest = .init(
soar_path: path,
method: .patch
)
suppressMutabilityWarning(&request)
converter.setAcceptHeader(
in: &request.headerFields,
contentTypes: input.headers.accept
)
let body: OpenAPIRuntime.HTTPBody?
switch input.body {
case let .json(value):
body = try converter.setRequiredRequestBodyAsJSON(
value,
headerFields: &request.headerFields,
contentType: "application/json; charset=utf-8"
)
}
return (request, body)
},
deserializer: { response, responseBody in
switch response.status.code {
case 200:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.CertificatesUpdateInstance.Output.Ok.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.CertificateResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .ok(.init(body: body))
case 400:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.CertificatesUpdateInstance.Output.BadRequest.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .badRequest(.init(body: body))
case 401:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.CertificatesUpdateInstance.Output.Unauthorized.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unauthorized(.init(body: body))
case 403:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.CertificatesUpdateInstance.Output.Forbidden.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .forbidden(.init(body: body))
case 404:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.CertificatesUpdateInstance.Output.NotFound.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .notFound(.init(body: body))
case 409:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.CertificatesUpdateInstance.Output.Conflict.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .conflict(.init(body: body))
case 422:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.CertificatesUpdateInstance.Output.UnprocessableContent.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unprocessableContent(.init(body: body))
default:
return .undocumented(
statusCode: response.status.code,
.init(
headerFields: response.headerFields,
body: responseBody
)
)
}
}
)
}
/// - Remark: HTTP `DELETE /v1/certificates/{id}`.
/// - Remark: Generated from `#/paths//v1/certificates/{id}/delete(certificates_deleteInstance)`.
public func certificatesDeleteInstance(_ input: Operations.CertificatesDeleteInstance.Input) async throws -> Operations.CertificatesDeleteInstance.Output {
+621 -14
View File
@@ -44,6 +44,9 @@ public protocol APIProtocol: Sendable {
/// - Remark: HTTP `GET /v1/certificates/{id}`.
/// - Remark: Generated from `#/paths//v1/certificates/{id}/get(certificates_getInstance)`.
func certificatesGetInstance(_ input: Operations.CertificatesGetInstance.Input) async throws -> Operations.CertificatesGetInstance.Output
/// - Remark: HTTP `PATCH /v1/certificates/{id}`.
/// - Remark: Generated from `#/paths//v1/certificates/{id}/patch(certificates_updateInstance)`.
func certificatesUpdateInstance(_ input: Operations.CertificatesUpdateInstance.Input) async throws -> Operations.CertificatesUpdateInstance.Output
/// - Remark: HTTP `DELETE /v1/certificates/{id}`.
/// - Remark: Generated from `#/paths//v1/certificates/{id}/delete(certificates_deleteInstance)`.
func certificatesDeleteInstance(_ input: Operations.CertificatesDeleteInstance.Input) async throws -> Operations.CertificatesDeleteInstance.Output
@@ -222,6 +225,19 @@ extension APIProtocol {
headers: headers
))
}
/// - Remark: HTTP `PATCH /v1/certificates/{id}`.
/// - Remark: Generated from `#/paths//v1/certificates/{id}/patch(certificates_updateInstance)`.
public func certificatesUpdateInstance(
path: Operations.CertificatesUpdateInstance.Input.Path,
headers: Operations.CertificatesUpdateInstance.Input.Headers = .init(),
body: Operations.CertificatesUpdateInstance.Input.Body
) async throws -> Operations.CertificatesUpdateInstance.Output {
try await certificatesUpdateInstance(Operations.CertificatesUpdateInstance.Input(
path: path,
headers: headers,
body: body
))
}
/// - Remark: HTTP `DELETE /v1/certificates/{id}`.
/// - Remark: Generated from `#/paths//v1/certificates/{id}/delete(certificates_deleteInstance)`.
public func certificatesDeleteInstance(
@@ -1283,7 +1299,6 @@ public enum Components {
/// - Remark: Generated from `#/components/schemas/App/relationships/appAvailabilityV2`.
public var appAvailabilityV2: Components.Schemas.App.RelationshipsPayload.AppAvailabilityV2Payload?
/// - Remark: Generated from `#/components/schemas/App/relationships/inAppPurchases`.
@available(*, deprecated)
public struct InAppPurchasesPayload: Codable, Hashable, Sendable {
/// - Remark: Generated from `#/components/schemas/App/relationships/inAppPurchases/links`.
public var links: Components.Schemas.RelationshipLinks?
@@ -1342,7 +1357,6 @@ public enum Components {
}
}
/// - Remark: Generated from `#/components/schemas/App/relationships/inAppPurchases`.
@available(*, deprecated)
public var inAppPurchases: Components.Schemas.App.RelationshipsPayload.InAppPurchasesPayload?
/// - Remark: Generated from `#/components/schemas/App/relationships/subscriptionGroups`.
public struct SubscriptionGroupsPayload: Codable, Hashable, Sendable {
@@ -3116,6 +3130,8 @@ public enum Components {
public var expirationDate: Foundation.Date?
/// - Remark: Generated from `#/components/schemas/Certificate/attributes/certificateContent`.
public var certificateContent: Swift.String?
/// - Remark: Generated from `#/components/schemas/Certificate/attributes/activated`.
public var activated: Swift.Bool?
/// Creates a new `AttributesPayload`.
///
/// - Parameters:
@@ -3126,6 +3142,7 @@ public enum Components {
/// - platform:
/// - expirationDate:
/// - certificateContent:
/// - activated:
public init(
name: Swift.String? = nil,
certificateType: Components.Schemas.CertificateType? = nil,
@@ -3133,7 +3150,8 @@ public enum Components {
serialNumber: Swift.String? = nil,
platform: Components.Schemas.BundleIdPlatform? = nil,
expirationDate: Foundation.Date? = nil,
certificateContent: Swift.String? = nil
certificateContent: Swift.String? = nil,
activated: Swift.Bool? = nil
) {
self.name = name
self.certificateType = certificateType
@@ -3142,6 +3160,7 @@ public enum Components {
self.platform = platform
self.expirationDate = expirationDate
self.certificateContent = certificateContent
self.activated = activated
}
public enum CodingKeys: String, CodingKey {
case name
@@ -3151,6 +3170,7 @@ public enum Components {
case platform
case expirationDate
case certificateContent
case activated
}
}
/// - Remark: Generated from `#/components/schemas/Certificate/attributes`.
@@ -3269,21 +3289,84 @@ public enum Components {
}
/// - Remark: Generated from `#/components/schemas/CertificateCreateRequest/data/attributes`.
public var attributes: Components.Schemas.CertificateCreateRequest.DataPayload.AttributesPayload
/// - Remark: Generated from `#/components/schemas/CertificateCreateRequest/data/relationships`.
public struct RelationshipsPayload: Codable, Hashable, Sendable {
/// - Remark: Generated from `#/components/schemas/CertificateCreateRequest/data/relationships/merchantId`.
public struct MerchantIdPayload: Codable, Hashable, Sendable {
/// - Remark: Generated from `#/components/schemas/CertificateCreateRequest/data/relationships/merchantId/data`.
public struct DataPayload: Codable, Hashable, Sendable {
/// - Remark: Generated from `#/components/schemas/CertificateCreateRequest/data/relationships/merchantId/data/type`.
@frozen public enum _TypePayload: String, Codable, Hashable, Sendable, CaseIterable {
case merchantIds = "merchantIds"
}
/// - Remark: Generated from `#/components/schemas/CertificateCreateRequest/data/relationships/merchantId/data/type`.
public var _type: Components.Schemas.CertificateCreateRequest.DataPayload.RelationshipsPayload.MerchantIdPayload.DataPayload._TypePayload
/// - Remark: Generated from `#/components/schemas/CertificateCreateRequest/data/relationships/merchantId/data/id`.
public var id: Swift.String
/// Creates a new `DataPayload`.
///
/// - Parameters:
/// - _type:
/// - id:
public init(
_type: Components.Schemas.CertificateCreateRequest.DataPayload.RelationshipsPayload.MerchantIdPayload.DataPayload._TypePayload,
id: Swift.String
) {
self._type = _type
self.id = id
}
public enum CodingKeys: String, CodingKey {
case _type = "type"
case id
}
}
/// - Remark: Generated from `#/components/schemas/CertificateCreateRequest/data/relationships/merchantId/data`.
public var data: Components.Schemas.CertificateCreateRequest.DataPayload.RelationshipsPayload.MerchantIdPayload.DataPayload?
/// Creates a new `MerchantIdPayload`.
///
/// - Parameters:
/// - data:
public init(data: Components.Schemas.CertificateCreateRequest.DataPayload.RelationshipsPayload.MerchantIdPayload.DataPayload? = nil) {
self.data = data
}
public enum CodingKeys: String, CodingKey {
case data
}
}
/// - Remark: Generated from `#/components/schemas/CertificateCreateRequest/data/relationships/merchantId`.
public var merchantId: Components.Schemas.CertificateCreateRequest.DataPayload.RelationshipsPayload.MerchantIdPayload?
/// Creates a new `RelationshipsPayload`.
///
/// - Parameters:
/// - merchantId:
public init(merchantId: Components.Schemas.CertificateCreateRequest.DataPayload.RelationshipsPayload.MerchantIdPayload? = nil) {
self.merchantId = merchantId
}
public enum CodingKeys: String, CodingKey {
case merchantId
}
}
/// - Remark: Generated from `#/components/schemas/CertificateCreateRequest/data/relationships`.
public var relationships: Components.Schemas.CertificateCreateRequest.DataPayload.RelationshipsPayload?
/// Creates a new `DataPayload`.
///
/// - Parameters:
/// - _type:
/// - attributes:
/// - relationships:
public init(
_type: Components.Schemas.CertificateCreateRequest.DataPayload._TypePayload,
attributes: Components.Schemas.CertificateCreateRequest.DataPayload.AttributesPayload
attributes: Components.Schemas.CertificateCreateRequest.DataPayload.AttributesPayload,
relationships: Components.Schemas.CertificateCreateRequest.DataPayload.RelationshipsPayload? = nil
) {
self._type = _type
self.attributes = attributes
self.relationships = relationships
}
public enum CodingKeys: String, CodingKey {
case _type = "type"
case attributes
case relationships
}
}
/// - Remark: Generated from `#/components/schemas/CertificateCreateRequest/data`.
@@ -3299,6 +3382,69 @@ public enum Components {
case data
}
}
/// - Remark: Generated from `#/components/schemas/CertificateUpdateRequest`.
public struct CertificateUpdateRequest: Codable, Hashable, Sendable {
/// - Remark: Generated from `#/components/schemas/CertificateUpdateRequest/data`.
public struct DataPayload: Codable, Hashable, Sendable {
/// - Remark: Generated from `#/components/schemas/CertificateUpdateRequest/data/type`.
@frozen public enum _TypePayload: String, Codable, Hashable, Sendable, CaseIterable {
case certificates = "certificates"
}
/// - Remark: Generated from `#/components/schemas/CertificateUpdateRequest/data/type`.
public var _type: Components.Schemas.CertificateUpdateRequest.DataPayload._TypePayload
/// - Remark: Generated from `#/components/schemas/CertificateUpdateRequest/data/id`.
public var id: Swift.String
/// - Remark: Generated from `#/components/schemas/CertificateUpdateRequest/data/attributes`.
public struct AttributesPayload: Codable, Hashable, Sendable {
/// - Remark: Generated from `#/components/schemas/CertificateUpdateRequest/data/attributes/activated`.
public var activated: Swift.Bool?
/// Creates a new `AttributesPayload`.
///
/// - Parameters:
/// - activated:
public init(activated: Swift.Bool? = nil) {
self.activated = activated
}
public enum CodingKeys: String, CodingKey {
case activated
}
}
/// - Remark: Generated from `#/components/schemas/CertificateUpdateRequest/data/attributes`.
public var attributes: Components.Schemas.CertificateUpdateRequest.DataPayload.AttributesPayload?
/// Creates a new `DataPayload`.
///
/// - Parameters:
/// - _type:
/// - id:
/// - attributes:
public init(
_type: Components.Schemas.CertificateUpdateRequest.DataPayload._TypePayload,
id: Swift.String,
attributes: Components.Schemas.CertificateUpdateRequest.DataPayload.AttributesPayload? = nil
) {
self._type = _type
self.id = id
self.attributes = attributes
}
public enum CodingKeys: String, CodingKey {
case _type = "type"
case id
case attributes
}
}
/// - Remark: Generated from `#/components/schemas/CertificateUpdateRequest/data`.
public var data: Components.Schemas.CertificateUpdateRequest.DataPayload
/// Creates a new `CertificateUpdateRequest`.
///
/// - Parameters:
/// - data:
public init(data: Components.Schemas.CertificateUpdateRequest.DataPayload) {
self.data = data
}
public enum CodingKeys: String, CodingKey {
case data
}
}
/// - Remark: Generated from `#/components/schemas/Device`.
public struct Device: Codable, Hashable, Sendable {
/// - Remark: Generated from `#/components/schemas/Device/type`.
@@ -3325,6 +3471,7 @@ public enum Components {
case ipod = "IPOD"
case appleTv = "APPLE_TV"
case mac = "MAC"
case appleVisionPro = "APPLE_VISION_PRO"
}
/// - Remark: Generated from `#/components/schemas/Device/attributes/deviceClass`.
public var deviceClass: Components.Schemas.Device.AttributesPayload.DeviceClassPayload?
@@ -4872,6 +5019,8 @@ public enum Components {
case ios = "IOS"
case macOs = "MAC_OS"
case universal = "UNIVERSAL"
case services = "SERVICES"
case macos = "MACOS"
}
/// - Remark: Generated from `#/components/schemas/CapabilityOption`.
public struct CapabilityOption: Codable, Hashable, Sendable {
@@ -5033,17 +5182,22 @@ public enum Components {
}
/// - Remark: Generated from `#/components/schemas/CertificateType`.
@frozen public enum CertificateType: String, Codable, Hashable, Sendable, CaseIterable {
case iosDevelopment = "IOS_DEVELOPMENT"
case iosDistribution = "IOS_DISTRIBUTION"
case macAppDistribution = "MAC_APP_DISTRIBUTION"
case macInstallerDistribution = "MAC_INSTALLER_DISTRIBUTION"
case macAppDevelopment = "MAC_APP_DEVELOPMENT"
case applePay = "APPLE_PAY"
case applePayMerchantIdentity = "APPLE_PAY_MERCHANT_IDENTITY"
case applePayPspIdentity = "APPLE_PAY_PSP_IDENTITY"
case applePayRsa = "APPLE_PAY_RSA"
case developerIdKext = "DEVELOPER_ID_KEXT"
case developerIdKextG2 = "DEVELOPER_ID_KEXT_G2"
case developerIdApplication = "DEVELOPER_ID_APPLICATION"
case developerIdApplicationG2 = "DEVELOPER_ID_APPLICATION_G2"
case development = "DEVELOPMENT"
case distribution = "DISTRIBUTION"
case identityAccess = "IDENTITY_ACCESS"
case iosDevelopment = "IOS_DEVELOPMENT"
case iosDistribution = "IOS_DISTRIBUTION"
case macAppDistribution = "MAC_APP_DISTRIBUTION"
case macInstallerDistribution = "MAC_INSTALLER_DISTRIBUTION"
case macAppDevelopment = "MAC_APP_DEVELOPMENT"
case passTypeId = "PASS_TYPE_ID"
case passTypeIdWithNfc = "PASS_TYPE_ID_WITH_NFC"
}
@@ -8419,17 +8573,22 @@ public enum Operations {
public var filter_lbrack_displayName_rbrack_: [Swift.String]?
/// - Remark: Generated from `#/paths/v1/certificates/GET/query/Filter_lbrack_certificateType_rbrack_Payload`.
@frozen public enum FilterLbrackCertificateTypeRbrackPayloadPayload: String, Codable, Hashable, Sendable, CaseIterable {
case iosDevelopment = "IOS_DEVELOPMENT"
case iosDistribution = "IOS_DISTRIBUTION"
case macAppDistribution = "MAC_APP_DISTRIBUTION"
case macInstallerDistribution = "MAC_INSTALLER_DISTRIBUTION"
case macAppDevelopment = "MAC_APP_DEVELOPMENT"
case applePay = "APPLE_PAY"
case applePayMerchantIdentity = "APPLE_PAY_MERCHANT_IDENTITY"
case applePayPspIdentity = "APPLE_PAY_PSP_IDENTITY"
case applePayRsa = "APPLE_PAY_RSA"
case developerIdKext = "DEVELOPER_ID_KEXT"
case developerIdKextG2 = "DEVELOPER_ID_KEXT_G2"
case developerIdApplication = "DEVELOPER_ID_APPLICATION"
case developerIdApplicationG2 = "DEVELOPER_ID_APPLICATION_G2"
case development = "DEVELOPMENT"
case distribution = "DISTRIBUTION"
case identityAccess = "IDENTITY_ACCESS"
case iosDevelopment = "IOS_DEVELOPMENT"
case iosDistribution = "IOS_DISTRIBUTION"
case macAppDistribution = "MAC_APP_DISTRIBUTION"
case macInstallerDistribution = "MAC_INSTALLER_DISTRIBUTION"
case macAppDevelopment = "MAC_APP_DEVELOPMENT"
case passTypeId = "PASS_TYPE_ID"
case passTypeIdWithNfc = "PASS_TYPE_ID_WITH_NFC"
}
@@ -8473,6 +8632,7 @@ public enum Operations {
case platform = "platform"
case expirationDate = "expirationDate"
case certificateContent = "certificateContent"
case activated = "activated"
}
/// - Remark: Generated from `#/paths/v1/certificates/GET/query/fields[certificates]`.
public typealias Fields_lbrack_certificates_rbrack_Payload = [Operations.CertificatesGetCollection.Input.Query.FieldsLbrackCertificatesRbrackPayloadPayload]
@@ -9179,6 +9339,7 @@ public enum Operations {
case platform = "platform"
case expirationDate = "expirationDate"
case certificateContent = "certificateContent"
case activated = "activated"
}
/// - Remark: Generated from `#/paths/v1/certificates/{id}/GET/query/fields[certificates]`.
public typealias Fields_lbrack_certificates_rbrack_Payload = [Operations.CertificatesGetInstance.Input.Query.FieldsLbrackCertificatesRbrackPayloadPayload]
@@ -9510,6 +9671,449 @@ public enum Operations {
}
}
}
/// - Remark: HTTP `PATCH /v1/certificates/{id}`.
/// - Remark: Generated from `#/paths//v1/certificates/{id}/patch(certificates_updateInstance)`.
public enum CertificatesUpdateInstance {
public static let id: Swift.String = "certificates_updateInstance"
public struct Input: Sendable, Hashable {
/// - Remark: Generated from `#/paths/v1/certificates/{id}/PATCH/path`.
public struct Path: Sendable, Hashable {
/// the id of the requested resource
///
/// - Remark: Generated from `#/paths/v1/certificates/{id}/PATCH/path/id`.
public var id: Swift.String
/// Creates a new `Path`.
///
/// - Parameters:
/// - id: the id of the requested resource
public init(id: Swift.String) {
self.id = id
}
}
public var path: Operations.CertificatesUpdateInstance.Input.Path
/// - Remark: Generated from `#/paths/v1/certificates/{id}/PATCH/header`.
public struct Headers: Sendable, Hashable {
public var accept: [OpenAPIRuntime.AcceptHeaderContentType<Operations.CertificatesUpdateInstance.AcceptableContentType>]
/// Creates a new `Headers`.
///
/// - Parameters:
/// - accept:
public init(accept: [OpenAPIRuntime.AcceptHeaderContentType<Operations.CertificatesUpdateInstance.AcceptableContentType>] = .defaultValues()) {
self.accept = accept
}
}
public var headers: Operations.CertificatesUpdateInstance.Input.Headers
/// - Remark: Generated from `#/paths/v1/certificates/{id}/PATCH/requestBody`.
@frozen public enum Body: Sendable, Hashable {
/// - Remark: Generated from `#/paths/v1/certificates/{id}/PATCH/requestBody/content/application\/json`.
case json(Components.Schemas.CertificateUpdateRequest)
}
public var body: Operations.CertificatesUpdateInstance.Input.Body
/// Creates a new `Input`.
///
/// - Parameters:
/// - path:
/// - headers:
/// - body:
public init(
path: Operations.CertificatesUpdateInstance.Input.Path,
headers: Operations.CertificatesUpdateInstance.Input.Headers = .init(),
body: Operations.CertificatesUpdateInstance.Input.Body
) {
self.path = path
self.headers = headers
self.body = body
}
}
@frozen public enum Output: Sendable, Hashable {
public struct Ok: Sendable, Hashable {
/// - Remark: Generated from `#/paths/v1/certificates/{id}/PATCH/responses/200/content`.
@frozen public enum Body: Sendable, Hashable {
/// - Remark: Generated from `#/paths/v1/certificates/{id}/PATCH/responses/200/content/application\/json`.
case json(Components.Schemas.CertificateResponse)
/// The associated value of the enum case if `self` is `.json`.
///
/// - Throws: An error if `self` is not `.json`.
/// - SeeAlso: `.json`.
public var json: Components.Schemas.CertificateResponse {
get throws {
switch self {
case let .json(body):
return body
}
}
}
}
/// Received HTTP response body
public var body: Operations.CertificatesUpdateInstance.Output.Ok.Body
/// Creates a new `Ok`.
///
/// - Parameters:
/// - body: Received HTTP response body
public init(body: Operations.CertificatesUpdateInstance.Output.Ok.Body) {
self.body = body
}
}
/// Single Certificate
///
/// - Remark: Generated from `#/paths//v1/certificates/{id}/patch(certificates_updateInstance)/responses/200`.
///
/// HTTP response code: `200 ok`.
case ok(Operations.CertificatesUpdateInstance.Output.Ok)
/// The associated value of the enum case if `self` is `.ok`.
///
/// - Throws: An error if `self` is not `.ok`.
/// - SeeAlso: `.ok`.
public var ok: Operations.CertificatesUpdateInstance.Output.Ok {
get throws {
switch self {
case let .ok(response):
return response
default:
try throwUnexpectedResponseStatus(
expectedStatus: "ok",
response: self
)
}
}
}
public struct BadRequest: Sendable, Hashable {
/// - Remark: Generated from `#/paths/v1/certificates/{id}/PATCH/responses/400/content`.
@frozen public enum Body: Sendable, Hashable {
/// - Remark: Generated from `#/paths/v1/certificates/{id}/PATCH/responses/400/content/application\/json`.
case json(Components.Schemas.ErrorResponse)
/// The associated value of the enum case if `self` is `.json`.
///
/// - Throws: An error if `self` is not `.json`.
/// - SeeAlso: `.json`.
public var json: Components.Schemas.ErrorResponse {
get throws {
switch self {
case let .json(body):
return body
}
}
}
}
/// Received HTTP response body
public var body: Operations.CertificatesUpdateInstance.Output.BadRequest.Body
/// Creates a new `BadRequest`.
///
/// - Parameters:
/// - body: Received HTTP response body
public init(body: Operations.CertificatesUpdateInstance.Output.BadRequest.Body) {
self.body = body
}
}
/// Parameter error(s)
///
/// - Remark: Generated from `#/paths//v1/certificates/{id}/patch(certificates_updateInstance)/responses/400`.
///
/// HTTP response code: `400 badRequest`.
case badRequest(Operations.CertificatesUpdateInstance.Output.BadRequest)
/// The associated value of the enum case if `self` is `.badRequest`.
///
/// - Throws: An error if `self` is not `.badRequest`.
/// - SeeAlso: `.badRequest`.
public var badRequest: Operations.CertificatesUpdateInstance.Output.BadRequest {
get throws {
switch self {
case let .badRequest(response):
return response
default:
try throwUnexpectedResponseStatus(
expectedStatus: "badRequest",
response: self
)
}
}
}
public struct Unauthorized: Sendable, Hashable {
/// - Remark: Generated from `#/paths/v1/certificates/{id}/PATCH/responses/401/content`.
@frozen public enum Body: Sendable, Hashable {
/// - Remark: Generated from `#/paths/v1/certificates/{id}/PATCH/responses/401/content/application\/json`.
case json(Components.Schemas.ErrorResponse)
/// The associated value of the enum case if `self` is `.json`.
///
/// - Throws: An error if `self` is not `.json`.
/// - SeeAlso: `.json`.
public var json: Components.Schemas.ErrorResponse {
get throws {
switch self {
case let .json(body):
return body
}
}
}
}
/// Received HTTP response body
public var body: Operations.CertificatesUpdateInstance.Output.Unauthorized.Body
/// Creates a new `Unauthorized`.
///
/// - Parameters:
/// - body: Received HTTP response body
public init(body: Operations.CertificatesUpdateInstance.Output.Unauthorized.Body) {
self.body = body
}
}
/// Unauthorized error(s)
///
/// - Remark: Generated from `#/paths//v1/certificates/{id}/patch(certificates_updateInstance)/responses/401`.
///
/// HTTP response code: `401 unauthorized`.
case unauthorized(Operations.CertificatesUpdateInstance.Output.Unauthorized)
/// The associated value of the enum case if `self` is `.unauthorized`.
///
/// - Throws: An error if `self` is not `.unauthorized`.
/// - SeeAlso: `.unauthorized`.
public var unauthorized: Operations.CertificatesUpdateInstance.Output.Unauthorized {
get throws {
switch self {
case let .unauthorized(response):
return response
default:
try throwUnexpectedResponseStatus(
expectedStatus: "unauthorized",
response: self
)
}
}
}
public struct Forbidden: Sendable, Hashable {
/// - Remark: Generated from `#/paths/v1/certificates/{id}/PATCH/responses/403/content`.
@frozen public enum Body: Sendable, Hashable {
/// - Remark: Generated from `#/paths/v1/certificates/{id}/PATCH/responses/403/content/application\/json`.
case json(Components.Schemas.ErrorResponse)
/// The associated value of the enum case if `self` is `.json`.
///
/// - Throws: An error if `self` is not `.json`.
/// - SeeAlso: `.json`.
public var json: Components.Schemas.ErrorResponse {
get throws {
switch self {
case let .json(body):
return body
}
}
}
}
/// Received HTTP response body
public var body: Operations.CertificatesUpdateInstance.Output.Forbidden.Body
/// Creates a new `Forbidden`.
///
/// - Parameters:
/// - body: Received HTTP response body
public init(body: Operations.CertificatesUpdateInstance.Output.Forbidden.Body) {
self.body = body
}
}
/// Forbidden error
///
/// - Remark: Generated from `#/paths//v1/certificates/{id}/patch(certificates_updateInstance)/responses/403`.
///
/// HTTP response code: `403 forbidden`.
case forbidden(Operations.CertificatesUpdateInstance.Output.Forbidden)
/// The associated value of the enum case if `self` is `.forbidden`.
///
/// - Throws: An error if `self` is not `.forbidden`.
/// - SeeAlso: `.forbidden`.
public var forbidden: Operations.CertificatesUpdateInstance.Output.Forbidden {
get throws {
switch self {
case let .forbidden(response):
return response
default:
try throwUnexpectedResponseStatus(
expectedStatus: "forbidden",
response: self
)
}
}
}
public struct NotFound: Sendable, Hashable {
/// - Remark: Generated from `#/paths/v1/certificates/{id}/PATCH/responses/404/content`.
@frozen public enum Body: Sendable, Hashable {
/// - Remark: Generated from `#/paths/v1/certificates/{id}/PATCH/responses/404/content/application\/json`.
case json(Components.Schemas.ErrorResponse)
/// The associated value of the enum case if `self` is `.json`.
///
/// - Throws: An error if `self` is not `.json`.
/// - SeeAlso: `.json`.
public var json: Components.Schemas.ErrorResponse {
get throws {
switch self {
case let .json(body):
return body
}
}
}
}
/// Received HTTP response body
public var body: Operations.CertificatesUpdateInstance.Output.NotFound.Body
/// Creates a new `NotFound`.
///
/// - Parameters:
/// - body: Received HTTP response body
public init(body: Operations.CertificatesUpdateInstance.Output.NotFound.Body) {
self.body = body
}
}
/// Not found error
///
/// - Remark: Generated from `#/paths//v1/certificates/{id}/patch(certificates_updateInstance)/responses/404`.
///
/// HTTP response code: `404 notFound`.
case notFound(Operations.CertificatesUpdateInstance.Output.NotFound)
/// The associated value of the enum case if `self` is `.notFound`.
///
/// - Throws: An error if `self` is not `.notFound`.
/// - SeeAlso: `.notFound`.
public var notFound: Operations.CertificatesUpdateInstance.Output.NotFound {
get throws {
switch self {
case let .notFound(response):
return response
default:
try throwUnexpectedResponseStatus(
expectedStatus: "notFound",
response: self
)
}
}
}
public struct Conflict: Sendable, Hashable {
/// - Remark: Generated from `#/paths/v1/certificates/{id}/PATCH/responses/409/content`.
@frozen public enum Body: Sendable, Hashable {
/// - Remark: Generated from `#/paths/v1/certificates/{id}/PATCH/responses/409/content/application\/json`.
case json(Components.Schemas.ErrorResponse)
/// The associated value of the enum case if `self` is `.json`.
///
/// - Throws: An error if `self` is not `.json`.
/// - SeeAlso: `.json`.
public var json: Components.Schemas.ErrorResponse {
get throws {
switch self {
case let .json(body):
return body
}
}
}
}
/// Received HTTP response body
public var body: Operations.CertificatesUpdateInstance.Output.Conflict.Body
/// Creates a new `Conflict`.
///
/// - Parameters:
/// - body: Received HTTP response body
public init(body: Operations.CertificatesUpdateInstance.Output.Conflict.Body) {
self.body = body
}
}
/// Request entity error(s)
///
/// - Remark: Generated from `#/paths//v1/certificates/{id}/patch(certificates_updateInstance)/responses/409`.
///
/// HTTP response code: `409 conflict`.
case conflict(Operations.CertificatesUpdateInstance.Output.Conflict)
/// The associated value of the enum case if `self` is `.conflict`.
///
/// - Throws: An error if `self` is not `.conflict`.
/// - SeeAlso: `.conflict`.
public var conflict: Operations.CertificatesUpdateInstance.Output.Conflict {
get throws {
switch self {
case let .conflict(response):
return response
default:
try throwUnexpectedResponseStatus(
expectedStatus: "conflict",
response: self
)
}
}
}
public struct UnprocessableContent: Sendable, Hashable {
/// - Remark: Generated from `#/paths/v1/certificates/{id}/PATCH/responses/422/content`.
@frozen public enum Body: Sendable, Hashable {
/// - Remark: Generated from `#/paths/v1/certificates/{id}/PATCH/responses/422/content/application\/json`.
case json(Components.Schemas.ErrorResponse)
/// The associated value of the enum case if `self` is `.json`.
///
/// - Throws: An error if `self` is not `.json`.
/// - SeeAlso: `.json`.
public var json: Components.Schemas.ErrorResponse {
get throws {
switch self {
case let .json(body):
return body
}
}
}
}
/// Received HTTP response body
public var body: Operations.CertificatesUpdateInstance.Output.UnprocessableContent.Body
/// Creates a new `UnprocessableContent`.
///
/// - Parameters:
/// - body: Received HTTP response body
public init(body: Operations.CertificatesUpdateInstance.Output.UnprocessableContent.Body) {
self.body = body
}
}
/// Unprocessable request entity error(s)
///
/// - Remark: Generated from `#/paths//v1/certificates/{id}/patch(certificates_updateInstance)/responses/422`.
///
/// HTTP response code: `422 unprocessableContent`.
case unprocessableContent(Operations.CertificatesUpdateInstance.Output.UnprocessableContent)
/// The associated value of the enum case if `self` is `.unprocessableContent`.
///
/// - Throws: An error if `self` is not `.unprocessableContent`.
/// - SeeAlso: `.unprocessableContent`.
public var unprocessableContent: Operations.CertificatesUpdateInstance.Output.UnprocessableContent {
get throws {
switch self {
case let .unprocessableContent(response):
return response
default:
try throwUnexpectedResponseStatus(
expectedStatus: "unprocessableContent",
response: self
)
}
}
}
/// Undocumented response.
///
/// A response with a code that is not documented in the OpenAPI document.
case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload)
}
@frozen public enum AcceptableContentType: AcceptableProtocol {
case json
case other(Swift.String)
public init?(rawValue: Swift.String) {
switch rawValue.lowercased() {
case "application/json":
self = .json
default:
self = .other(rawValue)
}
}
public var rawValue: Swift.String {
switch self {
case let .other(string):
return string
case .json:
return "application/json"
}
}
public static var allCases: [Self] {
[
.json
]
}
}
}
/// - Remark: HTTP `DELETE /v1/certificates/{id}`.
/// - Remark: Generated from `#/paths//v1/certificates/{id}/delete(certificates_deleteInstance)`.
public enum CertificatesDeleteInstance {
@@ -11557,6 +12161,7 @@ public enum Operations {
case platform = "platform"
case expirationDate = "expirationDate"
case certificateContent = "certificateContent"
case activated = "activated"
}
/// - Remark: Generated from `#/paths/v1/profiles/GET/query/fields[certificates]`.
public typealias Fields_lbrack_certificates_rbrack_Payload = [Operations.ProfilesGetCollection.Input.Query.FieldsLbrackCertificatesRbrackPayloadPayload]
@@ -12353,6 +12958,7 @@ public enum Operations {
case platform = "platform"
case expirationDate = "expirationDate"
case certificateContent = "certificateContent"
case activated = "activated"
}
/// - Remark: Generated from `#/paths/v1/profiles/{id}/GET/query/fields[certificates]`.
public typealias Fields_lbrack_certificates_rbrack_Payload = [Operations.ProfilesGetInstance.Input.Query.FieldsLbrackCertificatesRbrackPayloadPayload]
@@ -14623,6 +15229,7 @@ public enum Operations {
case platform = "platform"
case expirationDate = "expirationDate"
case certificateContent = "certificateContent"
case activated = "activated"
}
/// - Remark: Generated from `#/paths/v1/profiles/{id}/certificates/GET/query/fields[certificates]`.
public typealias Fields_lbrack_certificates_rbrack_Payload = [Operations.ProfilesCertificatesGetToManyRelated.Input.Query.FieldsLbrackCertificatesRbrackPayloadPayload]
+20
View File
@@ -3,6 +3,7 @@ info:
title: Overlay for App Store Connect API
version: 1.0.0
actions:
# this field is required when using the private Xcode API
- target: '$.components.schemas.BundleIdCapabilityCreateRequest.properties.data.properties.relationships'
update:
properties:
@@ -20,3 +21,22 @@ actions:
required: [id, type]
required: [data]
required: [capability]
# we don't use this but it triggers a deprecation warning. see:
# https://github.com/apple/swift-openapi-generator/issues/715
- target: '$.components.schemas.App.properties.relationships.properties.inAppPurchases'
update:
deprecated: false
# openapi-generator expects response enums to be exhaustive. Apple's ASC OpenAPI spec
# misses some cases that they do, actually, return.
- target: '$.components.schemas.Device.properties.attributes.properties.deviceClass'
update:
enum:
- APPLE_VISION_PRO
- target: '$.components.schemas.BundleIdPlatform'
update:
enum:
- SERVICES
# the spec already declares MAC_OS but ASC sometimes seems to
# spell this as MACOS instead. see:
# https://github.com/xtool-org/xtool/issues/64
- MACOS
+8 -14
View File
@@ -15,27 +15,21 @@ public struct BuildSettings: Sendable {
public init(
configuration: BuildConfiguration,
triple: String,
packagePath: String = ".",
options: [String] = []
) async throws {
self.packagePath = packagePath
self.configuration = configuration
self.options = options
self.triple = triple
// TODO: allow customizing?
self.triple = "arm64-apple-ios"
#if os(macOS)
let sdkPath = try await Self.xcrun(["-show-sdk-path", "--sdk", "iphoneos"])
self.sdkOptions = [
"--triple", triple,
"--sdk", sdkPath,
]
#else
self.sdkOptions = [
"--swift-sdk", triple
]
#endif
// on macOS we don't explicitly install a Swift SDK but
// SwiftPM vends "implicit" Darwin SDKs as of Swift 6.1,
// i.e. we can pass `--swift-sdk arm64-apple-ios` and it
// just works. See:
// https://github.com/swiftlang/swift-package-manager/pull/6828
self.sdkOptions = ["--swift-sdk", triple]
}
#if os(macOS)
+11 -2
View File
@@ -14,6 +14,8 @@ public struct PackSchemaBase: Codable, Sendable {
public var product: String?
public var infoPath: String?
public var iconPath: String?
public var resources: [String]?
}
public struct PackSchema: Sendable {
@@ -36,7 +38,7 @@ public struct PackSchema: Sendable {
self.base = base
if base.version != .v1 {
throw StringError("supersign.yml: Unsupported schema version: \(base.version.rawValue)")
throw StringError("xtool.yml: Unsupported schema version: \(base.version.rawValue)")
}
switch (base.bundleID, base.orgID) {
@@ -45,7 +47,14 @@ public struct PackSchema: Sendable {
case (nil, let orgID?):
idSpecifier = .orgID(orgID)
case (nil, nil):
throw StringError("supersign.yml: Must specify either orgID or bundleID")
throw StringError("xtool.yml: Must specify either orgID or bundleID")
}
if let iconPath = base.iconPath {
let ext = URL(fileURLWithPath: iconPath).pathExtension
guard ext == "png" else {
throw StringError("xtool.yml: iconPath should have a 'png' path extension. Got '\(ext)'.")
}
}
}
+27 -4
View File
@@ -10,8 +10,8 @@ public struct Packer: Sendable {
}
private func build() async throws {
let supersignDir = URL(fileURLWithPath: "supersign")
let packageDir = supersignDir.appendingPathComponent(".supersign-tmp")
let xtoolDir = URL(fileURLWithPath: "xtool")
let packageDir = xtoolDir.appendingPathComponent(".xtool-tmp")
try? FileManager.default.removeItem(at: packageDir)
try FileManager.default.createDirectory(at: packageDir, withIntermediateDirectories: true)
@@ -73,6 +73,15 @@ public struct Packer: Sendable {
)
let outputURL = output.url
@Sendable func packFileToRoot(srcName: String) async throws {
let srcURL = URL(fileURLWithPath: srcName)
let destURL = outputURL.appendingPathComponent(srcURL.lastPathComponent)
try FileManager.default.copyItem(at: srcURL, to: destURL)
try Task.checkCancellation()
}
@Sendable func packFile(srcName: String, dstName: String? = nil, sign: Bool = false) async throws {
let srcURL = URL(fileURLWithPath: srcName, relativeTo: binDir)
let dstURL = URL(fileURLWithPath: dstName ?? srcURL.lastPathComponent, relativeTo: outputURL)
@@ -100,16 +109,30 @@ public struct Packer: Sendable {
}
case .library(let name):
try await packFile(srcName: "lib\(name).dylib", dstName: "Frameworks/lib\(name).dylib", sign: true)
case .root(let source):
try await packFileToRoot(srcName: source)
}
}
}
if let iconPath = plan.iconPath {
group.addTask {
try await packFileToRoot(srcName: iconPath)
}
}
group.addTask {
try await packFile(srcName: "\(plan.product)-App", dstName: plan.product)
}
group.addTask {
var info = plan.infoPlist
if let iconPath = plan.iconPath {
let iconName = URL(fileURLWithPath: iconPath).deletingPathExtension().lastPathComponent
info["CFBundleIconFile"] = iconName
}
let infoPath = outputURL.appendingPathComponent("Info.plist")
let encodedPlist = try PropertyListSerialization.data(
fromPropertyList: plan.infoPlist,
fromPropertyList: info,
format: .xml,
options: 0
)
@@ -127,7 +150,7 @@ public struct Packer: Sendable {
}
}
let dest = URL(fileURLWithPath: "supersign")
let dest = URL(fileURLWithPath: "xtool")
.appendingPathComponent(output.url.lastPathComponent)
try? FileManager.default.removeItem(at: dest)
try output.persist(at: dest)
+34 -28
View File
@@ -107,41 +107,44 @@ public struct Planner: Sendable {
}
}
if let rootResources = schema.base.resources {
resources += rootResources.map { .root(source: $0) }
}
let bundleID = schema.idSpecifier.formBundleID(product: library.name)
let infoPlist: [String: Sendable]
var infoPlist: [String: Sendable] = [
"CFBundleInfoDictionaryVersion": "6.0",
"UIRequiredDeviceCapabilities": ["arm64"],
"LSRequiresIPhoneOS": true,
"CFBundleSupportedPlatforms": ["iPhoneOS"],
"CFBundlePackageType": "APPL",
"UIDeviceFamily": [1, 2],
"CFBundleDevelopmentRegion": "en",
"UISupportedInterfaceOrientations": ["UIInterfaceOrientationPortrait"],
"UISupportedInterfaceOrientations~ipad": [
"UIInterfaceOrientationPortrait",
"UIInterfaceOrientationPortraitUpsideDown",
"UIInterfaceOrientationLandscapeLeft",
"UIInterfaceOrientationLandscapeRight"
],
"UILaunchScreen": [:] as [String: Sendable],
"CFBundleVersion": "1",
"CFBundleShortVersionString": "1.0.0",
"MinimumOSVersion": deploymentTarget,
"CFBundleIdentifier": bundleID,
"CFBundleName": "\(library.name)",
"CFBundleExecutable": "\(library.name)",
]
if let plist = self.schema.base.infoPath {
let data = try await Data(reading: URL(fileURLWithPath: plist))
let info = try PropertyListSerialization.propertyList(from: data, format: nil)
if let info = info as? [String: Sendable] {
infoPlist = info
infoPlist.merge(info, uniquingKeysWith: { $1 })
} else {
throw StringError("Info.plist has invalid format: expected a dictionary.")
}
} else {
infoPlist = [
"CFBundleInfoDictionaryVersion": "6.0",
"UIRequiredDeviceCapabilities": ["arm64"],
"LSRequiresIPhoneOS": true,
"CFBundleSupportedPlatforms": ["iPhoneOS"],
"CFBundlePackageType": "APPL",
"UIDeviceFamily": [1, 2],
"CFBundleDevelopmentRegion": "en",
"UISupportedInterfaceOrientations": ["UIInterfaceOrientationPortrait"],
"UISupportedInterfaceOrientations~ipad": [
"UIInterfaceOrientationPortrait",
"UIInterfaceOrientationPortraitUpsideDown",
"UIInterfaceOrientationLandscapeLeft",
"UIInterfaceOrientationLandscapeRight"
],
"UILaunchScreen": [:] as [String: Sendable],
"CFBundleVersion": "1",
"CFBundleShortVersionString": "1.0.0",
"MinimumOSVersion": deploymentTarget,
"CFBundleIdentifier": bundleID,
"CFBundleName": "\(library.name)",
"CFBundleExecutable": "\(library.name)",
]
}
return Plan(
@@ -149,7 +152,8 @@ public struct Planner: Sendable {
deploymentTarget: deploymentTarget,
bundleID: bundleID,
infoPlist: infoPlist,
resources: resources
resources: resources,
iconPath: self.schema.base.iconPath
)
}
@@ -192,7 +196,7 @@ public struct Planner: Sendable {
throw StringError("""
Multiple library products were found (\(products.map(\.name))). Please either:
1) Expose exactly one library product, or
2) Specify the product you want via the 'product' key in supersign.yml.
2) Specify the product you want via the 'product' key in xtool.yml.
""")
}
guard let product = products.first(where: { $0.name == name }) else {
@@ -212,12 +216,14 @@ public struct Plan: Sendable {
public var bundleID: String
public var infoPlist: [String: any Sendable]
public var resources: [Resource]
public var iconPath: String?
}
public enum Resource: Codable, Sendable {
case bundle(package: String, target: String)
case binaryTarget(name: String)
case library(name: String)
case root(source: String)
}
private struct PackageDependency: Decodable {
+8 -4
View File
@@ -16,10 +16,10 @@ public struct XcodePacker {
public func createProject() async throws -> URL {
let targetName = "\(plan.product)-App"
let supersignDir: Path = "supersign"
let xtoolDir: Path = "xtool"
let projectDir: Path = supersignDir + ".supersign-tmp"
try? supersignDir.delete()
let projectDir: Path = xtoolDir + ".xtool-tmp"
try? xtoolDir.delete()
try projectDir.mkpath()
let infoPath = projectDir + "Info.plist"
@@ -80,9 +80,13 @@ public struct XcodePacker {
localPackagesGroup: ""
)
)
// TODO: Handle plan.resources of type .root
// TODO: Handle plan.iconPath
let generator = ProjectGenerator(project: project)
let xcodeproj = projectDir + "\(plan.product).xcodeproj"
let xcworkspace = supersignDir + "\(plan.product).xcworkspace"
let xcworkspace = xtoolDir + "\(plan.product).xcworkspace"
do {
let current = Path.current
Path.current = xcodeproj.parent()
@@ -1,20 +0,0 @@
# ``SupersignCLI``
The `supersign` command line interface (CLI).
## Overview
You can use `supersign` to interact with iOS applications and Apple Developer Services, including
- Building a Swift Package into an iOS app on **macOS or Linux**.
- Managing Codesigning Certificates, Devices, App Identifiers, and Provisioning Profiles across both free and paid Apple Developer accounts.
- Codesigning a `.ipa`.
- Installing a `.ipa` on your iOS device.
## Topics
### Getting Started
- <doc:Installation-Linux>
- <doc:Installation-macOS>
- <doc:First-app>
@@ -1,141 +0,0 @@
# Build Your First iOS App on Linux
Use Supersign to build and deploy an iOS app from your Linux machine.
## Prerequisites
First, make sure you've set up Supersign. Follow the steps in <doc:Installation-Linux> or <doc:Installation-macOS>.
## Overview
Once you've set up Supersign, you can use it to build, package, and install iOS apps from either Linux or macOS.
When building an iOS app on Linux, Supersign instructs SwiftPM to use the [Swift SDK for Cross Compilation](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0387-cross-compilation-destinations.md) that we built during the setup process; specifically, `arm64-apple-ios` from `darwin.artifactbundle`. This SDK contains the necessary modules for building iOS apps, such as UIKit and SwiftUI, as well as tools for building and manipulating iOS binaries. Swift SDKs are quite powerful, and you may want to check out the documentation to better understand how they work.
## Steps
### 1. Create an iOS-capable Swift Package
Supersign comes with a template for iOS-capable Swift Packages. To create a new package, run
```bash
supersign dev new Hello
# Creating package: Hello
# Creating Package.swift
# Creating supersign.yml
# Creating .gitignore
# Creating .sourcekit-lsp/config.json
# Creating Sources/Hello/HelloApp.swift
# Creating Sources/Hello/ContentView.swift
#
# Finished generating project Hello.
cd Hello
```
At this point, feel free to poke around. The package is structured just like a regular SwiftPM library, with the addition of two files:
- `supersign.yml`: This file describes how to bundle the Swift library into an iOS app. At minimum, you need to provide a Bundle ID. This defaults to `com.example.<PackageName>`, in this case `com.example.Hello`.
- `.sourcekit-lsp/config.json`: This file tells SourceKit to use the `arm64-apple-ios` Swift SDK. This allows IDEs like Visual Studio Code to understand how the package is built, and provide contextual IntelliSense/autocomplete suggestions related to iOS.
## 2. Build and install the app
From inside the package directory, run
```bash
supersign dev
# Planning...
# Building for debugging...
# [8/8] Linking Hello-App
# Build of product 'Hello-App' complete! (4.94s)
```
The first time you run this, SwiftPM might take a few minutes to build the app. This is because it needs to build the Swift Modules for the iOS SDK. Subsequent runs should be a lot faster since SwiftPM caches these modules globally.
After the build is complete, Supersign will attempt to install it on your device. You should see a line like
```bash
# Waiting for device to be connected...
```
At this point, connect your iOS device to your computer via USB. If you installed `libimobiledevice-utils` during setup, you can verify that your device is connected by running `ideviceinfo`. Supersign will continue after automatically detecting that your device is connected.
> Pairing:
>
> The first time you run `supersign dev`, you may see a "Trust" dialog on your iOS device to proceed with pairing. Tap **Trust** and enter your passcode on iOS. Supersign may throw an error after this: if so, just run `supersign dev` again.
Supersign will now connect to Apple Developer Services, register your device with your Apple ID, generate a Certificate + App ID + Provisioning Profile, sign the app, and then install it.
```bash
# Installing to device: Kabir's iPhone (udid: *****)
#
# [Unpacking app] 100%
# [Logging in] 100%
# [Preparing device] 100%
# [Provisioning] 100%
# [Signing] 100%
# [Packaging] 100%
# [Connecting] 100%
# [Installing] 100%
# [Verifying] 100%
```
> Enable Development Mode:
>
> At this point, you may run into an error asking you to enable **Development Mode** on your iOS device. Follow [these instructions](https://developer.apple.com/documentation/xcode/enabling-developer-mode-on-a-device) and then run `supersign dev` again.
## 3. Run the app
You should now see the app on your iOS device's home screen / App Library. Tap it to launch the app. You should see a "Hello World" message!
> Trust Your Certificate:
>
> The first time you launch the app, you might get an "Untrusted Developer" alert. To trust your developer identity, go to **Settings** > **General** > **VPN & Device Management** > _[your email]_ > **Trust**. You should now be able to launch the app.
@Row(numberOfColumns: 2) {
@Column {
![Hello world app](HelloWorld)
}
}
## 4. Edit the app
Open the project folder in your favorite IDE. As long as it supports Swift [via SourceKit-LSP](https://github.com/swiftlang/sourcekit-lsp/blob/242609dcad55824d9eb23269c0aeead187fd0faa/Documentation/Editor%20Integration.md), it should be able to understand your iOS project thanks to the `.sourcekit-lsp/config.json` file in the template.
For example, if you're using Visual Studio Code, this means you need to install the [Swift extension](https://marketplace.visualstudio.com/items?itemName=swiftlang.swift-vscode).
In `Sources/Hello/ContentView.swift`, let's update the "Hello, world!" text to be bold and purple:
```diff
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text("Hello, world!")
+ .bold()
+ .foregroundStyle(.purple)
}
.padding()
}
}
```
While you do this, if you've correctly configured your editor with Swift support you should receive intelligent autocomplete suggestions.
![Autocomplete](Autocomplete)
## 5. Re-install the app
Run `supersign dev` again to re-build and re-install. This should go a lot faster than the first time.
Launch the app again to see the updated text!
@Row(numberOfColumns: 2) {
@Column {
![Modified hello world app](HelloWorld-Purple)
}
}
@@ -1,110 +0,0 @@
# Installation (Linux)
Set up Supersign for iOS app development on Linux.
## Overview
This article outlines the steps to install `supersign` and begin developing iOS apps on Linux.
## Steps
### 1. Install Swift
First, install the latest Swift toolchain for your Linux distribution from <https://swift.org/install/linux>.
After following the steps there, confirm that Swift is installed correctly:
```bash
swift --version
# should say something like:
# Swift version 6.1 (swift-6.1-RELEASE)
```
### 2. Install libimobiledevice
Supersign relies on [libimobiledevice](https://libimobiledevice.org), or more specifically its [usbmuxd](https://github.com/libimobiledevice/usbmuxd) subproject, to talk to your iOS device from Linux.
Your Linux distro probably comes with a `usbmuxd` package, and it may be pre-installed. To check if it is, run:
```bash
file /var/run/usbmuxd
# /var/run/usbmuxd: socket
```
If you instead get a "No such file or directory" error, you need to install `usbmuxd` yourself. On Ubuntu, for example, you can do this with
```bash
sudo apt-get install \
usbmuxd libimobiledevice6 libimobiledevice-utils
```
`libimobiledevice6` and `libimobiledevice-utils` aren't strictly needed but they provide tools like `ideviceinfo` that may be useful for interacting with other aspects of your iOS device.
### 3. Download Supersign
Next, download the [latest GitHub Release](https://github.com/SuperchargeApp/Supersign/releases/latest) of `Supersign.AppImage` for your architecture. Rename it to `supersign` and add it to a location in your `PATH`.
```bash
curl -fL \
"https://github.com/SuperchargeApp/Supersign/releases/latest/download/Supersign-$(uname -m).AppImage" \
-o supersign
chmod +x supersign
sudo mv supersign /usr/local/bin/
```
Confirm that Supersign is installed correctly:
```bash
supersign --help
# OVERVIEW: The Supersign command line tool
# ...
```
### 4. Download Xcode.xip
From <http://developer.apple.com/download/all/?q=Xcode>, download **Xcode 16.3**. Note the path where `Xcode_16.3.xip` is saved.
### 5. Configure Supersign
Perform one-time setup with
```bash
supersign dev setup
```
You'll first be asked to log in:
```
Select login mode
0: API Key (requires paid Apple Developer Program membership)
1: Password (works with any Apple ID but uses private APIs)
Choice (0-1):
```
> Choosing a login mode:
>
> **API Key:** If you have a paid [Apple Developer Program](https://developer.apple.com/programs/enroll/) membership, this is the recommended option. It relies on the public App Store Connect API. You'll want to follow the [instructions](https://developer.apple.com/documentation/appstoreconnectapi/creating-api-keys-for-app-store-connect-api) to generate a **Team Key** with the **App Manager** role.
>
> **Password:** If you aren't enrolled in the paid developer program, you'll want to use password-based authentication. This relies on private Apple APIs to authenticate, so you may want to create a throwaway Apple ID to be extra cautious.
Once you select a login mode, you'll be asked to provide the corresponding credentials (API key or email+password+2FA). Needless to say, *your credentials are only sent to Apple* and nobody else (feel free to build Supersign from source and check!)
After you're logged in, you'll be asked to provide the path to the `Xcode.xip` file you downloaded earlier.
```
Path to Xcode.xip:
```
Enter the path (for example `~/Downloads/Xcode_16.3.xip`) and hit enter. Supersign will extract the Xcode XIP to generate and install an iOS Swift SDK for you.
Confirm that it worked:
```bash
swift sdk list
# darwin
```
## Next Steps
You're now ready to use Supersign! See <doc:First-app>.
@@ -1,7 +0,0 @@
# Installation (macOS)
Set up Supersign for declarative, Xcode-free iOS app development on macOS.
## Overview
TBD
@@ -1,65 +0,0 @@
import Foundation
import Supersign
import ArgumentParser
#if false
struct InstallSuperchargeCommand: AsyncParsableCommand {
static let configuration = CommandConfiguration(
commandName: "install",
abstract: "Install Supercharge"
)
@OptionGroup var connectionOptions: ConnectionOptions.WithoutSearchMode
func run() async throws {
guard let app = SupersignCLI.config.superchargeApp else {
throw Console.Error("This copy of Supersign is not configured to install Supercharge.")
}
let auth = try AuthToken.saved()
let client = try await connectionOptions.client(searchMode: .usb)
print("Installing to device: \(client.deviceName) (udid: \(client.udid))")
let installDelegate = SupersignCLIDelegate()
let installer = IntegratedInstaller(
udid: client.udid,
lookupMode: .only(client.connectionType),
appleID: auth.appleID,
token: auth.dsToken,
teamID: auth.teamID,
configureDevice: true,
storage: SupersignCLI.config.storage,
delegate: installDelegate
)
do {
let bundleID = try await installer.install(app: app)
print("\nSuccessfully installed!")
if let file = ProcessInfo.processInfo.environment["SUPERSIGN_METADATA_FILE"] {
do {
try Data("\(bundleID)\n".utf8).write(to: URL(fileURLWithPath: file))
} catch {
print("warning: Failed to write metadata to SUPERSIGN_METADATA_FILE: \(error)")
}
}
} catch {
print("\nFailed :(")
print("Error: \(error)")
return
}
}
}
struct SuperchargeCommand: ParsableCommand {
static let configuration = CommandConfiguration(
commandName: "supercharge",
abstract: "Configure/install Supercharge",
subcommands: [InstallSuperchargeCommand.self],
defaultSubcommand: InstallSuperchargeCommand.self
)
}
#endif
+4
View File
@@ -0,0 +1,4 @@
module XADI [extern_c] {
header "xadi.h"
link "xadi"
}
+13
View File
@@ -0,0 +1,13 @@
#include <stdint.h>
void xadi_Load(const char *path);
int32_t xadi_SetAndroidID(const char *identifier, uint32_t length);
int32_t xadi_SetProvisioningPath(const char *path);
int32_t xadi_ProvisioningErase(uint64_t dsId);
int32_t xadi_Synchronize(uint64_t dsId, const void *serverIntermediateMetadata, uint32_t serverIntermediateMetadataLength, void **machineIdentifier, uint32_t *machineIdentifierLength, void **synchronizationResumeMetadata, uint32_t *synchronizationResumeMetadataLength);
int32_t xadi_ProvisioningDestroy(uint32_t session);
int32_t xadi_ProvisioningEnd(uint32_t session, const void *persistentTokenMetadata, uint32_t persistentTokenMetadataLength, const void *trustKey, uint32_t trustKeyLength);
int32_t xadi_ProvisioningStart(uint64_t dsId, const void *serverProvisioningIntermediateMetadata, uint32_t serverProvisioningIntermediateMetadataLength, void **clientProvisioningIntermediateMetadata, uint32_t *clientProvisioningIntermediateMetadataLength, uint32_t *session);
int32_t xadi_GetLoginCode(uint64_t dsId);
int32_t xadi_Dispose(void *ptr);
int32_t xadi_OTPRequest(uint64_t dsId, void **machineIdentifier, uint32_t *machineIdentifierLength, void **oneTimePassword, uint32_t *oneTimePasswordLength);
@@ -1,6 +1,6 @@
//
// DeveloperServicesAssignAppGroupsOperation.swift
// Supersign
// XKit
//
// Created by Kabir Oberai on 14/10/19.
// Copyright © 2019 Kabir Oberai. All rights reserved.
@@ -1,6 +1,6 @@
//
// DeveloperServicesAddAppOperation.swift
// Supersign
// XKit
//
// Created by Kabir Oberai on 14/10/19.
// Copyright © 2019 Kabir Oberai. All rights reserved.
@@ -13,7 +13,6 @@ public struct DeveloperServicesAddAppOperation: DeveloperServicesOperation {
public enum Error: LocalizedError {
case invalidApp(URL)
case teamNotFound(DeveloperServicesTeam.ID)
public var errorDescription: String? {
switch self {
@@ -25,16 +24,6 @@ public struct DeveloperServicesAddAppOperation: DeveloperServicesOperation {
), $0
)
}
case .teamNotFound(let id):
return id.rawValue.withCString {
String.localizedStringWithFormat(
NSLocalizedString(
"add_app_operation.error.team_not_found",
value: "A team with the ID '%s' could not be found. Please select another team.",
comment: ""
), $0
)
}
}
}
}
@@ -115,9 +104,13 @@ public struct DeveloperServicesAddAppOperation: DeveloperServicesOperation {
.ok
}
} else {
_ = try await context.developerAPIClient
.bundleIdCapabilitiesDeleteInstance(path: .init(id: cap.id))
.noContent
// DeveloperServices doesn't allow deleting these capabilities
let requiredCapabilities: Set<Components.Schemas.CapabilityType> = [.inAppPurchase]
if let capType = cap.attributes?.capabilityType, !requiredCapabilities.contains(capType) {
_ = try await context.developerAPIClient
.bundleIdCapabilitiesDeleteInstance(path: .init(id: cap.id))
.noContent
}
}
}
for (typ, settings) in wantedCapabilities {
@@ -232,20 +225,6 @@ public struct DeveloperServicesAddAppOperation: DeveloperServicesOperation {
)
}
private func getTeamIsFree() async throws -> Bool {
switch context.auth {
case .appStoreConnect:
return false
case .xcode(let authData):
let client = DeveloperServicesClient(authData: authData)
let request = DeveloperServicesListTeamsRequest()
let teams = try await client.send(request)
guard let team = teams.first(where: { $0.id == authData.teamID })
else { throw Error.teamNotFound(authData.teamID) }
return team.isFree
}
}
// keyed by sanitized bundle ID
private func getCurrentAppIDs() async throws -> [String: Components.Schemas.BundleId] {
let bundleIDs = try await context.developerAPIClient.bundleIdsGetCollection().ok.body.json.data
@@ -265,7 +244,7 @@ public struct DeveloperServicesAddAppOperation: DeveloperServicesOperation {
apps += plugins.implicitContents.filter { $0.pathExtension.lowercased() == "appex" }
}
async let isFreeTeamTask = getTeamIsFree()
async let isFreeTeamTask = context.auth.team()?.isFree == true
async let appIDsTask = getCurrentAppIDs()
let (isFreeTeam, appIDs) = try await (isFreeTeamTask, appIDsTask)
@@ -1,6 +1,6 @@
//
// EntitlementWithTeamOrBundleID.swift
// Supersign
// XKit
//
// Created by Kabir Oberai on 12/10/19.
// Copyright © 2019 Kabir Oberai. All rights reserved.
@@ -1,6 +1,6 @@
//
// DeveloperServicesFetchCertificateOperation.swift
// Supersign
// XKit
//
// Created by Kabir Oberai on 13/10/19.
// Copyright © 2019 Kabir Oberai. All rights reserved.
@@ -72,19 +72,21 @@ public struct DeveloperServicesFetchCertificateOperation: DeveloperServicesOpera
_ certificates: [DeveloperServicesCertificate],
requireConfirmation: Bool
) async throws -> SigningInfo {
if !certificates.isEmpty, requireConfirmation {
guard await confirmRevocation(certificates)
else { throw CancellationError() }
}
try await withThrowingTaskGroup(of: Void.self) { group in
for certificate in certificates {
group.addTask {
_ = try await context.developerAPIClient
.certificatesDeleteInstance(path: .init(id: certificate.id))
.noContent
}
if try await context.auth.team()?.isFree == true {
if !certificates.isEmpty, requireConfirmation {
guard await confirmRevocation(certificates)
else { throw CancellationError() }
}
try await withThrowingTaskGroup(of: Void.self) { group in
for certificate in certificates {
group.addTask {
_ = try await context.developerAPIClient
.certificatesDeleteInstance(path: .init(id: certificate.id))
.noContent
}
}
try await group.waitForAll()
}
try await group.waitForAll()
}
let signingInfo = try await createCertificate()
signingInfoManager[self.context.auth.identityID] = signingInfo
@@ -17,7 +17,8 @@ extension DeveloperAPIClient {
),
transport: httpClient.asOpenAPITransport,
middlewares: [
auth.middleware
auth.middleware,
LoggingMiddleware(),
]
)
}
@@ -219,3 +220,39 @@ public struct DeveloperAPIASCAuthMiddleware: ClientMiddleware {
return try await next(request, body, baseURL)
}
}
struct LoggingMiddleware: ClientMiddleware {
static let regex: NSRegularExpression? = {
guard let pat = ProcessInfo.processInfo.environment["XTL_DEV_LOG"] else { return nil }
return try? NSRegularExpression(pattern: pat)
}()
func intercept(
_ request: HTTPRequest,
body: HTTPBody?,
baseURL: URL,
operationID: String,
next: (HTTPRequest, HTTPBody?, URL) async throws -> (HTTPResponse, HTTPBody?)
) async throws -> (HTTPResponse, HTTPBody?) {
var (response, body) = try await next(request, body, baseURL)
guard Self.regex?.firstMatch(
in: operationID,
range: NSRange(operationID.startIndex..., in: operationID)
) != nil
else { return (response, body) }
print("\n\(operationID) response status -> \(response.status)")
if let unwrapped = body {
let data = try await Data(collecting: unwrapped, upTo: .max)
// body may only be consumable once, replace it with the collected data
body = .init(data)
let text = String(decoding: data, as: UTF8.self)
print("\(operationID) response body -> \(text)")
}
return (response, body)
}
}
@@ -1,6 +1,6 @@
//
// DeveloperServicesAPIVersion.swift
// Supersign
// XKit
//
// Created by Kabir Oberai on 10/04/20.
// Copyright © 2020 Kabir Oberai. All rights reserved.
@@ -1,6 +1,6 @@
//
// DeveloperServicesLoginManager.swift
// Supersign
// XKit
//
// Created by Kabir Oberai on 10/04/20.
// Copyright © 2020 Kabir Oberai. All rights reserved.
@@ -1,6 +1,6 @@
//
// DeveloperServicesOperation.swift
// Supersign
// XKit
//
// Created by Kabir Oberai on 13/10/19.
// Copyright © 2019 Kabir Oberai. All rights reserved.
@@ -1,6 +1,6 @@
//
// DeveloperServicesProvisioningOperation.swift
// Supersign
// XKit
//
// Created by Kabir Oberai on 12/10/19.
// Copyright © 2019 Kabir Oberai. All rights reserved.
@@ -0,0 +1,59 @@
import Foundation
private actor DeveloperServicesTeamFetcher {
static let shared = DeveloperServicesTeamFetcher()
private var cache: [DeveloperServicesTeam.ID: Task<DeveloperServicesTeam, Error>] = [:]
private init() {}
func teams(forXcodeLogin auth: XcodeAuthData) async throws -> DeveloperServicesTeam {
let teamID = auth.teamID
if let cached = cache[teamID] {
return try await cached.value
}
let task = Task {
let client = DeveloperServicesClient(authData: auth)
let teams = try await client.send(DeveloperServicesListTeamsRequest())
guard let team = teams.first(where: { $0.id == teamID })
else { throw Errors.teamNotFound(teamID) }
return team
}
cache[auth.teamID] = task
return try await task.value
}
enum Errors: LocalizedError {
case teamNotFound(DeveloperServicesTeam.ID)
public var errorDescription: String? {
switch self {
case .teamNotFound(let id):
return id.rawValue.withCString {
String.localizedStringWithFormat(
NSLocalizedString(
"add_app_operation.error.team_not_found",
value: "A team with the ID '%s' could not be found. Please select another team.",
comment: ""
), $0
)
}
}
}
}
}
extension XcodeAuthData {
public func team() async throws -> DeveloperServicesTeam {
try await DeveloperServicesTeamFetcher.shared.teams(forXcodeLogin: self)
}
}
extension DeveloperAPIAuthData {
public func team() async throws -> DeveloperServicesTeam? {
switch self {
case .appStoreConnect: nil
case .xcode(let auth): try await auth.team()
}
}
}
@@ -1,6 +1,6 @@
//
// DeveloperServicesFetchDeviceOperation.swift
// Supersign
// XKit
//
// Created by Kabir Oberai on 13/10/19.
// Copyright © 2019 Kabir Oberai. All rights reserved.
@@ -1,6 +1,6 @@
//
// DeveloperServicesFetchProfileOperation.swift
// Supersign
// XKit
//
// Created by Kabir Oberai on 13/10/19.
// Copyright © 2019 Kabir Oberai. All rights reserved.
@@ -78,7 +78,7 @@ public struct DeveloperServicesFetchProfileOperation: DeveloperServicesOperation
data: .init(
_type: .profiles,
attributes: .init(
name: "SC profile \(bundleID.id)",
name: "XTL profile \(bundleID.id)",
profileType: .iosAppDevelopment
),
relationships: .init(

Some files were not shown because too many files have changed in this diff Show More