Skip to main content

Typed content-addressing — deterministic, verifiable sha256:<64hex> κ-labels from JSON / S-expressions / XML / ASN.1 DER / schema.org / in-toto. Wraps the uor-addr-c native library via ctypes.

Project description

uor-addr (Python)

Python bindings for uor-addr — typed content-addressing producing deterministic sha256:<64hex> κ-labels from JSON, S-expressions, XML, ASN.1 DER, schema.org, in-toto, and more.

Wraps the uor-addr-c C ABI dynamic library via ctypes (stdlib — no external dependencies). The produced κ-label is byte-for-byte identical to the Rust crate's output.

Install

pip install uor-addr

Requires Python 3.10+. Wheels ship per-platform; sdist falls back to building from the workspace.

Quickstart

from uor_addr import kappa

label = kappa.json_address(b'{"foo":"bar"}')
print(label)
# sha256:7a38bf81f383f69433ad6e900d35b3e2385593f76a7b7ab5d4355b8ba41ee24b

API

Nine *_address methods on the kappa singleton, one per realization. Each takes bytes-like and returns the 71-byte ASCII sha256:<64-lowercase-hex> κ-label as str. Failures raise uor_addr.AddressError carrying one of three kind tags ('invalid-input' / 'too-large' / 'pipeline-failure').

Method Realization Imported spec
kappa.json_address JSON RFC 8259 + RFC 8785 JCS + UAX #15 NFC
kappa.sexp_address S-expressions Rivest 1997 canonical form
kappa.xml_address XML W3C XML-C14N 1.1 (subset)
kappa.asn1_address ASN.1 ITU-T X.690 DER
kappa.ring_address Ring elements UOR-Framework Amendment 43 §2
kappa.codemodule_address Code-module AST CCMAS
kappa.schema_photo_address schema.org/Photograph schema.org/Photograph
kappa.schema_document_address schema.org/Article (+ subtypes) schema.org/Article
kappa.schema_codemodule_signed_address in-toto Statement v1 in-toto Statement v1

Determinism + canonical-form invariance

from uor_addr import kappa

# JSON: whitespace, key order, NFC vs NFD all collapse.
a = kappa.json_address(b'{"a":1,"b":2}')
b = kappa.json_address(b'{ "b" : 2 , "a" : 1 }')
assert a == b

# But typed values that look similar produce distinct κ-labels.
int_label = kappa.json_address(b"42")
str_label = kappa.json_address(b'"42"')
assert int_label != str_label

TC-05 replay across the FFI boundary

Each *_address_with_witness method returns a Grounded handle carrying the ψ-pipeline's emitted derivation. Calling grounded.verify() replays the derivation through prism_verify::certify_from_trace and returns the recovered κ-label without re-invoking SHA-256. The verifier reads the trace events the source pipeline emitted and re-packages the certified output (QS-05 replay equivalence; CL-R* in CONFORMANCE.md).

from uor_addr import kappa

with kappa.json_address_with_witness(b'{"foo":"bar"}') as grounded:
    print(grounded.kappa_label())
    # sha256:7a38bf81f383f69433ad6e900d35b3e2385593f76a7b7ab5d4355b8ba41ee24b

    assert grounded.verify() == grounded.kappa_label()
    # TC-05 round-trip; SHA-256 was not re-invoked.

    fingerprint: bytes = grounded.content_fingerprint()
    # 32-byte content fingerprint (distinct from the κ-label hex
    # suffix — it is prism's content-address of the Grounded's full
    # state, used for replay verification).

The Grounded handle is freed on __exit__ of the with block; otherwise it is freed at garbage-collection time. Cross-process attestation is not supported (the underlying Trace<256> constructor is pub(crate) in uor-foundation); for that, persist the κ-label itself and re-mint at the verifier side.

Why C ABI rather than WASM?

The @uor-foundation/uor-addr npm package wraps the WASM Component Model artifact via jco. Python's wasmtime-py does not yet expose the Component Model API (24.x ships core-module support only); pivoting to wasm would require either waiting for upstream or pulling in a less-mature runtime. The C ABI path is faster (native code), more compact (no wasm runtime in the wheel), and produces the same κ-label byte-for-byte. The uor-addr-c native library is bundled per-platform in the wheel.

