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.0.10.tar.gz (17.4 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.0.10-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: provable_sdk-0.0.10.tar.gz
  • Upload date:
  • Size: 17.4 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.0.10.tar.gz
Algorithm Hash digest
SHA256 2f981bf8aa3b9135c139661b4cbe407b7909fd7cf2b072a4c53d8940a816caa2
MD5 6659755aa22e16d6b03f0d001095967a
BLAKE2b-256 1d00c05f9d98a4f3a6966ad3005b6c243ede77ffe52b868dee8890defd9f6e7f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: provable_sdk-0.0.10-py3-none-any.whl
  • Upload date:
  • Size: 14.9 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.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 f1ed90630e2987d72f4b7d6b29bec8ad6f0b1e9548fd686d63c5d314feca5152
MD5 7b00f3745ca1e02bebee6dad49820f4d
BLAKE2b-256 70cf842f20fb04fefd1beb04b8d4e4f19aeb33769bfefe728e92d5a3461f687e

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