A Python SDK for integrating Zero-Knowledge TLS attestation into your applications.
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.
- 🔒 Secure TLS attestation
- 🔍 Response verification
- 📝 Custom templates support
- 🛠️ Configurable attestation conditions
- 🔄 Automatic SSL cipher configuration
- 🐍 Native Python async/await support
pip install zktls-py-sdkThe SDK depends on the following:
- Node.js 14+
- npm 6+
@primuslabs/zktls-core-sdkpackage version ^0.1.1
The SDK will automatically check for these dependencies during initialization.
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())- 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 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 allow customization of attestation behavior:
attestation = await wrapper.start_attestation(
request=request,
response_resolves=response_resolves,
template_id="my-custom-template"
)We welcome contributions! Please see our Contributing Guide for details.
This project is licensed under the MIT License - see the LICENSE file for details.
For security issues, please email security@primuslabs.xyz instead of using the issue tracker.