Byte identity with the Rust crate

The κ-label this package produces is byte-for-byte identical to uor_addr::<realization>::address(input).address from the Rust crate (and to @uor-foundation/uor-addr npm's output). Cross-validation is pinned by the CF-C* invariant class in CONFORMANCE.md.

License

Apache-2.0.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

uor_addr-0.1.0-py3-none-win_amd64.whl (203.9 kB view details)

Uploaded Python 3Windows x86-64

uor_addr-0.1.0-py3-none-manylinux_2_28_x86_64.whl (317.4 kB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

uor_addr-0.1.0-py3-none-manylinux_2_28_aarch64.whl (311.4 kB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

uor_addr-0.1.0-py3-none-macosx_11_0_x86_64.whl (299.6 kB view details)

Uploaded Python 3macOS 11.0+ x86-64

uor_addr-0.1.0-py3-none-macosx_11_0_universal2.whl (291.9 kB view details)

Uploaded Python 3macOS 11.0+ universal2 (ARM64, x86-64)

File details

Details for the file uor_addr-0.1.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: uor_addr-0.1.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 203.9 kB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for uor_addr-0.1.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 b53e7ea6463a2f6e1f03effd6ccb53f37d69894c13d3aff6fdd1f031b1cab947
MD5 ec76ecca3d173887ed029d91d7590331
BLAKE2b-256 e42438c5565c0a67c01825f292b1b67ac57ddf1c95c0e31d4f3895316cd70c3d

See more details on using hashes here.

Provenance

The following attestation bundles were made for uor_addr-0.1.0-py3-none-win_amd64.whl:

Publisher: release.yml on UOR-Foundation/uor-addr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file uor_addr-0.1.0-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for uor_addr-0.1.0-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9cb3303d541852d56674830554fe902003ed0481a6eb003d272d31bbe8eea1e5
MD5 38f97746c12fec72bedd8f47dc5c931f
BLAKE2b-256 06356b03a3d0b83ffa2321d0acc18154addb55a550fb05e954b3ce6ffa131e76

See more details on using hashes here.

Provenance

The following attestation bundles were made for uor_addr-0.1.0-py3-none-manylinux_2_28_x86_64.whl:

Publisher: release.yml on UOR-Foundation/uor-addr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file uor_addr-0.1.0-py3-none-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for uor_addr-0.1.0-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 6aa81db1750e3cd8a500bb06d1403f1411a71aafe933f63601bb886a927c5b07
MD5 81923409332a8acdcdca5292d8c7cdc9
BLAKE2b-256 89976de296c81d4e049eb24675b36c9079b20a3351fe3662aaf1d84a6a41fe11

See more details on using hashes here.

Provenance

The following attestation bundles were made for uor_addr-0.1.0-py3-none-manylinux_2_28_aarch64.whl:

Publisher: release.yml on UOR-Foundation/uor-addr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file uor_addr-0.1.0-py3-none-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for uor_addr-0.1.0-py3-none-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 cce2f84a756dfea81cc4abeafbd700a08f8f637b5ee5f8f6a1718452a1965a8c
MD5 0d176c89807de84e52218812972b3624
BLAKE2b-256 ecd8139367f56ffdc5ce0cedf8c5d0d9f3f9d7b8043ce650eb9ec2ef5a30b24b

See more details on using hashes here.

Provenance

The following attestation bundles were made for uor_addr-0.1.0-py3-none-macosx_11_0_x86_64.whl:

Publisher: release.yml on UOR-Foundation/uor-addr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file uor_addr-0.1.0-py3-none-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for uor_addr-0.1.0-py3-none-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 cb2e40b3dbe7175c94a26cf55934ea3a208ef6fc44449014f6ec3abd7b381077
MD5 4390bc924b26471f2141852f6e0ce58d
BLAKE2b-256 2896c1ee3d46e400c3bb4b721119a924719de4b93f0460172914a71f64e903ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for uor_addr-0.1.0-py3-none-macosx_11_0_universal2.whl:

Publisher: release.yml on UOR-Foundation/uor-addr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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