Skip to main content

Official Python SDK for the Reclaim Protocol — generate and verify zk-attested HTTPS proofs.

Project description

Reclaim Protocol Python SDK

Generate and verify Reclaim Protocol proofs from Python.

Migrating from reclaim-python-sdk? This package is the successor to reclaim-python-sdk. The old package is no longer maintained — please use this one going forward. For legacy versions (≤ 1.0.3), see the old package on PyPI.

Install

pip install reclaimprotocol-python-sdk

Prerequisites

Get your credentials from the Reclaim Developer Portal:

  • APP_ID
  • APP_SECRET
  • PROVIDER_ID

Quick Start

1. Generate a proof request

import asyncio
from reclaim_python_sdk import ReclaimProofRequest

async def main():
    proof_request = await ReclaimProofRequest.init(
        app_id="YOUR_APP_ID",
        app_secret="YOUR_APP_SECRET",
        provider_id="YOUR_PROVIDER_ID",
    )

    # Set the URL where proofs will be sent
    proof_request.set_app_callback_url("https://your-backend.com/receive-proofs")

    # URL to show as QR code / deep link to the user
    request_url = await proof_request.get_request_url()
    print(request_url)

asyncio.run(main())

Optional configuration

# Add contextual data bound to the proof
proof_request.add_context("0x0", "login for example.com")

# Pre-fill known parameters
proof_request.set_params({"email": "user@example.com"})

# Redirect the user after verification
proof_request.set_redirect_url("https://your-app.com/success")

# Export/import the request (e.g., send to another service)
config = proof_request.to_json_string()
restored = await ReclaimProofRequest.from_json_string(config)

2. Receive and verify proofs

Any web framework works. Here's Flask:

from flask import Flask, request, jsonify
from reclaim_python_sdk import verify_proof, Proof

app = Flask(__name__)

@app.post("/receive-proofs")
async def receive_proofs():
    proof = Proof.from_json(request.json)
    result = await verify_proof(proof, {"providerId": "YOUR_PROVIDER_ID"})

    if not result.is_verified:
        return jsonify({"error": str(result.error)}), 400

    return jsonify({
        "extracted_parameters": result.data[0].extracted_parameters,
    })

verify_proof accepts a single proof OR a list of proofs:

await verify_proof(proof, config)      # single
await verify_proof([p1, p2, p3], config)  # multiple

verify_proof Config Options

1. By provider ID + version (recommended)

Pins verification to a specific provider version. Only providerId is required — providerVersion and allowedTags are optional (pass [] for empty tags):

await verify_proof(proof, {
    "providerId": "YOUR_PROVIDER_ID",
    "providerVersion": "1.0.0",  # optional but recommended
    "allowedTags": ["ai"],        # optional, can be []
})

2. By provider ID only

Fetches the latest expected hashes from the Reclaim backend:

await verify_proof(proof, {"providerId": "YOUR_PROVIDER_ID"})

3. By known hashes (no network calls)

Supply the expected hashes directly — no call to the Reclaim backend:

await verify_proof(proof, {"hashes": ["0x1abc2def3456..."]})

4. Skip content validation

Only checks attestor signatures — does NOT validate the proof content:

await verify_proof(proof, {"dangerouslyDisableContentValidation": True})

Result shape

verify_proof always returns a result with:

Field Description
is_verified True / False
error Exception if failed, None if passed
data List of TrustedData (context + extracted parameters)
public_data Deduplicated public data from proofs

Testing

pip install pytest pytest-asyncio
pytest tests/

Links

Security

Never commit your APP_SECRET or expose it in client-side code.

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

reclaimprotocol_python_sdk-2.0.0.tar.gz (31.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

reclaimprotocol_python_sdk-2.0.0-py3-none-any.whl (30.3 kB view details)

Uploaded Python 3

File details

Details for the file reclaimprotocol_python_sdk-2.0.0.tar.gz.

File metadata

File hashes

Hashes for reclaimprotocol_python_sdk-2.0.0.tar.gz
Algorithm Hash digest
SHA256 1c9a80ce83edb6336d9e92aec82d5fb84188b6a390cbb4e85d34952c87b99893
MD5 5072667853721ec15acb55b88a5ab59c
BLAKE2b-256 39ed1416a01f64e17aafb987916a894c85c7c328ed9986e45e9aa72c15c11628

See more details on using hashes here.

File details

Details for the file reclaimprotocol_python_sdk-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for reclaimprotocol_python_sdk-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 65067852d3128491996ce1b64d9d338f1ec91d44da9753de0827e26b5170dc2f
MD5 f60883962d235c4ac6efa5fb0d6338bd
BLAKE2b-256 4504db74712fe42f8858b05a57fb9e8f4c164b0f6c9e396448e71276a70806e7

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