Skip to main content

Hierarchical UUID (UUIDv8-compatible, RFC 9562) with HMAC-derived prefixes for stateless local validation.

Project description

HUUID

Hierarchical UUID — a UUIDv8-compatible (RFC 9562) identifier that embeds an HMAC-SHA256-derived prefix in the UUID's node field, enabling cryptographic local validation of parent-child relationships while preserving full UUID compatibility.

Install

pip install hierarchical-uuid

Requires Python ≥ 3.8. No external dependencies. The module is imported as huuid; the distribution is named hierarchical-uuid on PyPI to keep the naming consistent with the companion package hierarchical-id64, and to avoid collision with an unrelated existing package of the same short name.

Quick start

from huuid import generate_huuid, validate_huuid

secret    = b"replace-with-tenant-scoped-secret"
parent_id = "account:42"

huuid = generate_huuid(parent_id, secret)   # returns a standard uuid.UUID
assert validate_huuid(parent_id, huuid, secret)
print(str(huuid))   # e.g. "861f6b20-e1cc-8942-b135-e412be9faa3e"

For an end-to-end example combining HUUID with a JWT-based session (stateless tenant validation at the edge, no database lookup), see the jwt_validation.py example.

Specification and security model

The full v1.0 specification — including threat model, key rotation guidance, secret-custody as the security perimeter, complementary (not substitutive) authoritative integrity checks, and the graceful-degradation property under secret compromise — is at:

Related

For the companion compact 64-bit variant, see HID64.

For the umbrella repository (specifications, threat-model note, IETF-style draft, both reference implementations), see github.com/hektorv/hid.

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hierarchical_uuid-1.0.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hierarchical_uuid-1.0.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file hierarchical_uuid-1.0.0.tar.gz.

File metadata

  • Download URL: hierarchical_uuid-1.0.0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for hierarchical_uuid-1.0.0.tar.gz
Algorithm Hash digest
SHA256 a76cd0a1dcbead3b5819d89be1b6a846d0b7e9d12279fefef84858e12fb1da45
MD5 0e040f7363fbf8ca88fc61798bc7c6c8
BLAKE2b-256 33b4427e6e4121232512363dc3ff5762add5cc7efcb0069979308920522f1130

See more details on using hashes here.

File details

Details for the file hierarchical_uuid-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for hierarchical_uuid-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4f5153639f2cceed60e8c37e1971d5ca64eaf2712903545c8763fb3099c63c5a
MD5 c2d3637cbdc9dbf5678039716ca88f14
BLAKE2b-256 517d88bd929080737221748ea926a4dc993f4e395859d2b94db9fc654504e8c2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page