AppleWebAuthnProvider

@available(iOS 16.0, macOS 13.0, *)
public final class AppleWebAuthnProvider : NSObject, WebAuthnProvider, @unchecked Sendable

Apple-platform WebAuthnProvider backed by ASAuthorizationPlatformPublicKeyCredentialProvider.

Provides passkey registration (secp256r1 key creation via Touch ID / Face ID) and assertion (passkey signing) for iOS 16+ and macOS 13+. Returns WebAuthnRegistrationResult and WebAuthnAuthenticationResult respectively.

On macOS set presentationContextProvider before calling register or authenticate; the system requires a host window reference. iOS handles presentation automatically.

The host application must declare an Associated Domains entitlement (webcredentials:<rpId>) and publish a matching AASA file. See docs/smart-accounts/webauthn-ios.md for setup details.

Example:

let provider = try AppleWebAuthnProvider(
    rpId: "wallet.example.com",
    rpName: "Example Smart Wallet"
)
let registration = try await provider.register(
    challenge: challenge32Bytes,
    userId: userIdBytes,
    userName: "user@example.com"
)