Server Handshake Flow Specification
Overview
This document defines the handshake flow implementation specification for ATH protocol servers (applications).Server Responsibilities
- Manage its own DID identity and public/private key pairs
- Verify the legitimacy of client identities
- Confirm authorization requests with the user to ensure user authorization is genuine and valid
- Approve permission requests following the principle of least privilege
- Issue access tokens and maintain session state
- The
GET /ath/agents/{clientId}endpoint MUST require authentication (e.g.,agent_attestationorclient_secret). Agents MUST only be able to query their own registration status. Unauthenticated access to agent registration details enables enumeration attacks
Complete Handshake Flow (Server Perspective)
Step 1: Receive and Process Handshake Request
After receiving a client handshake request, the server:- Validates the correctness of the client request format
- Checks supported protocol versions and encryption algorithms
- Saves the client DID, public key, and nonce A
Step 2: Send Handshake Response
The server generates its own nonce B, signs nonce A using its private key, and sends the response message:Step 3: Verify Client Identity Proof
After receiving the client identity proof, the server:- Verifies the signature of nonce B using the client’s public key
- Validates client identity credentials (if provided)
- Records the identity verification result
Step 4: Send Identity Verification Result
The server returns the identity verification result to the client:Step 5: Receive Permission Request
After receiving a client permission request, the server:- Verifies the signature and validity of the user authorization credential
- Checks whether the requested permission scope is within the supported range
- Extracts the user ID and authorization information
Step 6: Confirm Authorization with User
The server must send an authorization confirmation request to the user:Step 7: Receive User Authorization Confirmation Result
After receiving the user confirmation result, the server:- Verifies the validity of the user’s signature
- Records the final permission scope authorized by the user
- If the user denies authorization, terminates the handshake flow
Step 8: Send Permission Approval Result
The server combines the user authorization result with its own security policies to make an approval decision:Step 9: Complete Handshake, Issue Token
The server and client complete key negotiation, and the server issues an access token:- Generates key exchange parameters and sends them to the client
- Generates a shared session key
- Signs the access token containing the authorization scope, validity period, and other information
- Records the session state; subsequent requests are verified using the token
Error Handling
| Error Code | Description | Handling |
|---|---|---|
| 401 | Client identity verification failed | Reject the handshake and return an error message |
| 403 | User denied authorization | Reject the permission request and return the denial reason |
| 429 | Too many requests | Rate-limit the client’s request frequency |
Security Requirements
- User authorization confirmation must be sent through an independent channel and must not be relayed through the client
- Access tokens must be signed with the server’s private key to prevent tampering
- Token validity period must not exceed 1 hour; tokens automatically expire after timeout