Protocol Specification
Last updated
Last updated
The following parties are involved in the authentication process:
Server: The service relying party that provides services to the user.
Client: A website or app with which the user sends authentication request to the server.
Decentralized Identity Management Wallet ("Wallet"): A tool for the user to manage their decentralized identities and verifiable credentials.
ONT Login requires end users to have an ONT ID. Please refer to this doc on how to generate ONT IDs for your users.
The whole process can be divided in the following 5 steps. We will go through each step in detail in later sections.
Authentication Request: The user starts the login process. The client sends the authentication request to the server.
Authentication Challenge: Received the request, the server generates and sends a challenge to the client, which can specify the required VC if needed.
Signature (and Authorization): The client receives the challenge, then requests signature and VP from the wallet with the challenge.
Authentication Response: The client receives the signature and VP from the wallet, and send the response message to the server.
Verification: The server verifies if the response is correct. If yes, the server parses the VP to obtain the information authorized by the user.
The client sends the authentication request to the server as the example below:
Property | Type | Description |
|
| Protocol version, current version is 1.0. |
|
| Message type, the type of an authentication request is |
|
| "0" = authentication; "1" = authentication and authorization. You can define other actions based on the business logic. |
|
| Optional, challenge sent from the the client, required for mutual authentication. |
Upon receiving the request from the client, the server generates and a nonce and stores it.
The server returns the following message to the client:
Property | Type | Description |
|
| Protocol version, current version is 1.0. |
|
| Message type, the type of an authentication challenge is |
|
| A one-time random number or 128-digit UUID generated by the server used as a challenge. It's necessary to ensure it's randomly and recently generated. |
| A message from the server including strings: - name: string, name of the server, required. - icon: string, image URL of the server's icon or the serialized icon, optional. - - - | |
|
| Types of VC required from the server, including at least 3 fields below: - - - The |
|
| Denoting chains supported by the server with native token symbols, e.g. “ONT” represents Ontology chain. |
|
| Signature schemes supported by the server. |
|
| Optional, server's response to the challenge sent from the client for mutual authentication. |
When the client receives the authentication challenge , a message is generated accordingly for the wallet to sign. The wallet signs the message containing the challenge, and generates the VP for VC required by the server.
An example of message to be signed:
Property | Type | Description |
|
| Message type, the type of a message to be signed is |
|
| Server details including 3 strings: - - - |
|
| The nonce included in the challenge. |
|
| User DID. |
|
| UNIX timestamp in seconds of signature creation time. |
After the signature and VP are received, the client sends the response to the challenge to the server.
Property | Type | Description |
|
| Protocol version, current version is 1.0. |
|
| Message type, the type of the challenge response is |
|
| Nonce included in the challenge. |
|
| User DID. |
| Signed challenge including the following 4 fields: - - - - | |
|
| Encoded VC. |
The server verifies data contained in the challenge response:
Verify the validity of parameters
Verify if the nonce is the same as the one generated by the server
verify the signature
Verify the validity of VP and VC
Check if the provided VC meets the requirement