This specification defines a method for authenticating HTTP requests using Schnorr signatures, providing a decentralized and secure authentication mechanism. By leveraging Schnorr signatures, widely used in cryptocurrencies like Bitcoin and Litecoin, this method enables seamless integration with decentralized networks and services.
This is a draft document of the W3C Nostr Community Group and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.
This document was produced by a group operating under the W3C Community Contributor License Agreement (CLA).
The rise of decentralized applications and services necessitates secure and user-centric authentication mechanisms. Traditional centralized authentication methods often introduce single points of failure and privacy concerns. By utilizing Schnorr signatures for HTTP authentication, we can achieve a decentralized, secure, and privacy-preserving authentication protocol suitable for modern web applications.
Schnorr signatures are digital signature schemes known for their simplicity, efficiency, and provable security. They are extensively used in blockchain technologies such as Bitcoin and Litecoin. Their non-malleability and linearity properties make them ideal for complex cryptographic protocols.
This specification builds upon the concepts introduced in RFC 7235 (HTTP/1.1 Authentication) and extends the authentication framework to support Schnorr signatures. It also aligns with efforts in decentralized networks like Nostr and projects like Solid that explore signature-based authentication.
Enable users to authenticate across multiple services using a single cryptographic identity, eliminating the need for passwords and reducing friction in the user experience.
Facilitate authentication in decentralized applications where traditional centralized authentication methods are not viable, enhancing security and user control over personal data.
Leverage existing cryptographic keys from blockchain networks like Bitcoin, allowing users to authenticate with services using the same keys that control their digital assets.
The authentication protocol utilizes a signed JSON event included in the
HTTP
Authorization
header. The event contains necessary
information for the server to validate the request, including the
request URL, HTTP method, and a timestamp.
The event is a JSON object with the following fields:
id
: The hash of the serialized event.pubkey
: The public key of the client in hexadecimal
format.
content
: SHOULD be an empty string.kind
: An integer value of 27235
, referencing
RFC 7235.
created_at
: A UNIX timestamp indicating when the event
was created.
tags
: An array of tags providing additional information.
["u", "<absolute-URL>"]
: The absolute URL of
the request.
["method", "<HTTP-method>"]
: The HTTP method
used for the request.
["payload", "<sha256-hex>"]
(optional): SHA-256
hash of the request body for methods like POST, PUT, PATCH.
["webid", "<webid>"]
(optional): The WebID of the client, allowing the event to carry user identification via WebID.
sig
: The Schnorr signature of the serialized event.
Authorization
header with the scheme
Schnorr
.
401 Unauthorized
.
Servers MUST perform the following checks to validate the event:
kind
field MUST be
27235
.
created_at
timestamp MUST be within a reasonable time
window (e.g., ±60 seconds of the server's current time).
["u", "<absolute-URL>"]
tag MUST exactly match the
absolute request URL, including query parameters.
["method", "<HTTP-method>"]
tag MUST match the HTTP
method used for the request.
sig
field
MUST be a valid Schnorr signature of the serialized event, verifiable
using the pubkey
.
["payload", "<sha256-hex>"]
tag, the SHA-256 hash
of the request body MUST match the provided hash.
["webid", "<webid>"]
tag, the server MAY validate
the WebID according to its own authentication policies.
If any of these checks fail, the server SHOULD respond with
401 Unauthorized
.
Servers MAY perform additional implementation-specific validation checks, such as rate limiting or public key blacklisting.
Authorization
header.
Special thanks to the members of the W3C Nostr Community Group and the broader community for their valuable feedback and contributions.