Skip to main content
The 0xkey Swift SDK is a Swift Package for embedded wallets on iOS and macOS. Current version: 0.1.0.
  • iOS 17+ / macOS 14+, Xcode 16+ (Swift 6 language mode)
  • No third-party dependencies
  • Same wire format, stamps and HPKE parameters as the JS and Kotlin SDKs, so they can be used side by side on one organization
Most apps only need the ZeroXKey product.

Install

The package is public; no GitHub credentials are needed. Xcode: File → Add Package Dependencies…, enter https://github.com/0xkey-io/sdk-swift.git, and choose Up to Next Minor Version from 0.1.0. Package.swift:
While the major version is 0, a minor release may contain breaking changes, so pin with .upToNextMinor(from:). Patch releases are compatible.

App setup

  • Passkeys: add the Associated Domains entitlement webcredentials:<rpId> and serve https://<rpId>/.well-known/apple-app-site-association listing <TeamID>.<bundle ID> under webcredentials.apps. Your RP ID must also be enabled for your organization; if passkey calls fail with ZeroXKeyRequestError.reason == .webAuthnRpIdNotAllowed, contact 0xkey.
  • Email / SMS OTP, OAuth and passkey sign-up go through the Auth Proxy: create an Auth Proxy configuration in the Dashboard and pass its ID as authProxyConfigId.

Configure

apiUrl and authProxyUrl default to the 0xkey production hosts and must be https.

Sign in

OTP login fallback. The SDK first tries an attested login. Only if the server reports that attested login is unavailable, and authProxyConfigId is set, it falls back to the Auth Proxy otp_login_v2 route; the session lifetime is then the Auth Proxy configuration’s. It never falls back on HTTP 403 (which can mean MFA is required), on an error without an HTTP status, or on an ATTESTED_* reason; the original error is thrown. Scoped logins never fall back.

Wallets and signing

Prefer signTransaction over signRawPayload for transactions: transaction-field policies (eth.tx.*, solana.tx.*) apply to transaction-signing activities. See Policy language. To require a passkey for each signature, stamp the request with a PasskeyStamper:

Policies

ZeroXKeyClient exposes the policy endpoints, including deletion:
A missing policy ID returns HTTP 404. See Policy overview.

Errors

An activity that is not COMPLETED is always thrown, never returned as success. Branch on code / httpStatus, not on message text; see Errors.

More