WebAuthn (FIDO2) server library written in Go
Projects using this library should consider migrating to the community-maintained fork over at github.com/go-webauthn/webauthn. See the Migration Guide for more information.
The original README continues below.
=============
This library is meant to handle Web Authentication for Go apps that wish to implement a passwordless solution for users. While the specification is currently in Candidate Recommendation, this library conforms as much as possible to the guidelines and implementation procedures outlined by the document.
An implementation of this library can be used at webauthn.io and the code for this website can be found in the Duo Labs repository webauthn-io.
A simplified demonstration of this library can be found here. It includes a minimal interface and is great for quickly testing out the code. The associated blog post can be found here.
go get github.com/duo-labs/webauthn and initialize it in your application with basic configuration values.
Make sure your user model is able to handle the interface functions laid out in webauthn/user.go. This means also supporting the storage and retrieval of the credential and authenticator structs in webauthn/credential.go and webauthn/authenticator.go, respectively.
import "github.com/duo-labs/webauthn/webauthn"
var (
web *webauthn.WebAuthn
err error
)
// Your initialization function
func main() {
web, err = webauthn.New(&webauthn.Config{
RPDisplayName: "Duo Labs", // Display Name for your site
RPID: "duo.com", // Generally the FQDN for your site
RPOrigin: "https://login.duo.com", // The origin URL for WebAuthn requests
RPIcon: "https://duo.com/logo.png", // Optional icon URL for your site
})
if err != nil {
fmt.Println(err)
}
}
……You can modify the default credential creation options for registration and login by providing optional structs to the BeginRegistration and BeginLogin functions.
You can modify the registration options in the following ways:
…You can modify the login options to allow only certain credentials:
…I could not have made this library without the work of Jordan Wright and the designs done for our demo site by Emily Rosen. When I began refactoring this library in December 2018, Koen Vlaswinkel's Golang WebAuthn library really helped set me in the right direction. A huge thanks to Alex Seigler for his continuing work on this WebAuthn library and many others. Thanks to everyone who submitted issues and pull requests to help make this library what it is today!
No open issues yet, or sync has not completed.