Official SDK for the Grundnorm grounded source-of-law truth layer — resolve a legal norm by open identifier (ELI/ECLI) + date and verify its cryptographic seal locally.
Project description
grundnorm (Python SDK)
Resolve a legal norm by its open identifier (ELI/ECLI) and a date, and get back its canonical, sealed meaning as an independently verifiable signed object. The SDK recomputes the content hash and verifies every Ed25519 signature locally — you never have to trust the server.
- Deterministic, zero-LLM read path. Honest
not_foundinstead of a guess. - Point-in-time:
[validFrom, validUntil). - Python 3.9+. One dependency:
cryptography.
Install
pip install grundnorm
Use
from grundnorm import GrundnormClient
# Defaults to the public GDPR demonstrator. For a pilot:
# GrundnormClient(endpoint="https://.../api/grundnorm/resolve", api_key="nlk_...")
client = GrundnormClient()
r = client.resolve(
id="http://data.europa.eu/eli/reg/2016/679/art_5",
jurisdiction="EU",
at="2026-07-07", # omit for "today"
)
if r.status == "found":
print(r.norm["atoms"]) # subject / modality / action / condition / exception / scope + evidence
print(r.verification["ok"]) # True only if hash recomputes AND all signatures verify
resolve() verifies the seal by default. Skip with verify=False, or verify a stored envelope later:
from grundnorm import verify
v = verify(norm) # {"ok", "hash_ok", "view_consistent", "recomputed_hash", "signatures", "quorum"}
v["ok"] is the one signal to trust — True only when all four checks below hold; inspect the
component fields for anything less.
How verification works (no trust required)
- Hash:
sha256(canonicalize(norm["canonical"]["content"]))equalsnorm["seal"]["contentHash"], wherecanonicalize= JSON with keys sorted recursively (UTF-16 order), no whitespace, UTF-8. - View integrity: the ergonomic English
atoms/purposeare exactly what the sealedcanonical.contentprojects to (view_consistent);canonical.contentis the source of truth. - Signatures: each
seal.signatures[].signatureHexis a valid Ed25519 signature by that signer'spublicKeyHexover the UTF-8 bytes of theseal.contentHashhex string. - Quorum: at least 2 valid signatures including at least one sovereign (
quorum["meets"]).
Errors
- Nothing sealed for
(id, date)→ returnsNotFound(a normal outcome). - Bad key, bad input, or server error → raises
GrundnormError(.status,.code).
Demonstrator note: the demo corpus (GDPR sample) is signed by demo keys, not institutions, and its accuracy is not yet jurist-graded. See the project's
DEMO-TRUTHFULNESS.md.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file grundnorm-0.1.1.tar.gz.
File metadata
- Download URL: grundnorm-0.1.1.tar.gz
- Upload date:
- Size: 10.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff65db5254d92b17385e9745327844000e9cfc788656048fe4feead954f80f2e
|
|
| MD5 |
42b5c5c4fc52189a170f2a0bd8a1e2f9
|
|
| BLAKE2b-256 |
3ca62093205e46421dfc03c94f66fba1718666b55d109d3ea98c4dbd3fb54356
|
File details
Details for the file grundnorm-0.1.1-py3-none-any.whl.
File metadata
- Download URL: grundnorm-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8341c7e3a21632af3a1e3b43ce2fc7cd30ad74b8c3a614d9621afe5e325ba9f4
|
|
| MD5 |
9df1cdec2bd654a5e787084333b8aead
|
|
| BLAKE2b-256 |
db8331133348ed820cb135fc72165309c13e7b9cf99ad34fdbb329b48f1bd53e
|