- 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…, enterhttps://github.com/0xkey-io/sdk-swift.git, and choose Up to Next Minor Version from 0.1.0.
Package.swift:
.upToNextMinor(from:). Patch releases are compatible.
App setup
- Passkeys: add the Associated Domains entitlement
webcredentials:<rpId>and servehttps://<rpId>/.well-known/apple-app-site-associationlisting<TeamID>.<bundle ID>underwebcredentials.apps. Your RP ID must also be enabled for your organization; if passkey calls fail withZeroXKeyRequestError.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
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:
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
- README, DocC articles and the example app: github.com/0xkey-io/sdk-swift
- CHANGELOG