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.8.tar.gz
(16.9 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.8.tar.gz.
File metadata
- Download URL: provable_sdk-0.0.8.tar.gz
- Upload date:
- Size: 16.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d64cb268cb45929d6d109d23696ca14a3483db6a45e05cdfc5e92457c78fc5a6
|
|
| MD5 |
7bc51f226692ce4ce26fac9be492fa6e
|
|
| BLAKE2b-256 |
2de558654904e7fac259d83d99f8ddf634eff7960881dec1d7b3ac413d43dc29
|
File details
Details for the file provable_sdk-0.0.8-py3-none-any.whl.
File metadata
- Download URL: provable_sdk-0.0.8-py3-none-any.whl
- Upload date:
- Size: 14.7 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 |
163b51bdf8056d9fa0afc9f3284c1d16771c84b7d9d85406ef77c0b06019d706
|
|
| MD5 |
5ce02d6b3989f6700b04e9deacf5135e
|
|
| BLAKE2b-256 |
0c4b2cbf473474361103aadf0e0427ebd29483472203e3420e476befaf18a301
|