Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authentication using Handshake name #6

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions HIP-0003.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# HIP-0003 : Authentication using Handshake name

```
Number: HIP-0003
Title: Authentication using Handshake name
Type: Informational
Status: Draft
Authors: Fernando Falci <https://iamfernando/>
Created: 2020-10-25
```

## Abstract

This HIP describe how to authenticate a user using his/her Handshake name.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This HIP describes how to authenticate a user using their Handshake name.


## Motivation

Many websites need to identify the user and proof he/she owns a Handshake name. Many other websites simply need to identify users, which forces them to go into a process to pick a unique username that most of the time can't be consistent across different apps. By using Handshake names as username it allows both: proof ownership of the name and consistent username across unrelated apps.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many websites need to identify the user and prove they own a Handshake name. Other websites simply need to identify users, which forces the user to enter a process of picking a unique username that most of the time can't be consistent across different apps. Using Handshake names as usernames allows both to happen: prove ownership of a name and have a consistent username across unrelated apps.


## Protocol

The basics of this protocol consist of a public and private ECDSA key. The domain exposes the public key via HTTPS request.
The Service that wants to authenticate the user should provide this user with a unique challenge.
The User signs the challenge using his/her private key and returns it to the Service, among the public key and the domain name.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The User signs the challenge using their private key and returns it to the Service, along with the public key and domain name.

The Service then validates if the challenge is correct and was correct signed. The Service also validates if the domain name indeed exposes that public key.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Service then confirms the challenge is correctly signed. The Service also validates if the domain name indeed exposes the public key.


### Provider

The above-mentioned flow requires an extra piece of software: a user-trusted provider. This provider knows/holds the user's private key. It can run on the client-side, as a browser extension or an installed app; or it can run remotely as a regular web service.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The above-mentioned flow requires an extra piece of software: a user-trusted provider. This provider knows/holds the user's private key. It can run client-side, as a browser extension, as an installed app, or run remotely as a regular web service.

This provider will respond to the request with the signed challenge sent by the Service.

To be a provider, the Provider needs to register and respond for the [custom protocol](https://html.spec.whatwg.org/#web+-scheme-prefix) `web+hns`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be a provider, the Provider needs to register and have a response for the custom protocol web+hns.


This protocol will be used by the Service to send authentication challenges.

Assuming that the community will provide different solutions and implementation options, the User will choose one Provider and register it to respond to the custom protocol.

It is outside the context of this HIP to define how the Provider interacts with the User or how the public/private keys should be generated.

This also means that, once the User chooses a Provider and is onboarded, the User won't be able to switch to another provider without replacing its public key. In other words: the User cannot authenticate itself with any Provider, but only with the Provider he/she used to generate the public key.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also means that once the User chooses a Provider and is onboarded, the User won't be able to switch to another provider without replacing their public key. In other words: the User cannot authenticate with any Provider; only the Provider they used to generate the public key.


### Exposing the public key

The public key should be exposed via HTTPS request to `.well-known/authentication`. For the domain `example` the full URL should be `https://example/.well-known/authentication`.

This url should use a SSL certificate validate with [DANE](https://tools.ietf.org/html/rfc6698) or by a Certificate authority.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This url should use a SSL certificate validated with DANE or by a Certificate Authority.


### Authentication request

Any Service can create an authentication request. It's a basic `GET` request to `web+hns://authentication/?challenge=<CHALLENGE>&callback=<CALLBACK>`.

| Key | Type | Options |
| -------------- | -------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| web+hns:// | protocol | Fixed. |
| authentication | Reserved URL keyword | Fixed. |
| challenge | querystring | A 32-characters long string. Hex. |
| callback | querystring | An encoded callback URL. It will be (async) called by the provider with the challenge response. It must be a secure URL (HTTPS). |

### Authentication response

It's a Provider's decision on how to identify and authenticate the user with the Provider.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a Provider's decision on how to identify and authenticate the User.


Once the provider identifies the User, it can sign the challenge using the User's private key and call the Service using the provided callback URL in a `GET` request.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once the Provider identifies the User, it can sign the challenge using the User's private key and call the Service using the provided callback URL in a GET request.


The following query string should be added to the callback URL:

| Key | Options |
| --------- | ------------------------------------------- |
| domain | The domain name that will identify the user |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

| domain | The domain name that will identify the User |

| challenge | The same challenge sent by the Service |
| signature | The signed challenge |

### Handling a response

When the Service is called via its callback URL, it should do the following verifications:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the Service is called via its callback URL, it should perform the following steps:


- Check if the domain exposes a public key.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Verify the domain exposes a public key.

- Check if the challenge is the same challenge from the request.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Verify the challenge is identical from the request.

- Verify if the signature is valid (using the already retrieved public key).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Verify the signature is valid (using the already retrieved public key).


The Service should reject the authentication request if any of the above fails.

Note: there's no point in adding the public key in the response from the Provider to the Service since it won't be trusted.

Once all verifications are complete, the Service can use the `domain` to identify the current user.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once all verifications are complete, the Service can use the domain to identify the current User.


## Consideration

This proposal does not force the domain name to be a TLD. Users could authenticate themselves with `support.example` for instance.

There's no need to be strict with a Handshake domain name. Users could authenticate themselves with `example.com` for instance.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionally, there's no need to be strict with a Handshake domain name. Users could authenticate themselves with example.com.

## Reference

[DANE](https://tools.ietf.org/html/rfc6698)