Skip to content

Commit df22b01

Browse files
author
madhavanmalolan
committed
removing unecessary docs and ai slop
1 parent 20b0dcb commit df22b01

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+13359
-5820
lines changed

CLAUDE.md

Lines changed: 365 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,365 @@
1+
# Reclaim Protocol Documentation - Complete Reference Guide
2+
3+
This document provides a comprehensive overview of the entire Reclaim Protocol documentation, covering all SDKs, integration methods, and technical details found in the `/content/docs` directory.
4+
5+
## 🎯 Overview
6+
7+
Reclaim Protocol is a privacy-preserving identity and data verification protocol that enables users to prove facts about their online activity without revealing sensitive information. The protocol supports **2500+ data sources** and provides SDKs for web, mobile, and blockchain platforms.
8+
9+
### Key Features
10+
- **Zero-Knowledge Proofs**: Verify data without exposing credentials
11+
- **Cross-Platform SDKs**: Web, Mobile (iOS/Android/React Native/Flutter), and 15+ blockchains
12+
- **Privacy-First**: End-to-end encryption with no credential storage
13+
- **Seamless UX**: App Clips/Instant Apps - no installation required
14+
15+
## 🔑 Getting Started
16+
17+
### 1. Create Application
18+
1. Register at [dev.reclaimprotocol.org](https://dev.reclaimprotocol.org)
19+
2. Create new application with name, description, and logo
20+
3. Copy `APP_ID` and `APP_SECRET` (⚠️ Secret shown only once)
21+
4. Add providers to your application
22+
5. Note down `PROVIDER_ID` for each provider
23+
24+
### 2. Core Concepts
25+
26+
#### **Proofs**
27+
- Cryptographic evidence of user's online activity
28+
- Generated through secure TLS communication
29+
- Verifiable without revealing sensitive data
30+
31+
#### **Attestors**
32+
- Opaque proxies between users and target servers
33+
- Cannot decrypt user data (end-to-end TLS encryption)
34+
- Verify and sign claims without accessing sensitive info
35+
36+
#### **Providers**
37+
- Define what to verify and how
38+
- Components: `loginUrl`, `requestData`, `responseMatches`, `responseRedactions`
39+
- Create custom providers via DevTool
40+
41+
#### **Verifier Apps**
42+
- Native mobile apps via App Clips (iOS) / Instant Apps (Android)
43+
- No installation required - access via URL
44+
- Handle proof generation seamlessly
45+
46+
## 🌐 Web SDK Integration
47+
48+
### Frontend (React/JS)
49+
50+
#### Method 1: `triggerReclaimFlow()` (Recommended)
51+
```javascript
52+
import { ReclaimProofRequest } from '@reclaimprotocol/js-sdk';
53+
54+
const handleVerification = async () => {
55+
const reclaimProofRequest = await ReclaimProofRequest.init(APP_ID, APP_SECRET, PROVIDER_ID);
56+
57+
// Auto-detects environment (extension/QR/mobile)
58+
await reclaimProofRequest.triggerReclaimFlow();
59+
60+
await reclaimProofRequest.startSession({
61+
onSuccess: (proofs) => {
62+
console.log('Verification successful:', proofs);
63+
},
64+
onError: (error) => {
65+
console.error('Verification failed', error);
66+
}
67+
});
68+
};
69+
```
70+
71+
#### Method 2: Manual QR Code
72+
```javascript
73+
const requestUrl = await reclaimProofRequest.getRequestUrl();
74+
// Display as QR code or link
75+
```
76+
77+
### Backend Verification
78+
79+
#### Node.js/Express
80+
```javascript
81+
import { ReclaimProofRequest } from '@reclaimprotocol/js-sdk';
82+
83+
app.post('/request-proof', async (req, res) => {
84+
const request = await ReclaimProofRequest.init(APP_ID, APP_SECRET, PROVIDER_ID);
85+
request.setCallbackUrl(`${BASE_URL}/receive-proofs`);
86+
87+
const { requestUrl, statusUrl } = await request.createVerificationRequest();
88+
res.json({ requestUrl, statusUrl });
89+
});
90+
91+
app.post('/receive-proofs', async (req, res) => {
92+
const { claimData } = req.body;
93+
const isValid = await ReclaimProofRequest.verifyProof(claimData);
94+
// Process verified data
95+
});
96+
```
97+
98+
#### Python/FastAPI
99+
```python
100+
from reclaim_python_sdk import ReclaimProofRequest
101+
102+
@app.post("/request-proof")
103+
async def request_proof():
104+
request = ReclaimProofRequest(APP_ID, APP_SECRET, PROVIDER_ID)
105+
request.set_callback(f"{BASE_URL}/receive-proofs")
106+
107+
request_url = await request.get_request_url()
108+
status_url = request.get_status_url()
109+
return {"requestUrl": request_url, "statusUrl": status_url}
110+
```
111+
112+
## 📱 Mobile SDKs
113+
114+
### React Native
115+
116+
#### Installation (Expo)
117+
```bash
118+
npx expo install @reclaimprotocol/inapp-rn-sdk
119+
```
120+
121+
Add to `app.json` plugins:
122+
```json
123+
"plugins": [
124+
"@reclaimprotocol/inapp-rn-sdk"
125+
]
126+
```
127+
128+
#### Usage
129+
```javascript
130+
import { ReclaimVerification } from '@reclaimprotocol/inapp-rn-sdk';
131+
132+
const handleVerify = async () => {
133+
const sessionId = await ReclaimVerification.startVerification({
134+
applicationId: APP_ID,
135+
applicationSecret: APP_SECRET,
136+
providerId: PROVIDER_ID,
137+
});
138+
139+
// Handle success/failure
140+
};
141+
```
142+
143+
### iOS (Swift)
144+
145+
#### Installation
146+
```swift
147+
// Swift Package Manager
148+
.package(url: "https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git", from: "0.3.0")
149+
150+
// CocoaPods
151+
pod 'ReclaimInAppSdk', '~> 0.3.0'
152+
```
153+
154+
#### Performance Fix Required
155+
Add to Xcode scheme environment variables:
156+
- Key: `GODEBUG`
157+
- Value: `asyncpreemptoff=1`
158+
159+
### Android (Kotlin)
160+
161+
#### Setup
162+
```groovy
163+
// settings.gradle
164+
repositories {
165+
maven { url "https://reclaim-inapp-sdk.s3.ap-south-1.amazonaws.com/android/0.3.0/repo" }
166+
}
167+
168+
// build.gradle
169+
implementation "org.reclaimprotocol:inapp_sdk:0.3.0"
170+
```
171+
172+
#### AndroidManifest.xml
173+
```xml
174+
<activity
175+
android:name="org.reclaimprotocol.inapp_sdk.ReclaimActivity"
176+
android:theme="@style/Theme.ReclaimInAppSdk.LaunchTheme"
177+
/>
178+
<meta-data android:name="org.reclaimprotocol.inapp_sdk.APP_ID"
179+
android:value="YOUR_APP_ID" />
180+
<meta-data android:name="org.reclaimprotocol.inapp_sdk.APP_SECRET"
181+
android:value="YOUR_APP_SECRET" />
182+
```
183+
184+
## ⛓️ Blockchain Integration
185+
186+
### Supported Networks
187+
- **EVM**: Ethereum, Polygon, Arbitrum, Optimism, BSC, Base, etc.
188+
- **Non-EVM**: Solana, Cosmos, NEAR, Polkadot, Sui, Cardano, Stellar, Mina, and more
189+
190+
### Solidity Example
191+
```solidity
192+
import "@reclaimprotocol/verifier-solidity-sdk/contracts/Reclaim.sol";
193+
import "@reclaimprotocol/verifier-solidity-sdk/contracts/Addresses.sol";
194+
195+
contract Attestor {
196+
address public reclaimAddress;
197+
198+
constructor() {
199+
reclaimAddress = Addresses.ETHEREUM; // Or other network
200+
}
201+
202+
function verifyProof(Reclaim.Proof memory proof) public view {
203+
Reclaim(reclaimAddress).verifyProof(proof);
204+
// Extract context fields if needed
205+
string memory steamId = Reclaim(reclaimAddress)
206+
.extractFieldFromContext(proof.claimInfo.context, '"SteamId":"');
207+
}
208+
}
209+
```
210+
211+
## 🔐 zkFetch SDK
212+
213+
Generate proofs of HTTP responses with privacy preservation.
214+
215+
### Basic Usage
216+
```javascript
217+
import { ReclaimClient } from '@reclaimprotocol/zk-fetch';
218+
219+
const client = new ReclaimClient(APP_ID, APP_SECRET);
220+
221+
// Public endpoint
222+
const proof = await client.zkFetch('https://api.example.com/data', {
223+
method: 'GET',
224+
headers: { accept: 'application/json' }
225+
});
226+
227+
// Private endpoint with hidden auth
228+
const proofPrivate = await client.zkFetch(
229+
'https://api.example.com/private',
230+
{ method: 'GET' }, // Public options
231+
{ headers: { apiKey: 'secret-key' } } // Private options (hidden)
232+
);
233+
```
234+
235+
### Advanced Features
236+
```javascript
237+
// Response matching and redaction
238+
const proof = await client.zkFetch(url, publicOpts, {
239+
responseMatches: [{
240+
type: 'regex',
241+
value: '\\{"price":(?<price>[\\d\\.]+)\\}'
242+
}],
243+
responseRedactions: [{
244+
jsonPath: '$.sensitive_data'
245+
}]
246+
});
247+
248+
// Verify and transform for blockchain
249+
const isValid = await Reclaim.verifySignedProof(proof);
250+
const onchainProof = Reclaim.transformForOnchain(proof);
251+
```
252+
253+
## 🎨 OAuth Integration
254+
255+
### React OAuth SDK
256+
```javascript
257+
import { useReclaimAuth } from '@reclaimprotocol/reclaim-react-sdk';
258+
259+
function App() {
260+
const { user, loading, error, signIn, signOut } = useReclaimAuth();
261+
262+
const handleAuth = async () => {
263+
await signIn({
264+
clientId: CLIENT_ID,
265+
redirectUri: REDIRECT_URI,
266+
providers: ['google-login', 'github-login']
267+
});
268+
};
269+
}
270+
```
271+
272+
## 🤖 AI Agent Integration
273+
274+
Email-based verification with A2A protocol compatibility:
275+
276+
```javascript
277+
// Send verification email
278+
await agent.sendVerificationEmail({
279+
to: 'user@example.com',
280+
verificationType: 'google-login'
281+
});
282+
283+
// Check status
284+
const status = await agent.checkVerificationStatus(verificationId);
285+
```
286+
287+
## 🛠️ Advanced Features
288+
289+
### Verification Options
290+
```javascript
291+
{
292+
canDeleteCookiesBeforeVerificationStarts: true, // Clear session storage
293+
canUseAttestorAuthenticationRequest: false, // Authentication request
294+
claimCreationType: 'standalone', // or 'meChain'
295+
canAutoSubmit: true, // Auto-submit proof
296+
isCloseButtonVisible: true // Show close button
297+
}
298+
```
299+
300+
### Provider Structure
301+
```javascript
302+
{
303+
loginUrl: 'https://example.com/login',
304+
requestData: [{
305+
url: 'https://api.example.com/user',
306+
method: 'GET',
307+
responseMatches: [{
308+
type: 'contains',
309+
value: '"email":"{{email}}"'
310+
}],
311+
responseRedactions: [{
312+
jsonPath: '$.password',
313+
regex: 'token=[^&]*'
314+
}]
315+
}]
316+
}
317+
```
318+
319+
## 🚨 Security Considerations
320+
321+
1. **Never expose APP_SECRET in frontend code**
322+
2. **Always verify proofs server-side in production**
323+
3. **Use environment variables for credentials**
324+
4. **Implement proper error handling**
325+
5. **Set appropriate webhook URLs for async flows**
326+
327+
## 📚 Resources
328+
329+
- **Developer Portal**: [dev.reclaimprotocol.org](https://dev.reclaimprotocol.org)
330+
- **Provider Explorer**: [2500+ providers](https://dev.reclaimprotocol.org/explore)
331+
- **Telegram Support**: [t.me/protocolreclaim](https://t.me/protocolreclaim)
332+
- **Technical Blog**: [blog.reclaimprotocol.org](https://blog.reclaimprotocol.org)
333+
- **GitHub**: [github.com/reclaimprotocol](https://github.com/reclaimprotocol)
334+
- **Security Analysis**: [ePrint 2024/733](https://eprint.iacr.org/2024/733)
335+
336+
## 🎯 Common Use Cases
337+
338+
1. **Identity Verification**: Education, employment, professional credentials
339+
2. **Financial Data**: Credit scores, income verification, accredited investor status
340+
3. **Loyalty/Reputation**: Shopping history, platform activity, gaming achievements
341+
4. **On-chain Oracles**: Bringing web2 data to smart contracts
342+
5. **Access Control**: Gated content based on off-chain activity
343+
344+
## 💡 Best Practices
345+
346+
1. **Development Flow**:
347+
- Start with frontend quickstart
348+
- Implement backend verification
349+
- Add error handling and retry logic
350+
- Test with multiple providers
351+
352+
2. **Production Checklist**:
353+
- ✅ Backend proof verification
354+
- ✅ Secure credential management
355+
- ✅ Webhook implementation
356+
- ✅ Error tracking
357+
- ✅ Rate limiting
358+
359+
3. **User Experience**:
360+
- Show clear verification status
361+
- Provide fallback options
362+
- Handle edge cases gracefully
363+
- Optimize for mobile experience
364+
365+
This documentation represents the complete Reclaim Protocol ecosystem as documented in the `/content/docs` directory. Each section provides entry points into specific implementation details while maintaining the overall context of the protocol's capabilities and best practices.

0 commit comments

Comments
 (0)