What the test proves
The Swift program creates a URLRequest, hashes its body with SHA-256 and signs a defined message with HMAC-SHA256. An independent TypeScript verifier checks the body, canonical message and signature. A local test server accepts valid requests and rejects four failure cases.
The observed run used macOS 26.2, Apple Swift 6.3.3 and Bun 1.3.14. The shared request builder also passed an arm64 iOS 15 target type check with the iPhoneOS SDK. Native execution was on macOS, not an iPhone. This is a test protocol with a public test key, not a recovered customer app.
Download and run the fixture
You need a Mac with Xcode, its iPhoneOS SDK and Bun. Download the Swift and TypeScript example, unpack it, open the unpacked folder in a terminal and run:
bun scripts/verify-apple-request-fixture.tsThe archive contains the Swift request builder, Swift runner, TypeScript verifier and README. The verifier builds a temporary executable, starts a server on the loopback interface and removes its generated executable after the test. No external API or private credential is required. The Swift request uses fixture.invalid and is never sent to that host.
Define every signed byte
This fixture joins the method, encoded path and query, timestamp, nonce and body digest with newline bytes. There is no newline after the digest. The public key is sreverse-owned-fixture-key.
POST
/v1/catalog?cursor=a%2Fb
1792252800
fixture-utf8
<lowercase SHA-256 hex of the exact body bytes>The timestamp is fixed for repeatable tests. A live protocol needs its actual time and nonce rules. The query keeps %2F as encoded bytes; replacing it with / changes this fixture's signed path.
Apple's httpBody reference defines the request body as Data. Its HMAC reference describes authentication with a shared symmetric key. HMAC does not encrypt the body.
Compare equal JSON values with different bytes
The baseline body is UTF-8 {"query":"café","limit":2}. A second case reverses the key order. A third adds a trailing newline. All three bodies are valid JSON, but their digests differ. The verifier checks the bytes before checking the signature, so serialization errors are visible.
Do not parse and reserialize a captured body before comparing it with the app's output. First record the original bytes, then identify the encoder and the signing order. See the request-signing guide for the wider app-to-client comparison.
Observed acceptance and rejection results
| Test | Observed result |
|---|---|
| Three Swift vectors compared with TypeScript | All matched and received HTTP 200 |
| Repeat an accepted nonce | HTTP 409 |
| Change the body without updating its signature | HTTP 403 |
| Send an invalid signature | HTTP 403 |
| Send a correctly signed but expired timestamp | HTTP 401 |
These responses are the fixture's policy. A third-party API can use different errors. The replay set lasts for one test run, and the verifier compares timestamps with a fixed clock. Neither is a production security design.
Apply the method to an app integration
For a real app, trace the values entering the signing function, the exact bytes it signs and where its key comes from. Test a fresh session and a failed request. Software-generated HMAC is separate from device-backed assertions: this fixture does not implement App Attest or prove that a device requirement can be removed.
Use iOS API extraction for a working app client, or iOS reverse engineering when the task also needs binary and runtime analysis. The complete synthetic workflow demo covers login and refresh. For native Mac artifacts, follow the Mach-O inspection walkthrough.
Reviewed 17 October 2026 · SReverse