# iOSparkle Channel Specification (Feed v1)

This one file is the complete specification of an iOSparkle **Channel**: what a publisher must produce, how iOS consumes it, and how to prove the result is correct. An implementer needs nothing beyond this document — no other pages, and not the `iosparkle` command-line tool. The tool is an optional convenience that produces exactly what is described here.

The key words **MUST**, **MUST NOT**, **SHOULD**, and **MAY** are to be interpreted as described in RFC 2119.

## 1. Vocabulary

| Term | Meaning |
| --- | --- |
| **Channel** | The update stream for one variant of one app, published as a directory of static files at one HTTPS location. Example: `https://ota.example.com/my-app-dev/`. |
| **Feed** | The Channel's `feed.json`: a small JSON document describing the current build. |
| **Host App** | The iOS app that integrates iOSparkle and reads the Feed. |
| **Package** | The installable `.ipa` file. |
| **System installer** | The iOS system process that downloads the manifest and the package. It is not the Host App and shares nothing with it. |
| **Build** | One package, identified by the integer in its `CFBundleVersion`. |

A typical project has one Channel per app variant, such as `my-app-dev` for the bundle ID `com.example.myapp.dev`.

## 2. How iOS consumes a Channel

Every update crosses three HTTP requests made by two different processes.

```text
Host App (its own HTTP client; MAY send custom headers)
  1. GET <channel>/feed.json                         → the Feed
     |
     | user taps Update; the Host App asks iOS to open
     | itms-services://?action=download-manifest&url=<encoded manifest URL>
     v
System installer (no headers, no cookies, no certificate exceptions; public CAs only)
  2. GET <manifest URL>                              → manifest.plist
  3. GET, or GET with a Range header, <package URL>  → app-<build>.ipa
```

Everything after the Feed is fetched by a bare HTTPS client that attaches nothing the Host App configured. That single fact shapes the whole specification:

- `manifest.plist` and the package MUST be retrievable with a plain `GET` and no request headers.
- Their origins MUST use TLS certificates from a CA that iOS trusts out of the box, and MUST satisfy iOS App Transport Security without exceptions.
- `127.0.0.1` and `localhost` MUST NOT be used: the system installer refuses to fetch from the device itself.

## 3. Channel layout

```text
<channel>/
├── feed.json         the Feed (required)
├── manifest.plist    the install manifest (required)
├── app-<build>.ipa   the package (required)
└── index.html        first-time install page (required)
```

| File | Served as | Read by |
| --- | --- | --- |
| `feed.json` | `application/json; charset=utf-8` | The Host App |
| `manifest.plist` | `text/xml` | The system installer |
| `app-<build>.ipa` | `application/octet-stream` | The system installer |
| `index.html` | `text/html; charset=utf-8` | Safari, for the first install |

### 3.1 Addressing

