hbolimovsky / webauthn-example

Basic WebAuthn client and server in go
96 stars 43 forks source link
fido2 go javascript webauthn

WebAuthn Basic Client/Server Example (go)

This library implements a simple, basic WebAuthn client and server based on duo's WebAuthn implementation. The code pulls inspiration from duo's WebAuthn example implementation. This example is NOT meant to be used in production, but rather as an introduction to WebAuthn as well as a more quick-and-dirty, stripped down version of webauthn.io.

Blog Post

You can check it out here

Quickstart

Download

Download the project (i.e. via git clone or go get) and navigate to the project's root directory.

Start

Start the server by compiling and running the code. It should look something like this:

$ go run .
2019/04/01 11:45:09 starting server at :8080

Test

Spin Up

Fire up a web browser and go to localhost:8080. You should see something like this:

webpage_example.png

Note: as of this writing, not all web browsers support WebAuthn - you'll receive a warning if the browser you're using doesn't.

Register

To test that the demo is working properly, enter an email like foo@bar.com and press the Register button. You should be prompted to gesture (i.e. tap, scan finger) to some authenticator. It should look something like this:

auth_example.png

Upon successful registration, you'll see an alert saying you successfully registered, similar to this:

success_register.png

Login

Press the login button and follow the instructions. The login process is identical (user side) to the registration process.

Extra

WebAuthn BLE Support In Chrome

In your Chrome broswer go to chrome://flags/ and search for 'web auth', then set 'Web Authentication API BLE support' and 'Web Authentication caBLE support' to enabled

chrome_ble_flags.png