webauthn-swift

0.0.3

A Swift library for implementing the WebAuthn spec
brokenhandsio/swift-webauthn

What's New

WebAuthnSwift 0.0.3

2023-07-06T21:15:38Z

Documentation wasn't up-to-date in 0.0.2. This release fixes that.

webauthn-swift

This package provides a Swift implementation of the WebAuthn API focused on making it easy to leverage the power of WebAuthn.

🚨 This library is a proof of concept - do not use it in production yet!

Getting Started

Adding the dependency

Add the following entry in your Package.swift to start using WebAuthn:

.package(url: "https://github.com/swift-server/webauthn-swift.git", branch: "main")

and WebAuthn dependency to your target:

.target(name: "MyApp", dependencies: [.product(name: "WebAuthn", package: "webauthn-swift")])

Setup

Configure your Relying Party with a WebAuthnManager instance:

let webAuthnManager = WebAuthnManager(
    config: WebAuthnConfig(
        relyingPartyDisplayName: "My Fancy Web App",
        relyingPartyID: "example.com",
        relyingPartyOrigin: "https://example.com",
        timeout: 600
    )
)

Registration

For a registration ceremony use the following two methods:

  • WebAuthnManager.beginRegistration()
  • WebAuthnManager.finishRegistration()

Authentication

For an authentication ceremony use the following two methods:

  • WebAuthnManager.beginAuthentication()
  • WebAuthnManager.finishAuthentication()

Credits

Swift WebAuthn is heavily inspired by existing WebAuthn libraries like py_webauthn and go-webauthn.

Links

Description

  • Swift Tools 5.6.0
View More Packages from this Author

Dependencies

Last updated: Mon Oct 27 2025 20:47:36 GMT-0900 (Hawaii-Aleutian Daylight Time)