- A Channel is identified by its **Channel URL**, the HTTPS URL of the directory. A trailing slash is optional; readers treat both forms alike.
- The Feed URL is the Channel URL with `feed.json` appended as a path component.
- The Channel URL SHOULD carry no query string or fragment. To make a Channel URL hard to guess, use a secret path prefix (see [10.2](#102-option-a-capability-url-pure-static)), never a query parameter.

### 3.2 Package naming and immutability

- The package file MUST be named `app-<build>.ipa`, where `<build>` is the package's `CFBundleVersion` in decimal, with no padding and no leading zeros: `app-118.ipa`.
- The name is immutable. A given `app-<build>.ipa` MUST always return the same bytes for as long as it exists. Rebuilding the same build number with different content requires a new Channel.
- Each publish SHOULD keep the new package and at least the previous one, and MAY delete older ones. The reference publisher keeps two by default.
- The three fixed names (`feed.json`, `manifest.plist`, `index.html`) are replaced by every publish. Any other file in the directory is left alone by publishers.

### 3.3 Publication order

A reader must never see a Feed that points at a missing file. Either publish to a staging directory and switch it in with a single atomic rename, or upload in this order:

1. `app-<build>.ipa`, uploaded completely before anything else.
2. `manifest.plist`.
3. `feed.json`.
4. `index.html`.

Never overwrite a package in place while it may be in use; see [10.5](#105-five-guaranteed-failures), item 5.

## 4. The Feed: `feed.json` v1

`feed.json` is a UTF-8 JSON object, without a byte order mark.

### 4.1 JSON Schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "iOSparkle Channel Feed v1 (feed.json)",
  "type": "object",
  "required": [
    "schemaVersion",
    "bundleId",
    "version",
    "build"
  ],
  "properties": {
    "schemaVersion": {
      "const": 1
    },
    "bundleId": {
      "type": "string",
      "minLength": 1
    },
    "version": {
      "type": "string",
      "minLength": 1
    },
    "build": {
      "type": "integer",
      "minimum": 1,
      "maximum": 9223372036854775807
    },
    "manifestURL": {
      "type": "string",
      "pattern": "^https://[^/?#]+"
    },
    "publishedAt": {
      "type": "string",
      "format": "date-time",
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}[Tt][0-9]{2}:[0-9]{2}:[0-9]{2}(?:\\.[0-9]+)?(?:[Zz]|[+-][0-9]{2}:[0-9]{2})$"
    },
    "commit": {
      "type": "string"
    },
    "minimumOSVersion": {
      "type": "string",
      "pattern": "^[0-9]+(?:\\.[0-9]+)*$"
    },
    "releaseNotes": {
      "type": "string"
    },
    "sizeBytes": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9223372036854775807
    },
    "sha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    }
  },
  "additionalProperties": true
}
```

The schema is the publisher's contract. Two rules of the wire format go beyond what JSON Schema can express, and both are enforced by iOSparkle's decoders:

- **Integers must be written as integer literals.** `118` is valid; `118.0`, `118e0`, `"118"`, and `true` are not, although `type: integer` in the schema accepts `118.0`.
- **An optional field is either absent or well typed.** `null` is never a valid value: `"commit": null` makes the whole Feed malformed.

### 4.2 Fields

| Field | Type | Required | Rules | Used for |
| --- | --- | --- | --- | --- |
| `schemaVersion` | integer | **Yes** | Exactly `1` for this version. See [4.4](#44-schema-versions). | Protocol negotiation. |
| `bundleId` | string | **Yes** | Non-empty. Equal to the package's `CFBundleIdentifier`. | The Host App discards a Feed whose `bundleId` differs from its own. |
| `version` | string | **Yes** | Non-empty. Equal to the package's `CFBundleShortVersionString`, for example `1.4.0`. | Display only; never compared. |
| `build` | integer | **Yes** | `>= 1`. Equal to the package's `CFBundleVersion`, and to `<build>` in the package filename. | The only update comparison: an update exists when `feed.build` is greater than the running app's `CFBundleVersion`. |
| `manifestURL` | string | No | Absolute `https` URL with a host. No default when present. | The manifest's location. Omit for a static Channel, where the manifest is `manifest.plist` in the Channel directory. Set it when the manifest is served from elsewhere or by a dynamic gate ([10.3](#103-option-b-bearer-protected-feed-with-short-lived-links)). |
| `publishedAt` | string | No | ISO 8601 / RFC 3339: `YYYY-MM-DDThh:mm:ss`, optional `.fraction` of up to nine digits, then `Z` or `±hh:mm`. | Display. |
| `commit` | string | No | Any text. SHOULD be the 7 to 40 hex characters of the source revision. | Display; the first seven characters are shown. |
| `minimumOSVersion` | string | No | Dot-separated integers, such as `17.0` or `17.0.1`. | Devices on an older OS are never offered the update. A value that is not dot-separated integers has the same effect as an impossible version: the build is uninstallable. |
| `releaseNotes` | string | No | Plain text. MUST NOT contain markup: it is shown as text, never rendered. | Display. The first six lines and 280 characters appear in the update alert. |
| `sizeBytes` | integer | No | `>= 0`. Equal to the package's size in bytes. | Display, and the end-to-end check in [11](#11-verification-checklist). |
| `sha256` | string | No | Exactly 64 lowercase hex characters: the SHA-256 of the whole package file. | The end-to-end check in [11](#11-verification-checklist). |

Unknown keys at any level MUST be ignored by readers and MAY be added by publishers.

### 4.3 Valid examples

Minimal — the four required fields:

```json
{
  "schemaVersion": 1,
  "bundleId": "com.example.myapp.dev",
  "version": "1.4.0",
  "build": 118
}
```

Full — every optional field, plus an unknown key that readers ignore:

```json
{
  "schemaVersion": 1,
  "bundleId": "com.example.myapp.dev",
  "version": "1.4.0",
  "build": 118,
  "manifestURL": "https://ota.example.com/my-app-dev/manifest.plist",
  "publishedAt": "2026-12-05T09:30:00.125Z",
  "commit": "79806e2e",
  "minimumOSVersion": "17.0",
  "releaseNotes": "Plain-text summary",
  "sizeBytes": 25629710,
  "sha256": "350930f5c6afe8738841fef0da90d968309033bcb5fb7e584bb96620e5df5a48",
  "futureHint": "ignored"
}
```

### 4.4 Schema versions

- `schemaVersion` greater than the highest version a reader supports means "newer than I understand". A reader MUST ignore such a Feed without treating it as malformed: it keeps whatever it knew before and installs nothing from it. The Host App updater preserves its previous state; a publisher's tool reports the Feed as unusable rather than trying to interpret it.
- `schemaVersion` of `1` is this specification.
- Any other value (`0`, negative, `1.0`, a string, missing) makes the Feed malformed.

### 4.5 Reading algorithm

1. Parse the document as UTF-8 JSON. It must be an object.
2. Read `schemaVersion`. If it is greater than `1`, stop: newer schema. If it is not exactly `1`, stop: malformed.
3. Validate the four required fields for presence, type, and the rules in [4.2](#42-fields).
4. For each optional field that is present, validate its type and format. A field that is present and invalid makes the Feed malformed.
5. Resolve the manifest URL: `manifestURL` if present, otherwise `manifest.plist` in the Channel directory.
6. Compare `build` with the running app's `CFBundleVersion`.

## 5. The install manifest: `manifest.plist`

`manifest.plist` is an XML property list that tells iOS where the package is and what it contains. This is the complete template; replace the five values in `metadata` and the one `url`:

```xml
<?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>items</key>
  <array>
    <dict>
      <key>assets</key>
      <array>
        <dict>
          <key>kind</key><string>software-package</string>
          <key>url</key><string>https://ota.example.com/my-app-dev/app-118.ipa</string>
        </dict>
      </array>
      <key>metadata</key>
      <dict>
        <key>bundle-identifier</key><string>com.example.myapp.dev</string>
        <key>bundle-version</key><string>1.4.0</string>
        <key>kind</key><string>software</string>
        <key>platform-identifier</key><string>com.apple.platform.iphoneos</string>
        <key>title</key><string>MyApp Dev</string>
      </dict>
    </dict>
  </array>
