Vouch
Quickstart

iOS

Add Vouch to a Swift app with Swift Package Manager.

Package not yet published

The Swift package lives in the repository under sdks/ios and can be added as a local or Git dependency today. A tagged release on the Swift Package Index follows.

Install

Add the package in Xcode (File → Add Package Dependencies) or in Package.swift:

.package(url: "https://github.com/vouch-dev/vouch", from: "0.1.0")

and depend on the Vouch product from the sdks/ios package.

Configure Associated Domains

Add the applinks: entry for your Vouch domain to the Associated Domains capability. Vouch hosts /.well-known/apple-app-site-association for that domain and checks it hourly.

applinks:yourapp.vouch.dev

Your publishable key and app id are in the dashboard under Settings → API keys and Apps.

import Vouch

@main
struct App: SwiftUI.App {
    init() {
        // Non-blocking; returns in under 50 ms of main-thread time.
        Vouch.configure(publishableKey: "pk_test_…", appId: "app_…", environment: .test)
    }

    var body: some Scene {
        WindowGroup {
            RootView()
                .onOpenURL { url in Vouch.handle(url: url) }   // Universal Links
                .task {
                    Vouch.onLink { link in
                        // Fires exactly once per link, cold or warm start.
                        router.navigate(to: link.destination, params: link.params)
                    }
                    Vouch.setReady()   // your router exists; held links are delivered now
                }
        }
    }
}

With an AppDelegate, forward application(_:continue:restorationHandler:) activities of type NSUserActivityTypeBrowsingWeb to Vouch.handle(url:).

On first open after an install the SDK reports the install with a coarse fingerprint. A matched link is held until setReady() (or the 5 second readyTimeout) and arrives through onLink with isDeferred == true. link.matchType tells you how it matched: installReferrer, clipboard and session are deterministic, probabilistic is a single unambiguous fingerprint. Ambiguous fingerprints deliver nothing.

To personalise onboarding before navigating, peek without consuming:

if let pending = await Vouch.pendingLink() {
    onboarding.preselect(pending.params["ref"])
}

Clipboard matching, opt in

iOS has no Install Referrer. Vouch can copy a signed token to the clipboard from a landing page the user taps, and the SDK reads it back on first open. This shows the system paste notice, so it is off by default and must be enabled in the dashboard (Links → Settings) and in the SDK with VouchOptions(clipboardMatching: true). When off, the SDK never reads the pasteboard.

Referrals and device security

Planned API, not yet shipped

The calls below are the agreed shape of the SDK additions for Referrals and device security. They are not in a released SDK yet. The server endpoints they call are live, so you can drive both modules over HTTP today using the routes in those sections.

// A personal invite link and code for the signed-in user.
let invite = try await Vouch.referrals.link()
share(invite.url, code: invite.code)

// Someone typing a code instead of following a link.
try await Vouch.referrals.redeem(code: "W3ZYEPD8")

// Attestation runs automatically; this is the manual trigger.
let verdict = try await Vouch.security.attest()

Verify

Run the app on a physical device, then follow the dashboard's verification step. It fetches your association file the way Apple's CDN does, checks the entitlement in your build, and waits for a real deferred install from a test link.

On this page