Golang U2F Server Implementation

U2F Server Implementation

This repository implements a register and authenticate endpoint and provides frontend (JavaScript) code that demonstrates a simplified registration and authentication workflow.

The portion of U2F auth that is implemented here is reduced to the absolute minimum and does not include device attestation or any other advanced features.

Frontend

You can find a simple register and auth demo application at index.html that utilizes u2f-api-1.1.js to interface with U2F keys.

Backend

The following API endpoints are implemented:

  • /auth/register/begin Initiate registration of a new U2F key, retrieve requested key handle from server.
  • /auth/register/complete Complete the registration of a new U2F key by providing the backend with an ecdsa key that is signed with the device certificate for the requested key handle.
  • /auth/authenticate/begin Initiate user authentication via U2F, provide user credentials, retrieve challenge from server.
  • /auth/authenticate/complete Complete the authentication by submitting the ecdsa signed challenge back to the server.

Use u2f.NewU2FApi with a http.HTTPServer to integrate the authentication endpoints into your web application. The HTTP server must serve content via HTTPS for U2F to work.

You must also provide a database that stores key handles and public keys associated with key identifiers. See db_interface.go.

For a complete demo server application have a look at u2f-demo-server.

Cookies

The /auth/authenticate/begin API sets a cookie named U2FTID that stores the key identifier for the duration of the authentication process.

Further Resources

You may want to read at least FIDO-U2F-CHEAT-SHEET.pdf before using this code.

License

This code may be used under the BSD-3-Clause License

Owner
Similar Resources

RBTI Golang Server uses PostgreSQL and for its main database and uses Elasticsearch

RBTI Golang Server This server is used for my thesis project, it uses PostgreSQL and for its main database and uses Elasticsearch for faster query spe

Jan 17, 2022

A very simple Golang server handling basic GET and POST requests

GOLANG SERVER INTRO As a true Blockchain enthusiast, I had to learn Solidity and Golang to participate to several projects. This repository consists o

Nov 17, 2021

Backend for Workery application server implemented in Golang

workery-server Backend for Workery application server implemented in Golang. This is a rewrite of the workery-django project. Development Goals: Rewri

Dec 14, 2022

Simple HTTP server written in golang

Simple HTTP server written in golang Simple webserver in golang, to demonstrate basic functionalities like e.g. sending back some request header info,

Aug 31, 2022

A basic server built using golang.

A basic server built using golang.

Go Server A genral purpose server built using golang Go Server is a genral purpose server meant to be simple to use and begginner friendly. Currently

Dec 19, 2021

Go-simplehttp - Simple HTTP server written in golang

Simple HTTP server written in golang Simple webserver in golang, to demonstrate

Jan 1, 2022

Golang-redis-webserver - Web server using redis

Web Server using Redis Api REST Database SQLITE3 Cache Redis # Creating record s

Jun 19, 2022

:tophat: Small self-contained pure-Go web server with Lua, Markdown, HTTP/2, QUIC, Redis and PostgreSQL support

:tophat: Small self-contained pure-Go web server with Lua, Markdown, HTTP/2, QUIC, Redis and PostgreSQL support

Web server with built-in support for QUIC, HTTP/2, Lua, Markdown, Pongo2, HyperApp, Amber, Sass(SCSS), GCSS, JSX, BoltDB (built-in, stores the databas

Jan 1, 2023

Fast, multi-platform web server with automatic HTTPS

Fast, multi-platform web server with automatic HTTPS

a project Every site on HTTPS Caddy is an extensible server platform that uses TLS by default. Releases · Documentation · Get Help Menu Features Insta

Jan 1, 2023
a simple http server as replacement of python -m http.server

ser a simple http server as replacement of python -m http.server

Dec 5, 2022
OpenAPI specs for your Go server, generated at server runtime. No CLI, no code generation, and no HTTP

Overview "oas" is short for "OpenAPI Spec". Go package for generating OpenAPI docs at runtime. Non-features: No code generation. No CLI. No magic comm

Dec 3, 2021
A Language Server Protocol (LSP) server for Jsonnet

Jsonnet Language Server A Language Server Protocol (LSP) server for Jsonnet. Features Jump to definition self-support.mp4 dollar-support.mp4 Error/War

Dec 14, 2022
Go web server - A web server that can accept a GET request and serve a response.

go_web_server A web server that can accept a GET request and serve a response. Go is a great language for creating simple yet efficient web servers an

Jan 3, 2022
An XMPP server written in Go (Golang).

jackal An XMPP server written in Go. About jackal is a free, open-source, high performance XMPP server which aims to be known for its stability, simpl

Dec 29, 2022
High-performance PHP application server, load-balancer and process manager written in Golang
High-performance PHP application server, load-balancer and process manager written in Golang

[RR2-BETA] RoadRunner is an open-source (MIT licensed) high-performance PHP application server, load balancer, and process manager. It supports runnin

Jan 4, 2023
A push notification server written in Go (Golang).
A push notification server written in Go (Golang).

A push notification micro server using Gin framework written in Go (Golang)

Jan 9, 2023
Opinionated boilerplate Golang HTTP server with CORS, OPA, Prometheus, rate-limiter for API and static website.
Opinionated boilerplate Golang HTTP server with CORS, OPA, Prometheus, rate-limiter for API and static website.

Teal.Finance/Server Opinionated boilerplate HTTP server with CORS, OPA, Prometheus, rate-limiter… for API and static website. Origin This library was

Nov 3, 2022
Simple Golang Product API Server

Simple Golang Product API Server Layanan API untuk menambah, merubah informasi, mengambil data dan menghapus produk. Implementasi kode terinspirasi ol

Nov 20, 2022