</dict>
</plist>
```

### 5.1 Fields

| Path | Value | Rules |
| --- | --- | --- |
| `items` | array | Exactly one element. |
| `items[0].assets` | array | Exactly one element. |
| `items[0].assets[0].kind` | `software-package` | Fixed. |
| `items[0].assets[0].url` | string | Absolute `https` URL of the package. Taken verbatim from the Channel, with no additional URL encoding. |
| `items[0].metadata.bundle-identifier` | string | MUST equal `bundleId` in the Feed and `CFBundleIdentifier` in the package. iOS uses it to match the installed app, so an OTA update replaces the app in place and keeps its data. |
| `items[0].metadata.bundle-version` | string | SHOULD equal `version` in the Feed (the package's `CFBundleShortVersionString`). The reference verifier also accepts the build number written as a string. |
| `items[0].metadata.kind` | `software` | Fixed. |
| `items[0].metadata.platform-identifier` | `com.apple.platform.iphoneos` | Fixed for an iOS package. |
| `items[0].metadata.title` | string | Shown in the iOS install dialog. SHOULD be the package's `CFBundleDisplayName` or `CFBundleName`. |

### 5.2 XML escaping

Every value written into the manifest is text in an XML document and MUST be escaped, in this order: `&` → `&amp;`, `<` → `&lt;`, `>` → `&gt;`, `"` → `&quot;`, `'` → `&apos;`. `&` is escaped first so that the entities introduced for the other characters are not escaped again.

A package URL with a query string is where this matters: `https://ota.example.com/app.ipa?token=a&sig=b` is written as `https://ota.example.com/app.ipa?token=a&amp;sig=b`.

### 5.3 What the manifest leaves out, and why

- `md5`: deprecated by Apple and ignored whenever a SHA-256 value is present. It is not a meaningful integrity check.
- A single-value `sha256` on the asset: it entered Apple's manifest specification only with iOS 26.0, so iOS 16 through iOS 25 cannot be relied on to honor it.
- `display-image` and `full-size-image`: optional. iOS shows a placeholder icon while downloading.

Integrity is covered elsewhere. iOS verifies the package's code signature and provisioning profile after unpacking, whatever the manifest says. The publisher-side end-to-end check uses `sha256` and `sizeBytes` in the Feed, compared with the bytes the Channel actually serves ([11](#11-verification-checklist)).

