WebAuthnAllowCredential
public struct WebAuthnAllowCredential : Equatable, Hashable, Sendable
A credential descriptor pairing a credential ID with optional transport hints.
Used in WebAuthnProvider.authenticate to constrain which passkeys the authenticator
offers and to indicate how the client can reach the authenticator (e.g., internal,
hybrid, usb, ble, nfc). Including transport hints enables cross-device
authentication flows such as QR-code scanning.
When transports is nil, the authenticator uses its default transport selection.
Unknown transport strings are passed through without validation — the OS
ignores values it does not recognize.
Equality compares the id byte content (not reference identity) so two descriptors built
from independently allocated Data values with the same bytes compare equal.
Example:
let cred = WebAuthnAllowCredential(id: credentialIdData, transports: ["internal", "hybrid"])
let result = try await provider.authenticate(challenge: challenge, allowCredentials: [cred])
-
The raw credential ID bytes.
Declaration
Swift
public let id: Data -
Optional list of transport hints (e.g.,
internal,hybrid,usb,ble,nfc).Declaration
Swift
public let transports: [String]? -
Creates a
WebAuthnAllowCredentialwith the given credential ID and optional transports.Declaration
Swift
public init(id: Data, transports: [String]? = nil)Parameters
idRaw credential ID bytes.
transportsOptional list of WebAuthn transport hints.
nillets the authenticator select a transport. -
Undocumented
Declaration
Swift
public static func fromId(_ id: Data) -> WebAuthnAllowCredential -
Undocumented
Declaration
Swift
public static func fromIds(_ ids: [Data]) -> [WebAuthnAllowCredential]
View on GitHub
Install in Dash