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": ...}, 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"?: ..., "verify_batch_existence"?: ..., "level_checks"?: [...]})
data_type is required for verification. Provide at least one of data_item or kayros_hash.
License
MIT
Project details
Release history Release notifications | RSS feed
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.9.tar.gz
(17.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file provable_sdk-0.0.9.tar.gz.
File metadata
- Download URL: provable_sdk-0.0.9.tar.gz
- Upload date:
- Size: 17.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e90fd3cbb095794782b10736ed0246649f374cbbe3e6d7b94d809581247428aa
|
|
| MD5 |
18ab52a5ad4add1dba1f671ed6cdf4af
|
|
| BLAKE2b-256 |
d79c4654c56c6ebbefa3dd33a266e2be4181bae373deb21f6f825c7560f0ff79
|
File details
Details for the file provable_sdk-0.0.9-py3-none-any.whl.
File metadata
- Download URL: provable_sdk-0.0.9-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf5d169a305993903fa0f54b3592cb9510d181908db2238ef5682841829ba631
|
|
| MD5 |
2cdc2c1d58633cb83d65353baeede849
|
|
| BLAKE2b-256 |
8a3693e6fb6fd8b924c850c4ed1d3ad61b3e4a7210d5adb6175dceaaa731423d
|