Skip to main content

Provable SDK for Python

Project description

Provable SDK for Python

provable-sdk-py is the Kayros API and verification SDK for Python.

Installation

pip install provable-sdk

Usage

1. Default usage

Use the built-in key and the default provable_sdk data type.

from provable_sdk import prove_single_hash, get_record_by_hash, verify, verify_with_inclusion

data_item = "ab" * 32
proof = prove_single_hash(data_item)
kayros_hash = proof["hash"]

record = get_record_by_hash(kayros_hash)

verified = verify({
    "data_type": "provable_sdk",
    "data_item": data_item,
    "kayros_hash": kayros_hash,
})

inclusion = verify_with_inclusion({
    "data_type": "provable_sdk",
    "kayros_hash": kayros_hash,
})

2. Usage with API key and custom data type

import os

from provable_sdk import prove_single_hash, verify, verify_with_inclusion, set_api_key

settings = {
    "api_key": os.environ["KAYROS_API_KEY"],
    "data_type": "kayros_indexer_v1",
}

set_api_key(settings["api_key"])

proof = prove_single_hash(
    "ab" * 32,
    data_type=settings["data_type"],
    api_key=settings["api_key"],
)
kayros_hash = proof["hash"]

verified = verify({
    "data_type": settings["data_type"],
    "data_item": "ab" * 32,
    "kayros_hash": kayros_hash,
    "api_key": settings["api_key"],
})

inclusion = verify_with_inclusion({
    "data_type": settings["data_type"],
    "kayros_hash": kayros_hash,
    "api_key": settings["api_key"],
    "verify_batch_existence": True,
})

Main API

  • prove_single_hash(data_hash, data_type=None, api_key=None)
  • get_record_by_hash(kayros_hash, data_type=None, api_key=None)
  • get_record_by_data_item(data_type, data_item, api_key=None)
  • get_merkle_proof(data_type, hash=..., position=..., api_key=None)
  • verify_hash_existence({"data_type": ..., "level": ..., "position": ..., "hash": ...}, api_key=None)
  • verify_hash_batch({"data_type": ..., "level": ..., "start": ..., "hashes": [...]}, api_key=None)
  • verify({"data_type": ..., "data_item"?: ..., "kayros_hash"?: ..., "api_key"?: ...})
  • verify_with_inclusion({"data_type": ..., "data_item"?: ..., "kayros_hash"?: ..., "api_key"?: ..., "trusted_root_hash"?: ..., "trusted_level"?: ..., "trusted_position"?: ..., "levels_hash_type"?: ..., "verify_batch_existence"?: ..., "level_checks"?: [...]})

data_type is required for verification. Provide at least one of data_item or kayros_hash.

levels_hash_type controls the Merkle rollup hash used for local inclusion replay. It defaults to sha3-256 and also accepts sha256.

License

MIT

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

provable_sdk-0.1.2.tar.gz (21.9 kB view details)

Uploaded Source

Built Distribution

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

provable_sdk-0.1.2-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

Details for the file provable_sdk-0.1.2.tar.gz.

File metadata

  • Download URL: provable_sdk-0.1.2.tar.gz
  • Upload date:
  • Size: 21.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.4

File hashes

Hashes for provable_sdk-0.1.2.tar.gz
Algorithm Hash digest
SHA256 c4d6f4a1b9d9679566c429ef7029cbe00a12636ad62e1446de9235d9346f476c
MD5 4629298caa24307539f36286b56ddaca
BLAKE2b-256 a72141e3e439840eabb61c7f944dfbea7efebd6c2134b3f92d75eca89e553e5d

See more details on using hashes here.

File details

Details for the file provable_sdk-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: provable_sdk-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 18.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.4

File hashes

Hashes for provable_sdk-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6be4adf9f93f59e936b31f42dd7ade085d49fc9e88c071876a1f5e1c0eeed283
MD5 60d566476115e1e45a02c23aa5aa2909
BLAKE2b-256 e315770629371af38f5ac52a9c6691721929e785f218cb236b90194d059b941c

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