AppleWebAuthnProvider

class AppleWebAuthnProvider(rpId: String, rpName: String, timeout: Long = OZConstants.WEBAUTHN_TIMEOUT_MS) : WebAuthnProvider

Apple-native WebAuthn provider using AuthenticationServices framework.

This provider implements WebAuthn passkey operations for iOS 16+ and macOS 13+ using Apple's ASAuthorizationPlatformPublicKeyCredentialProvider. It provides biometric-secured credential creation and assertion for Stellar smart account operations.

The provider handles:

  • Passkey creation with platform authenticator (Touch ID / Face ID)

  • Passkey assertion for transaction signing

  • Automatic public key extraction from attestation data

  • Proper bridging of delegate callbacks to Kotlin coroutines

Usage:

val provider = AppleWebAuthnProvider(
rpId = "example.com",
rpName = "My Stellar Wallet"
)

val config = OZSmartAccountConfig.builder(...)
.webauthnProvider(provider)
.build()

Note on macOS: ASAuthorizationController requires a presentation context provider (ASAuthorizationControllerPresentationContextProviding) to specify the window in which to present the authorization sheet. On iOS this is handled automatically. On macOS, callers should set the presentationContextProvider on the controller via a platform-specific integration point (e.g., a SwiftUI bridge or AppKit delegate). A future API revision may accept an optional presentation context parameter.

Constructors

Link copied to clipboard
constructor(rpId: String, rpName: String, timeout: Long = OZConstants.WEBAUTHN_TIMEOUT_MS)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
var presentationContextProvider: ERROR CLASS: Symbol not found for ASAuthorizationControllerPresentationContextProvidingProtocol??

Optional presentation context provider for the authorization controller.

Functions

Link copied to clipboard
open suspend override fun authenticate(challenge: ByteArray, allowCredentials: List<AllowCredential>?): WebAuthnAuthenticationResult

Authenticates with an existing WebAuthn credential (passkey assertion) using Apple's AuthenticationServices framework.

Link copied to clipboard
open suspend override fun register(challenge: ByteArray, userId: ByteArray, userName: String): WebAuthnRegistrationResult

Registers a new WebAuthn credential (passkey creation) using Apple's AuthenticationServices framework.