Documentation
Demarrage rapide
Inscrivez-vous
Creez un compte sur privexzk.ch/dashboard. Vous recevrez un magic link par email.
Recuperez vos cles API
Dans le dashboard, generez une paire de cles : pk_live_xxx (publique) et sk_live_xxx (secrete).
Integrez le widget
Ajoutez 3 lignes de code a votre site pour afficher la verification d'age.
1<script src="https://cdn.privexzk.ch/age-widget.js"></script>2<div id="age-gate"3 data-platform-key="pk_live_xxx"4 data-min-age="18">5</div>
Reference API
/verify/proofVerifie une ZK proof soumise par le widget.
Headers :
X-API-Key: sk_live_xxxBody :
{
"proof": {
"a": ["0x...", "0x..."],
"b": [["0x...", "0x..."], ["0x...", "0x..."]],
"c": ["0x...", "0x..."]
},
"public_inputs": {
"commitment_hash": "0x...",
"current_timestamp": 1700000000,
"platform_id": "0x...",
"chain_id": 11155111,
"nullifier_hash": "0x...",
"revocation_root": "0x..."
},
"platform_key": "pk_live_xxx"
}Reponse :
{
"verified": true,
"verification_id": "abc123-def456",
"timestamp": 1700000000
}/dashboard/statsRetourne les statistiques de verification de la plateforme.
Headers :
X-API-Key: sk_live_xxxReponse :
{
"total_verifications": 1250,
"this_month": 340,
"success_rate": 0.97,
"current_plan": "growth",
"verifications_remaining": 9660
}/platform/registerEnregistre une nouvelle plateforme cliente.
Body :
{
"name": "Ma Plateforme",
"email": "admin@example.com",
"website": "https://example.com",
"plan": "growth"
}Reponse :
{
"api_key": "pk_live_abc123...",
"secret_key": "sk_live_xyz789...",
"platform_id": "0x..."
}Exemples d'integration
1import { useEffect } from 'react'23export function AgeGate({ onVerified }) {4 useEffect(() => {5 window.PrivexAgeGate?.init({6 platformKey: 'pk_live_xxx',7 verifyEndpoint: '/api/verify-age',8 onVerified9 })10 }, [])11 return <div id="privex-age-gate" />12}
Webhooks
Configurez un endpoint webhook dans votre dashboard pour recevoir des notifications en temps reel.
age.verifiedEmis apres chaque verification reussie.
{
"event": "age.verified",
"verification_id": "abc123",
"platform_id": "0x...",
"timestamp": 1700000000,
"nullifier_hash": "0x..."
}age.verification_failedEmis quand une verification echoue.
{
"event": "age.verification_failed",
"platform_id": "0x...",
"timestamp": 1700000000,
"reason": "PROOF_INVALID"
}Format du credential
Le credential est un fichier JSON stocke localement par l'utilisateur. Voici sa structure :
1{2 "version": "1.0.0",3 "type": "PrivexZkAgeCredential",4 "commitmentHash": "0x...",5 "issuer": {6 "pubkeyAx": "0x...",7 "pubkeyAy": "0x..."8 },9 "signature": {10 "R8x": "0x...",11 "R8y": "0x...",12 "S": "0x...",13 "scheme": "eddsa-babyjubjub"14 },15 "private": {16 "nullifierSecret": "0x...",17 "ageAbove18": 1,18 "expiry": 1735689600,19 "issuerPubkeyHash": "0x..."20 },21 "metadata": {22 "issuedAt": "2025-01-01T00:00:00Z",23 "expiresAt": "2026-01-01T00:00:00Z",24 "chainId": 1115511125 }26}
Environnement sandbox
Testez l'integration gratuitement sur le reseau Sepolia. Aucune carte bancaire requise.
- ✓Cles API de test : pk_test_xxx / sk_test_xxx
- ✓Smart contracts deployes sur Sepolia
- ✓Credentials de test pre-generes
- ✓Meme API, memes endpoints