## 6. The install link and RFC 3986 double encoding

The Host App starts an installation by asking iOS to open this URL:

```text
itms-services://?action=download-manifest&url=<encoded manifest URL>
```

### 6.1 The rule

`<encoded manifest URL>` is the complete manifest URL with **every UTF-8 byte percent-encoded except the RFC 3986 `unreserved` characters** `A-Z a-z 0-9 - . _ ~`. Hex digits are uppercase. Nothing else is left bare: `:` `/` `?` `#` `[` `]` `@` `!` `$` `&` `'` `(` `)` `*` `+` `,` `;` `=` and every space and non-ASCII byte are encoded.

The effect is a **double encoding** of anything the manifest URL had already encoded. A SigV4 credential containing `%2F` becomes `%252F`; `&` becomes `%26`; `+` becomes `%2B`; `=` becomes `%3D`; a space becomes `%20`, and a space the URL had already written as `%20` becomes `%2520`. iOS decodes the `url` parameter exactly once and recovers the original manifest URL byte for byte, so signatures and tokens survive.

Encoding the whole value this way is what keeps the outer query intact. If `&` or `=` were left bare, the outer parser would end the `url` parameter at the first one, and the manifest request would arrive truncated.

The two escaping layers must not be confused:

| Where | Escaping |
| --- | --- |
| The `url=` parameter of the `itms-services://` link | RFC 3986 percent-encoding of the whole manifest URL (this section). |
| The `<string>` value of `items[0].assets[0].url` in `manifest.plist` | XML entity escaping only ([5.2](#52-xml-escaping)). No URL encoding. |
| An `itms-services://` link inside `index.html` | Percent-encoding as above, **and** the literal `&` before `url=` written as `&amp;`. |

### 6.2 Test vectors

These vectors are the reference set. Every encoder MUST reproduce `encodedURL` for `manifestURL`, and `itmsURL` exactly. The fourth vector covers the unreserved characters, a combining accent, CJK text, and every reserved symbol.

```json
[
  {
    "manifestURL": "https://ota.example.com/my-app-dev/manifest.plist",
    "encodedURL": "https%3A%2F%2Fota.example.com%2Fmy-app-dev%2Fmanifest.plist",
    "itmsURL": "itms-services://?action=download-manifest&url=https%3A%2F%2Fota.example.com%2Fmy-app-dev%2Fmanifest.plist"
  },
  {
    "manifestURL": "https://s3.ota.example.com/channels/my%20app/manifest.plist?X-Amz-Credential=AKIAIOSFODNN7EXAMPLE%2F20261205%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=deadbeef&token=a+b=c%2Fd",
    "encodedURL": "https%3A%2F%2Fs3.ota.example.com%2Fchannels%2Fmy%2520app%2Fmanifest.plist%3FX-Amz-Credential%3DAKIAIOSFODNN7EXAMPLE%252F20261205%252Fus-east-1%252Fs3%252Faws4_request%26X-Amz-Signature%3Ddeadbeef%26token%3Da%2Bb%3Dc%252Fd",
    "itmsURL": "itms-services://?action=download-manifest&url=https%3A%2F%2Fs3.ota.example.com%2Fchannels%2Fmy%2520app%2Fmanifest.plist%3FX-Amz-Credential%3DAKIAIOSFODNN7EXAMPLE%252F20261205%252Fus-east-1%252Fs3%252Faws4_request%26X-Amz-Signature%3Ddeadbeef%26token%3Da%2Bb%3Dc%252Fd"
  },
  {
    "manifestURL": "https://r2.ota.example.com/channels/my app/manifest.plist?X-Amz-Credential=AKIAIOSFODNN7EXAMPLE%2F20261205%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=deadbeef&token=a+b=c%2Fd&label=release%20candidate",
    "encodedURL": "https%3A%2F%2Fr2.ota.example.com%2Fchannels%2Fmy%20app%2Fmanifest.plist%3FX-Amz-Credential%3DAKIAIOSFODNN7EXAMPLE%252F20261205%252Fus-east-1%252Fs3%252Faws4_request%26X-Amz-Signature%3Ddeadbeef%26token%3Da%2Bb%3Dc%252Fd%26label%3Drelease%2520candidate",
    "itmsURL": "itms-services://?action=download-manifest&url=https%3A%2F%2Fr2.ota.example.com%2Fchannels%2Fmy%20app%2Fmanifest.plist%3FX-Amz-Credential%3DAKIAIOSFODNN7EXAMPLE%252F20261205%252Fus-east-1%252Fs3%252Faws4_request%26X-Amz-Signature%3Ddeadbeef%26token%3Da%2Bb%3Dc%252Fd%26label%3Drelease%2520candidate"
  },
  {
    "manifestURL": "https://ota.example.com/Az09-._~/café/清單.plist?extras=!$'()*+#preview",
    "encodedURL": "https%3A%2F%2Fota.example.com%2FAz09-._~%2Fcafe%CC%81%2F%E6%B8%85%E5%96%AE.plist%3Fextras%3D%21%24%27%28%29%2A%2B%23preview",
    "itmsURL": "itms-services://?action=download-manifest&url=https%3A%2F%2Fota.example.com%2FAz09-._~%2Fcafe%CC%81%2F%E6%B8%85%E5%96%AE.plist%3Fextras%3D%21%24%27%28%29%2A%2B%23preview"
  }
]
```

### 6.3 Reference implementations

Each implementation passes all four vectors.

Swift (byte-exact; this is the algorithm iOSparkle itself uses):

```swift
import Foundation

/// Percent-encodes every UTF-8 byte except the RFC 3986 `unreserved` set.
func percentEncode(_ value: String) -> String {
    let hex = Array("0123456789ABCDEF".utf8)
    var encoded: [UInt8] = []
    encoded.reserveCapacity(value.utf8.count)
    for byte in value.utf8 {
        switch byte {
        case 0x41...0x5A, 0x61...0x7A, 0x30...0x39, 0x2D, 0x2E, 0x5F, 0x7E:  // A-Z a-z 0-9 - . _ ~
            encoded.append(byte)
        default:
            encoded.append(0x25)  // %
            encoded.append(hex[Int(byte >> 4)])
            encoded.append(hex[Int(byte & 0x0F)])
        }
    }
    return String(decoding: encoded, as: UTF8.self)
}

func installURL(for manifestURL: String) -> String {
    "itms-services://?action=download-manifest&url=\(percentEncode(manifestURL))"
}
```

Do not use `addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)` for this. That character set describes the characters allowed in a whole query string, so it leaves `&`, `=`, and `+` bare and produces exactly the truncation described above.

Python:

```python
from urllib.parse import quote

def percent_encode(value: str) -> str:
    """Percent-encode every UTF-8 byte except RFC 3986 unreserved characters."""
    return quote(value, safe="")  # the default safe="/" would leave slashes bare

def install_url(manifest_url: str) -> str:
    return f"itms-services://?action=download-manifest&url={percent_encode(manifest_url)}"
```

JavaScript and TypeScript:

```ts
/** Percent-encode every UTF-8 byte except RFC 3986 unreserved characters. */
function percentEncode(value: string): string {
  return encodeURIComponent(value).replace(/[!'()*]/g, (c) =>
    "%" + c.charCodeAt(0).toString(16).toUpperCase()
  );
}

function installURL(manifestURL: string): string {
  return `itms-services://?action=download-manifest&url=${percentEncode(manifestURL)}`;
}
```

`encodeURIComponent` alone is not enough: it leaves `! ' ( ) *` bare, and it throws on malformed surrogate pairs. Do not use `URLSearchParams` for this either; it writes a space as `+`.

POSIX shell (uses only `printf`, `od`, `tr`, and `awk`):

```sh
# POSIX sh. percent_encode "<manifest url>" prints the encoded value.
percent_encode() {
  printf '%s' "$1" \
    | LC_ALL=C od -An -v -tx1 \
    | LC_ALL=C tr -s ' \n' '\n\n' \
    | LC_ALL=C awk 'NF == 0 { next }
      {
        h = tolower($1) ""              # compare as text, not as a number
        if ((h >= "30" && h <= "39") || (h >= "41" && h <= "5a") || (h >= "61" && h <= "7a") ||
            h == "2d" || h == "2e" || h == "5f" || h == "7e") {
          n = index("0123456789abcdef", substr(h, 1, 1)) - 1
          n = n * 16 + index("0123456789abcdef", substr(h, 2, 1)) - 1
          printf "%c", n
        } else {
          printf "%%%s", toupper(h)
        }
      }'
}

install_url() {
  printf 'itms-services://?action=download-manifest&url=%s\n' "$(percent_encode "$1")"
}
```

Where `jq` is available, its `@uri` filter is equivalent and passes the same vectors:

```sh
encoded=$(jq -rn --arg url "$manifest_url" '$url|@uri')
```

### 6.4 Self-test

Decode the `url` parameter of your install link exactly once and compare bytes with the manifest URL you started from. They must be identical. Then check your output against every vector in [6.2](#62-test-vectors).

## 7. The first-install page: `index.html`

Safari cannot install an app from an `.ipa` link directly; it needs the `itms-services://` link. `index.html` is the page a person opens once, on the device, to install the first build.

- It MUST contain an anchor whose `href` is the install link from [6](#6-the-install-link-and-rfc-3986-double-encoding), with the literal `&` before `url=` written as `&amp;`.
- It SHOULD show the title, the version and build, and the bundle ID.
- It SHOULD show a QR code of the Channel URL so the page can be opened from the device camera.
- It SHOULD be a single self-contained page with no external scripts or style sheets.
- The `href` is rebuilt on every publish, because the version it leads to changes.

A minimal page:

```html
<!doctype html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>MyApp Dev</title>
<h1>MyApp Dev 1.4.0 (118)</h1>
<p>com.example.myapp.dev</p>
<p><a href="itms-services://?action=download-manifest&amp;url=https%3A%2F%2Fota.example.com%2Fmy-app-dev%2Fmanifest.plist">Install</a></p>
```

## 8. HTTP and TLS requirements

### 8.1 Response headers

| File | Status | `Content-Type` | `Cache-Control` | Other |
| --- | --- | --- | --- | --- |
| `feed.json` | `200` | `application/json; charset=utf-8` | `no-store` | — |
| `manifest.plist` | `200` | `text/xml` | `no-store` | Serve the document directly; do not redirect. |
| `app-<build>.ipa` | `200`, or `206` for a `Range` request | `application/octet-stream` | `public, max-age=31536000, immutable` | An exact `Content-Length`, `Accept-Ranges: bytes`, and byte-for-byte identity transfer. |
| `index.html` | `200` | `text/html; charset=utf-8` | `no-cache` | — |

For the package, "identity transfer" means **no dynamic gzip or Brotli compression and no chunked transfer encoding**. The system installer reads `Content-Length` to show progress and resumes interrupted downloads with `Range` requests; both break when the body is recompressed per request or has no declared length. It must answer a `Range: bytes=…` request with `206 Partial Content` and a `Content-Range` header. Support for `HEAD` is not required and MUST NOT be assumed.

`Cache-Control: no-store` on the Feed and the manifest matters as much: a cached Feed hides the release you just published, and a cached manifest can point at a package that has since been removed. The package filename is immutable, so it may be cached forever.

### 8.2 TLS

- HTTPS only. `http://` URLs are rejected for the Feed, the manifest, and the package.
- TLS 1.2 or later with forward secrecy, and a certificate from a CA in the iOS system trust store — for example one issued by Let's Encrypt — whose name matches the host.
- Exception configurations in the Host App's `Info.plist` have no effect on the system installer. A private CA works only if its root is installed on every device and manually set to fully trusted there; prefer a publicly trusted certificate.

### 8.3 Redirects

| Request | Redirects |
| --- | --- |
| `feed.json` | Followed by the Host App only when the target is `https`. The `iosparkle` tool follows none and reports the `3xx` status as an error, so a login redirect is never mistaken for a missing Feed. |
| `manifest.plist` | SHOULD be served with `200` directly. |
| `app-<build>.ipa` | A clean `https` → `https` redirect is acceptable. No hop may use `http://`. |

### 8.4 Checking a live Channel

```sh
BASE=https://ota.example.com/my-app-dev
curl -sS -o /dev/null -D - "$BASE/feed.json"            # 200 · application/json · Cache-Control: no-store
curl -sS -o /dev/null -D - "$BASE/manifest.plist"       # 200 · text/xml · Cache-Control: no-store
curl -sS -o /dev/null -D - -r 0-0 "$BASE/app-118.ipa"   # 206 · application/octet-stream · Accept-Ranges: bytes
```

The third command requests a single byte, which also shows the package's full size in `Content-Range`.

## 9. The package

- The `.ipa` is a ZIP archive containing exactly one app directory, `Payload/<Name>.app`.
- `Payload/<Name>.app/Info.plist` sets the three values the Feed must echo: `CFBundleIdentifier` = `bundleId`, `CFBundleShortVersionString` = `version`, `CFBundleVersion` = `build`. `CFBundleVersion` MUST be a positive integer written in decimal.
- `MinimumOSVersion` in `Info.plist`, when present, SHOULD be copied into the Feed's `minimumOSVersion`.
- The app MUST be signed and carry `Payload/<Name>.app/embedded.mobileprovision`, and that profile MUST authorize devices for OTA installation: a Development or Ad Hoc profile (`ProvisionedDevices`), or an In-House profile (`ProvisionsAllDevices`). A package exported for the App Store has no device authorization and fails to install with "Unable to install". `publish` in the `iosparkle` tool refuses such a package.
- `CFBundleDisplayName` or `CFBundleName` is the manifest `title`.
- Devices need Developer Mode enabled (iOS 16 and later) and must trust the signing developer the first time.

## 10. Private Channels

A private Channel restricts who can read the Feed and download the package. Because of the two-process model in [2](#2-how-ios-consumes-a-channel), only two places can enforce access: the Channel URL itself, and the one request the Host App makes.

### 10.1 What cannot work

Each of the following fails at the system installer, every time:

- **Request headers from the Host App.** They reach `feed.json` only.
- **Cookies**, including a session established in Safari or a web view.
- **HTTP Basic authentication.** A `401` challenge gets no prompt, and `user:password@` in a URL is stripped.
- **An interactive login redirect** (an identity-aware proxy that answers with a sign-in page).
- **Certificate exceptions in the Host App**, self-signed certificates, and `localhost`/`127.0.0.1` origins.

### 10.2 Option A: capability URL (pure static)

Make the Channel URL unguessable and serve it from any static host.

```text
https://ota.example.com/<secret>/my-app-dev/
```

- `<secret>` is at least 256 bits of cryptographic randomness, written as 64 hex characters: `openssl rand -hex 32`.
- Every file in the Channel is reachable by anyone who knows the URL, and nothing else is. The provisioning profile remains the hard gate: a package only installs on a device it lists.
- Disable directory listings. Send `X-Robots-Tag: noindex` and `Referrer-Policy: no-referrer`. Keep the URL out of logs and public repositories.
- To revoke, publish to a new prefix and ship a new Host App build that points at it.
- This option never expires and needs no code. It SHOULD be the default choice for personal and small-team Channels.

### 10.3 Option B: bearer-protected Feed with short-lived links

When the Feed must be revocable per user, protect the one request the Host App makes and hand the system installer unguessable, short-lived URLs.

1. The Host App sends `Authorization: Bearer <token>` with every `feed.json` request.
2. A gate in front of the Channel validates the token and returns the Feed with a `manifestURL` that carries its own credential, for example:

   ```text
   https://ota.example.com/my-app-dev/manifest.plist?expires=<unix-seconds>&signature=<hex>
   signature = hex(HMAC-SHA-256(secret, "<path>|<expires>"))
   ```

3. When the system installer fetches that URL — with no headers — the gate checks `expires` and `signature`, renders `manifest.plist`, and answers with `text/xml` and `Cache-Control: no-store`.
4. The manifest's package `url` is minted at that moment and is itself short-lived: either a SigV4 presigned `GET` on S3 or R2 with `X-Amz-Expires` of an hour or so, or another signed link on the same origin that streams the package with an exact `Content-Length` and Range support.
5. The gate holds no state beyond its secrets. The Feed and the packages are stored as in a static Channel.

Rules for a correct gate:

- The manifest link's lifetime MUST comfortably exceed the longest gap between a Feed refresh and the user tapping Install; one hour is a reasonable minimum.
- Presigned package URLs MUST be created per request and MUST NOT be written into a file. A presigned URL stored in a static `manifest.plist` expires — after at most seven days — and then every device fails with `403`.
- The signed links support `GET` only. Any verification must use `GET` or a ranged `GET`, never `HEAD`: a SigV4 signature is bound to the HTTP method, and `HEAD` against a `GET`-presigned URL is rejected with `403 SignatureDoesNotMatch`.
- The Feed and manifest responses are always `Cache-Control: no-store`.
- First-time installation is out of scope for this option, since Safari cannot send the bearer token. Install the first build from Xcode and let the app update itself afterwards.

For a package on S3 or R2, a presigned `GET` is computed as follows; every step has been checked against AWS's own signer:

```text
amzDate          = UTC time as YYYYMMDDThhmmssZ
scope            = <YYYYMMDD of amzDate>/<region>/s3/aws4_request        (region is "auto" for R2)
query            = the five parameters, sorted by name, each value strictly percent-encoded:
                   X-Amz-Algorithm=AWS4-HMAC-SHA256
                   X-Amz-Credential=<access key id>/<scope>
                   X-Amz-Date=<amzDate>
                   X-Amz-Expires=<seconds, at most 604800>
                   X-Amz-SignedHeaders=host
path             = "/" + <bucket> + "/" + each segment of <object key>, percent-encoded
canonicalRequest = "GET\n" + path + "\n" + query + "\n" + "host:" + <host> + "\n" + "\n" + "host\n" + "UNSIGNED-PAYLOAD"
stringToSign     = "AWS4-HMAC-SHA256\n" + amzDate + "\n" + scope + "\n" + hex(SHA-256(canonicalRequest))
signingKey       = HMAC-SHA-256(HMAC-SHA-256(HMAC-SHA-256(HMAC-SHA-256("AWS4" + <secret key>, <YYYYMMDD>), <region>), "s3"), "aws4_request")
signature        = hex(HMAC-SHA-256(signingKey, stringToSign))
URL              = "https://" + <host> + path + "?" + query + "&X-Amz-Signature=" + signature
```

The host is the S3 regional host, or `<account id>.r2.cloudflarestorage.com` for R2. R2's custom domains do not validate SigV4 parameters, so the presigned URL must use that account host.

### 10.4 Choosing

| Need | Choose |
| --- | --- |
| Personal devices or a small team; no code | [Option A](#102-option-a-capability-url-pure-static) |
| Revoke a tester's access without rebuilding; packages in a private bucket | [Option B](#103-option-b-bearer-protected-feed-with-short-lived-links) |

A trusted private network is a third way to keep a Channel private with no code at all: serve it from a host reachable only through the team's VPN, under a publicly trusted certificate.

### 10.5 Five guaranteed failures

1. **Encoding the manifest URL with a permissive character set.** `&`, `=`, and `+` left bare truncate the manifest URL at the first `&`; a `+` decoded as a space corrupts a token. Every device fails with `403` or a manifest error. Use the encoder in [6.3](#63-reference-implementations).
2. **Storing a presigned package URL in a static manifest.** It stops working when it expires — after at most seven days — and then no device can update until the next publish. Mint package URLs when the manifest is requested.
3. **Expecting the system installer to inherit the Host App's authentication.** Headers, cookies, and certificate exceptions never reach it. Protect the Feed with headers and everything else with URLs.
4. **Probing a presigned URL with `HEAD`.** The method is part of the signature; the answer is `403`. Use `GET`, or a ranged `GET`.
5. **Overwriting a fixed `app.ipa` in place.** A device that is resuming an interrupted download with `Range` receives bytes from two different packages, and the install fails with a checksum or archive error. Publish under a new `app-<build>.ipa` name and leave the previous one in place.

## 11. Verification checklist

A publisher is done when every item holds.

- [ ] The Channel directory contains `feed.json`, `manifest.plist`, `app-<build>.ipa`, and `index.html`, and `<build>` equals `build` in the Feed.
- [ ] `feed.json` validates against the schema in [4.1](#41-json-schema); its integers are integer literals; it has no `null`; `bundleId`, `version`, and `build` equal the package's `CFBundleIdentifier`, `CFBundleShortVersionString`, and `CFBundleVersion`.
- [ ] `sizeBytes` and `sha256` equal the byte count and the SHA-256 of the package file actually served.
- [ ] `manifest.plist` is a well-formed XML property list with exactly the keys of the template in [5](#5-the-install-manifest-manifestplist); its values are XML-escaped; `bundle-identifier` equals `bundleId`; its `url` is `https` and resolves with a plain `GET`.
- [ ] Your encoder reproduces every `encodedURL` and `itmsURL` in [6.2](#62-test-vectors), and decoding the `url` parameter of your install link once returns the original manifest URL.
- [ ] `index.html` contains the install link, with `&amp;` before `url=`.
- [ ] The response headers match [8.1](#81-response-headers), checked on the live Channel with [8.4](#84-checking-a-live-channel).
- [ ] Downloading the manifest URL and the package with a plain `GET`, sending no headers and using a default-trust HTTPS client, succeeds; the package's size and SHA-256 match the Feed.
- [ ] The package is signed with a Development, Ad Hoc, or In-House profile that lists the test devices.
- [ ] Publishing a second build leaves the previous `app-<build>.ipa` in place and replaces only the three fixed files.

If the `iosparkle` tool is available, `iosparkle verify --channel-url <channel> --ipa <local.ipa>` performs the Feed, manifest, package, size, and SHA-256 checks in one step.
