Skip to main content

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_found instead 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", "recomputed_hash", "signatures", "quorum"}

How verification works (no trust required)

  1. sha256(canonicalize(norm["canonical"]["content"])) must equal norm["seal"]["contentHash"], where canonicalize = JSON with object keys sorted recursively, no whitespace, hashed as UTF-8.
  2. Each seal.signatures[].signatureHex is an Ed25519 signature by that signer's publicKeyHex over the UTF-8 bytes of the seal.contentHash hex string.

Errors

  • Nothing sealed for (id, date) → returns NotFound (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


Download files

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

Source Distribution

grundnorm-0.1.0.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

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

grundnorm-0.1.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file grundnorm-0.1.0.tar.gz.

File metadata

  • Download URL: grundnorm-0.1.0.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for grundnorm-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c4af02cb025cebc8deced08788ab4c0e666b33f6bf4eb5cc01c5e3ac68668461
MD5 ee38009c81726868e7fcd6f73d2e97e1
BLAKE2b-256 02bc1ce95c32a74decd980a44199b3ff827ab4f8805c5f6bd1e3912cdbe3cf9b

See more details on using hashes here.

File details

Details for the file grundnorm-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: grundnorm-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for grundnorm-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2a90ff702da0615aaa62e98623caf6e9bf94485cebfea652f0e7b9f7496fc503
MD5 ad012ba5a4ced9d974979eb15d2cab6f
BLAKE2b-256 7d9f25025fc662a5c459f1ea80602fd60917fb2ea98792192864557d3f977b4c

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