Skip to main content

Minimal Proof-Carrying Thought (PCT) SDK: canonical bytes, Merkle, CAS, optional Ed25519 signing, policy gates, and chain-of-custody.

Project description

ProofCarryingThought-SDK

CI PyPI version Python versions License: Apache-2.0

Minimal Proof-Carrying Thought (PCT) SDK: canonical bytes, Merkle, local CAS, optional Ed25519 signing, policy gates, and chain-of-custody.

Install

  • From PyPI:

    pip install proofcarryingthought-sdk

  • Optional extras (combine as needed):

    pip install "proofcarryingthought-sdk[crypto]" # PyNaCl for Ed25519 pip install "proofcarryingthought-sdk[dcbor]" # cbor2 for canonical CBOR

  • From source (editable):

  • Base:

    • pip install -e .
  • Optional extras:

    • pip install -e .[crypto] # PyNaCl for Ed25519
    • pip install -e .[dcbor] # cbor2 for canonical CBOR

Canonicalization

  • Modes: auto (default, prefers dCBOR if installed), json (strict JSON), dcbor (requires cbor2)
  • Programmatic: from pct_sdk import set_canonical_mode; set_canonical_mode("auto"|"json"|"dcbor")
  • Env: set PCT_CANON_MODE=auto|json|dcbor

Quick start

from pct_sdk import pct_wrap, verify

evidence = {"units_ok": True, "ocap_list": ["sandbox"]} res = pct_wrap(lambda ev: {"result": "ok"}, include=["units_ok", "ocap_list"]) # noqa: E501 assert verify(res["pct_proof"], evidence)

With crypto:

from pct_sdk.sign import gen_keypair, sign, verify as sig_verify sk_hex, vk_hex = gen_keypair() sig_hex = sign(sk_hex, b"msg") assert sig_verify(vk_hex, b"msg", sig_hex)

CAS usage

from pct_sdk import cas hid = cas.put({"hello": "world"}) obj = cas.get(hid)

Tests

pytest

Changelog

See CHANGELOG.md for release notes.

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

proofcarryingthought_sdk-0.1.0.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

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

proofcarryingthought_sdk-0.1.0-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for proofcarryingthought_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8f12bd2accc739d799bfe4aa6acbc032fd3b88ae9c6826f845643a7a2c4f8d39
MD5 f490d235aea1e10fe7d23b17604d9cc7
BLAKE2b-256 1e3be47cc9545d3ee784b7144faa7593aab93978b9a6001164af85962abf7178

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for proofcarryingthought_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 15ba6854f3672a51e2ea5f6bea6102b7c406407bb064cc9dd9eb600c15337999
MD5 6fc6a0c298bfb1de17e19839725fe7c6
BLAKE2b-256 7138f99b16d9283e3121419a11f1ac1aa57fc6ec1d758735aa45139800102972

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