Skip to content

CheekyGhost-Labs/webauthn-swift

 
 

Repository files navigation

webauthn-swift

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

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", from: "1.0.0-alpha")

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

About

A Swift library for implementing the WebAuthn spec

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Swift 96.6%
  • Shell 3.1%
  • Dockerfile 0.3%