Metadata-Version: 2.4
Name: hierarchical-uuid
Version: 1.0.0
Summary: Hierarchical UUID (UUIDv8-compatible, RFC 9562) with HMAC-derived prefixes for stateless local validation.
Author: Héctor Villa
License: MIT License
        
        Copyright (c) 2025 Héctor Villa
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/hektorv/hid
Project-URL: Specification, https://github.com/hektorv/hid/blob/main/huuid/spec/HUUID-spec-v1.0.md
Project-URL: Source, https://github.com/hektorv/hid
Project-URL: Issues, https://github.com/hektorv/hid/issues
Keywords: uuid,uuidv8,rfc-9562,identifier,hierarchical,hmac,cryptography,multi-tenant,stateless-validation
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Security :: Cryptography
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Internet :: WWW/HTTP
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# 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

```sh
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

```python
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](https://github.com/hektorv/hid/blob/main/huuid/examples/jwt_validation.py).

## 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:

- [HUUID v1.0 Specification](https://github.com/hektorv/hid/blob/main/huuid/spec/HUUID-spec-v1.0.md)

## Related

For the companion compact 64-bit variant, see
[HID64](https://pypi.org/project/hierarchical-id64/).

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

## License

MIT — see [LICENSE](https://github.com/hektorv/hid/blob/main/LICENSE).
