Skip to content

Commit

Permalink
Clarify that server may ignore client initiated handshake and start s…
Browse files Browse the repository at this point in the history
…erver initiated one
  • Loading branch information
MarcoPolo committed Sep 10, 2024
1 parent ad8cd05 commit b51a4cc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions http/peer-id-auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,10 @@ protocol operates as follows:

The client initiated version of this handshake follows the same structure,
except that the client sends initially sends a `challenge-server` and the order
of who is authenticated first is reversed. The protocol is as follows
of who is authenticated first is reversed. The server MAY ignore the initial
request, and respond by starting the Server initiated handshake.

The client initiated handshake is as follows

1. The client makes an HTTP request to a known authenticated resource and sets
the header:
Expand All @@ -198,7 +201,7 @@ of who is authenticated first is reversed. The protocol is as follows

2. The server responds with status code 401 (Unauthorized) and set the header:
```
WWW-Authenticate: libp2p-PeerID challenge-client="<challenge-string>", opaque="<opaque-value>", public-key="<base64-encoded-public-key-bytes>", sig="<base64-signature-bytes>"
WWW-Authenticate: libp2p-PeerID challenge-client="<challenge-string>", public-key="<base64-encoded-public-key-bytes>", sig="<base64-signature-bytes>", opaque="<opaque-value>"
```

The `sig` param represents a signature over the parameters:
Expand Down

0 comments on commit b51a4cc

Please sign in to comment.