From 675bde3e72e2e08e2fb79e31264d56539aaf3521 Mon Sep 17 00:00:00 2001 From: Alex Potsides Date: Fri, 6 Jun 2025 21:19:14 +0100 Subject: [PATCH] docs: adds an expires field to the bearer token response (#676) * docs: adds an expires field to the bearer token response Where a bearer token is returned to the client for future use, optionally include an `expires` field which indicates the latest time that it will be treated as valid. The server is free to expire tokens at any time so this field is purely advisory. Fixes #674 * chore: switch to RFC3339 --- http/peer-id-auth.md | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/http/peer-id-auth.md b/http/peer-id-auth.md index 5196a31..d4f2c10 100644 --- a/http/peer-id-auth.md +++ b/http/peer-id-auth.md @@ -2,7 +2,7 @@ | Lifecycle Stage | Maturity | Status | Latest Revision | | --------------- | ------------- | ------ | --------------- | -| 1A | Working Draft | Active | r0, 2023-01-23 | +| 1A | Working Draft | Active | r1, 2025-05-28 | Authors: [@MarcoPolo] @@ -172,6 +172,17 @@ protocol operates as follows: Authentication-Info: libp2p-PeerID sig="" bearer="" ``` + The server MAY include an `expires` field which contains the expiry time of + the bearer token in [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339) + format: + + ``` + Authentication-Info: libp2p-PeerID sig="" bearer="" expires="" + ``` + + Note that the `expires` field is only advisory, the server may expire the + token at any time. + The `sig` param represents a signature over the parameters: - `challenge-server` @@ -255,6 +266,17 @@ The client initiated handshake is as follows - The `hostname` parameter. - The token creation date (to allow tokens to expire). + The server MAY include an `expires` field which contains the expiry time of + the bearer token in [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339) + format: + + ``` + Authentication-Info: libp2p-PeerID bearer="" expires="" + ``` + + Note that the `expires` field is only advisory, the server may expire the + token at any time. + 5. The client SHOULD send the `bearer` token for future Peer ID authenticated requests.