spec

HPURL: Hash Parameter URLs Specification

Version 0.1 — July 29, 2025

Abstract

This document specifies a convention for encoding URL query parameters within the fragment identifier (hash) portion of a URL. These are referred to as “Hash Parameter URLs” (HPURLs). This format is designed for scenarios where parameters must not be sent to the server and instead remain client-side, while preserving familiar URL query semantics.

1. Introduction

Traditional URLs place query parameters in the “search” portion (following the ?), which is always sent to the server during HTTP requests. In client-heavy applications, such as Single Page Applications (SPAs), there is often a need to encode query-like parameters that are retained entirely client-side.

HPURL (Hash Parameter URL) introduces a simple convention for encoding parameters in the fragment portion of the URL using a query string-like format, such as #?a=b.

This document defines the structure, behavior, and parsing rules for HPURLs.

2. Terminology

3. Syntax

An HPURL follows the standard URL syntax with the following rule applied to the fragment component:

fragment := [prefix]?key1=value1[&key2=value2...]

Valid examples:

In all cases above, the HPURL parameters are:

{
  "a": "b"
}

Notes:

4. Parsing Rules

HPURL parsers MUST:

HPURL parsers SHOULD ignore the portion of the fragment before the ?, unless application logic requires otherwise.

HPURL parsers MUST NOT strip or truncate the query string after encountering other characters like /, =, or #. The full query string (after the first ?) must be interpreted as-is.

Example

URL: https://example.com/page#prefix?x=1&y=2/extra
Fragment: prefix?x=1&y=2/extra
HPURL query string: ?x=1&y=2/extra
Parsed result:
  {
    "x": "1",
    "y": "2/extra"
  }

5. Use Cases

6. Compatibility

HPURLs are fully backwards-compatible with standard URLs. Since the fragment is never sent to the server in HTTP requests, use of HPURLs does not interfere with traditional web infrastructure.

Existing routing or anchor mechanisms using fragments can coexist with HPURLs if the application defines a convention for distinguishing them.

7. Security Considerations

8. IANA Considerations

This document has no actions for IANA.

9. References

X. Extensions

X.1 Reserved Parameters Extension

The reserved parameters used by HPURL parsers are:

Parsers typically use these values in the following sequence:

  1. Read the signature from $.
  2. Read the public key from @.
  3. Read the scope from ! to determine which parts of the URL the signature covers.

However, HPURL does not require these parameters to appear in this order within the URL hash fragment. Parsers MUST recognize and process the parameters regardless of their order in the fragment.

This approach allows flexibility in URL construction while maintaining a clear, consistent parsing and verification model.

X.2 Signature Extension

The $ parameter carries an Ed25519 signature covering the HPURL parameters, enabling verification of parameter integrity and authenticity.

Signature Computation

Signature Verification

X.3 Signature Features

The ! parameter encodes a bitmask representing enabled HPURL signature scope and features.

Signature Scope Bits

These bits specify the signature scope and features:

Bit Position Description
0 Parameter sorting control:
- 1 = parameters are lexicographically sorted by key
- 0 = parameters keep their original order in the URL
1 Protocol (scheme) is included in signature.
2 Hostname (domain) is included in signature.
3 Port is included in signature.
4 Path is included in signature.
5 Search parameters (query) are included.
6 Fragment parts before the HPURL parameters are included.
7 Reserved for future use

Signature Scope Semantics

Canonicalization for Signature Computation

Based on the feature flags bitmask, the canonical string to sign is constructed by concatenating the selected URL components in this order:

[protocol] + '://' + [hostname] + ':' + [port] + [path] + '?' + [search params] + '#' + [fragment excluding the `$` signature parameter]