A Python SDK for Primus Labs' Zero-Knowledge TLS (ZK TLS) protocol, enabling secure attestation and proxy TLS functionality for privacy-preserving data verification
Project description
ZK TLS Python SDK
A Python SDK for integrating Zero-Knowledge TLS attestation into your applications.
Overview
The ZK TLS Python SDK provides a seamless interface to the ZK TLS protocol, enabling secure and private attestation of network interactions. It wraps the Node.js ZK TLS Core SDK and provides a Pythonic interface for easy integration.
Features
- 🔒 Secure TLS attestation
- 🔍 Response verification
- 📝 Custom templates support
- 🛠️ Configurable attestation conditions
- 🔄 Automatic SSL cipher configuration
- 🐍 Native Python async/await support
Installation
pip install zktls-py-sdk
Prerequisites
- Python 3.8+
- Node.js 14+
- npm 6+
The SDK will automatically check for these dependencies during initialization.
Quick Start
import asyncio
from zktls import NodeWrapper
async def main():
# Initialize SDK
wrapper = NodeWrapper()
await wrapper.init("your-app-id", "your-app-secret")
# Define request
request = {
"url": "https://api.example.com/data",
"header": {"Accept": "application/json"},
"method": "GET",
"body": ""
}
# Define response resolves
response_resolves = [
{
"keyName": "field1",
"parseType": "string",
"parsePath": "$.field1"
}
]
# Start attestation
attestation = await wrapper.start_attestation(
request=request,
response_resolves=response_resolves
)
# Verify attestation
is_verified = await wrapper.verify_attestation(attestation)
print(f"Attestation verified: {is_verified}")
if __name__ == "__main__":
asyncio.run(main())
Documentation
Key Concepts
Attestation Flow
- Initialization: Create a NodeWrapper instance and initialize with credentials
- Request Definition: Define the HTTP request and response parsing rules
- Attestation: Start the attestation process with optional custom parameters
- Verification: Verify the attestation response
Response Resolves
Response resolves define how to parse and extract data from the response:
response_resolves = [
{
"keyName": "field1", # Name for the extracted field
"parseType": "string", # Expected type
"parsePath": "$.field1" # JSONPath to the field
}
]
Templates
Templates allow customization of attestation behavior:
attestation = await wrapper.start_attestation(
request=request,
response_resolves=response_resolves,
template_id="my-custom-template"
)
Contributing
We welcome contributions! Please see our Contributing Guide for details.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Security
For security issues, please email security@primuslabs.xyz instead of using the issue tracker.
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
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 zktls_py_sdk-0.1.2.tar.gz.
File metadata
- Download URL: zktls_py_sdk-0.1.2.tar.gz
- Upload date:
- Size: 25.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c4a2214ec6be9fa7b1380f3a2f879b6080b2c0d24eb9da8ed489d732c93e25a
|
|
| MD5 |
59e1ec43ebbeb31adea09307803a95d0
|
|
| BLAKE2b-256 |
aad7c0a97b3424a1f03c3d92ab03f3e837d870b3098fc87a1db7708a7523fff2
|
File details
Details for the file zktls_py_sdk-0.1.2-py3-none-any.whl.
File metadata
- Download URL: zktls_py_sdk-0.1.2-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4fc87f6368f39f22db5f9eecb2ef4bab964f4fea8225a3331fe199b3008cd63
|
|
| MD5 |
9b4fff078cb79e90d13f8b85e0fb4eb5
|
|
| BLAKE2b-256 |
01032c8891aabf725f1987c58f4fab5a173b26cbf2eac0061e12a173a9cc7f0b
|