diff --git a/content/docs/advance-options/advance-options.mdx b/content/docs/advance-options/advance-options.mdx index 6fe41a9..3736ef9 100644 --- a/content/docs/advance-options/advance-options.mdx +++ b/content/docs/advance-options/advance-options.mdx @@ -258,7 +258,7 @@ The `setRedirectUrl` method allows you to specify a custom URL where users will const requestUrl = await reclaimProofRequest.getRequestUrl() ``` - To set up deep linking in your Flutter app: + To set up deep linking in your RN app: 1. Configure your app to handle the custom URL scheme (e.g., 'yourapp://') 2. Set up a route in your app to handle the '/verification-complete' path 3. Process any additional data passed through the deep link as needed @@ -596,38 +596,3 @@ When using any Reclaim SDK (JavaScript, React Native, Flutter), a proof is gener } ``` -### Key Components: - -- **identifier**: A unique identifier for the proof. -- **claimData**: Contains detailed information about the claim, including: - - **provider**: The type of provider used for verification. - - **parameters**: The parameters used during the verification process. - - **owner**: The address of the owner of the proof. - - **timestampS**: The timestamp when the proof was generated. - - **context**: Any additional context information related to the proof. - - **epoch**: The epoch number indicating the version or state of the proof. -- **signatures**: A list of signatures that validate the proof. -- **witnesses**: Information about witnesses that observed the proof generation, including their ID and URL. -- **publicData**: Any public data associated with the proof. - -This proof is typically received in the `onSuccess` callback of `startVerificationSession` method when using the default `callbackUrl`. However, if you have set a custom `callbackUrl`, you will receive this proof at your specified API endpoint. - - -## Best Practices for SDK Advanced Options - -1. **Security**: Always prioritize security when configuring callbacks and parameters. Use HTTPS for all URLs and avoid passing sensitive data in parameters. - -2. **Error Handling**: Implement robust error handling for all advanced options, especially when dealing with callbacks and redirects. - -3. **Testing**: Thoroughly test your advanced options in a staging environment before deploying to production. - -4. **Documentation**: Maintain clear documentation of your custom configurations, especially when using context or custom parameters. - - - Remember, while these advanced options offer more flexibility, they also require careful implementation to ensure security and reliability. - - -By leveraging these advanced options, you can create a more tailored and robust integration of the Reclaim Protocol into your application. If you have any questions about these advanced features, don't hesitate to reach out to our support team or community forums. - -Happy coding with Reclaim Protocol! - diff --git a/content/docs/inapp-sdks/advanced/attestor-auth.mdx b/content/docs/advance-options/attestor-auth.mdx similarity index 100% rename from content/docs/inapp-sdks/advanced/attestor-auth.mdx rename to content/docs/advance-options/attestor-auth.mdx diff --git a/content/docs/inapp-sdks/advanced/verification-options.mdx b/content/docs/advance-options/js-injections/verification-options.mdx similarity index 100% rename from content/docs/inapp-sdks/advanced/verification-options.mdx rename to content/docs/advance-options/js-injections/verification-options.mdx diff --git a/content/docs/inapp-sdks/advanced/overrides.mdx b/content/docs/advance-options/overrides.mdx similarity index 100% rename from content/docs/inapp-sdks/advanced/overrides.mdx rename to content/docs/advance-options/overrides.mdx diff --git a/content/docs/advance-options/verification-options.mdx b/content/docs/advance-options/verification-options.mdx new file mode 100644 index 0000000..82f06cf --- /dev/null +++ b/content/docs/advance-options/verification-options.mdx @@ -0,0 +1,17 @@ +--- +title: Verification Options +description: Customize the default verification flow with Reclaim Protocol's InApp SDKs +--- + +import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; +import { Accordion, Accordions } from 'fumadocs-ui/components/accordion'; + +## Options API + +| Prop | Type | Description | +| ---------------------------------------------- | -------------------------------------- | ----------------------------------------------------------------------------- | +| **`canDeleteCookiesBeforeVerificationStarts`** | boolean | This is enabled by default. Set false to persist sessions storage for the user. (This will be replaced with `canClearWebStorage` in an upcoming update) | +| **`canUseAttestorAuthenticationRequest`** | boolean | Enable the use of authentication request when starting a verification | +| **`claimCreationType`** | 'standalone' \| 'meChain' | The type of claim creation to use. Defaults to 'standalone'. | +| **`canAutoSubmit`** | boolean | Whether to automatically submit the proof after generation. Defaults to true. When false, a prompt to submit is shown to the user. | +| **`isCloseButtonVisible`** | boolean | Whether the close button is visible in the verification screen. Defaults to true. | diff --git a/content/docs/inapp-sdks/verification.mdx b/content/docs/advance-options/verification.mdx similarity index 100% rename from content/docs/inapp-sdks/verification.mdx rename to content/docs/advance-options/verification.mdx diff --git a/content/docs/ai-agent/meta.json b/content/docs/ai-agent/meta.json index b2bb3f1..030b8ef 100644 --- a/content/docs/ai-agent/meta.json +++ b/content/docs/ai-agent/meta.json @@ -1,4 +1,4 @@ { - "title": "AI Agent", + "title": "A2A & MCP", "pages": ["quickstart"] } \ No newline at end of file diff --git a/content/docs/android-kotlin/installation.mdx b/content/docs/android-kotlin/installation.mdx new file mode 100644 index 0000000..ba24987 --- /dev/null +++ b/content/docs/android-kotlin/installation.mdx @@ -0,0 +1,68 @@ +--- +title: Installation +description: Integrate Reclaim Protocol into Android Native Applications. +--- + +import { BadgeGroup } from '@/app/components/badge'; + + + +## Prerequisites + +- An Android application source code (Support for Android 5.0 or later). +- An Android device or emulator running Android 5.0 or later. +- A Reclaim account where you've created an app and have the app id, app secret. +- A provider id that you've added to your app in Reclaim Devtools. + + +## Installation + +Add the following repositories to your `settings.gradle` file's repositories block or at the end of settings.gradle: + +```groovy +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) + String flutterStorageUrl = System.env.FLUTTER_STORAGE_BASE_URL ?: "https://storage.googleapis.com" + String reclaimStorageUrl = System.env.RECLAIM_STORAGE_BASE_URL ?: "https://reclaim-inapp-sdk.s3.ap-south-1.amazonaws.com/android/0.3.0/repo" + repositories { + google() + mavenCentral() + maven { + url "$reclaimStorageUrl" + } + maven { + url "$flutterStorageUrl/download.flutter.io" + } + } +} +``` + +You can replace the version mentioned in the url of `reclaimStorageUrl` with the version of SDK you're using. Latest is `0.3.0`. + +Some projects may require you to add the repositories to the root `build.gradle` file or your app-level `build.gradle` file's allprojects section. + +Next, add the following to your app level `build.gradle` file: + +```groovy +implementation "org.reclaimprotocol:inapp_sdk:0.3.0" +``` + +Add the following to your app level `AndroidManifest.xml` file under the `` tag: + +```xml + + + +``` + diff --git a/content/docs/android-kotlin/meta.json b/content/docs/android-kotlin/meta.json new file mode 100644 index 0000000..f3f2bb4 --- /dev/null +++ b/content/docs/android-kotlin/meta.json @@ -0,0 +1,7 @@ +{ + "title": "Android SDK", + "pages": [ + "installation", + "usage" + ] +} \ No newline at end of file diff --git a/content/docs/android-kotlin/usage.mdx b/content/docs/android-kotlin/usage.mdx new file mode 100644 index 0000000..83c291d --- /dev/null +++ b/content/docs/android-kotlin/usage.mdx @@ -0,0 +1,71 @@ +--- +title: Usage +description: Reclaim Protocol's InApp Android SDK for ZK proof generations for requests with an in-app experience of web verification +--- + +## Usage + +To use ReclaimInAppSdk in your project, follow these steps: + +1. Import the ReclaimInAppSdk module into your Kotlin/Java file. + +```kotlin +import org.reclaimprotocol.inapp_sdk.ReclaimVerification +``` + +2. Create a request object. + +```kotlin +val request = ReclaimVerification.Request( + appId = "YOUR_APP_ID", + secret = "YOUR_APP_SECRET", + providerId = "YOUR_PROVIDER_ID" + ) +``` + +Or if you have added the APP_ID and APP_SECRET metadata to your AndroidManifest.xml file, you can create the request object using the `ReclaimVerification.Request.fromManifestMetaData` method. + +```kotlin + val request = ReclaimVerification.Request.fromManifestMetaData( + context = context, + providerId = "YOUR_PROVIDER_ID" + ) +``` + +3. Start the verification flow. + + +```kotlin +ReclaimVerification.startVerification( + context = context, + request = request, + handler = object : ReclaimVerification.ResultHandler { + override fun onException(exception: ReclaimVerification.ReclaimVerificationException) { + Log.e("MainActivity", "Something went wrong", exception) + val reason = when (exception) { + is ReclaimVerification.ReclaimVerificationException.Failed -> "Failed because: ${exception.reason}" + is ReclaimVerification.ReclaimVerificationException.Cancelled -> "Verification cancelled" + is ReclaimVerification.ReclaimVerificationException.Dismissed -> "Dismissed by user" + is ReclaimVerification.ReclaimVerificationException.SessionExpired -> "Session expired" + } + Log.d("MainActivity", "reason: $reason") + } + + override fun onResponse(response: ReclaimVerification.Response) { + Log.d("MainActivity", response.toString()) + } + } +) +``` + +The returned result `ReclaimVerification.ResultHandler.onResponse` in is a `ReclaimVerification.Response` object. This object contains a response that has proofs, exception, and the sessionId if the verification is successful. + +If the verification is cancelled or failed, the handler's `ReclaimVerification.ResultHandler.onException` method is called with a `ReclaimVerification.ReclaimVerificationException` object. + +## Example + +- See the [Reclaim Compose Example - Android](https://github.com/reclaimprotocol/reclaim-inapp-android-sdk/tree/main/example/README.md) for a complete example of how to use the SDK in an Android application. + + +## Advanced Usage +For more usage options see [Advance Options guide](/advance-options/advance-options) diff --git a/content/docs/api-key.mdx b/content/docs/api-key.mdx new file mode 100644 index 0000000..d4cfc38 --- /dev/null +++ b/content/docs/api-key.mdx @@ -0,0 +1,39 @@ +--- +title: Get an API key +description: For all the SDKs mentioned on this docs page, you need an `APP_ID` and `APP_SECRET` +--- + +For being able to use Reclaim Protocol, you need to have 3 variables handy. + +## 0. Register +First, head to the [Reclaim Protocol Dev Tool](https://dev.reclaimprotocol.org). +Create an account here if you haven't already. + +## 1. Create an Application +Head to [My Applicatons](https://dev.reclaimprotocol.org/my-applications) from the left navigation bar. Here, tap on [Create Application](https://dev.reclaimprotocol.org/application-creation). + +Provide the application name, description and upload a logo. +This is the information that will be presented to the user when they are generating the proof, to maintain continuity with your brand. + +### Copy your Application ID and secret +Once you create the application, you will be shown the Application ID and Application Secret. +Be sure to copy them into your `.env` file immediately. + + + You will not be able to see the Application Secret once you leave this screen. + + +## 2. Add providers +Once you have created the application, you will have to add providers that are supported by this application. You will NOT be able to generate proofs for providers that are not already added to your application. + +Open your application `https://dev.reclaimprotocol.org/my-applications/[YOUR APP_ID]` + +Here you can tap on `Add Provider` + +Search for the providers you want to add and click on it to add it to the list. +Once you have added all your providers, hit Update Providers. + +After adding the providers, you can copy the `provider ID` and keep them handy. + +## 3. Integrate your SDK +Now, you can head over to the integration guide for your platform - where you can paste these values to get the application up and running! diff --git a/content/docs/backend/best-practices.mdx b/content/docs/backend/best-practices.mdx deleted file mode 100644 index ec37f1d..0000000 --- a/content/docs/backend/best-practices.mdx +++ /dev/null @@ -1,51 +0,0 @@ ---- -title: Best Practices -description: Welcome to our best practices guide for backend developers! This guide will help you use the Reclaim Protocol JavaScript SDK securely and efficiently in your Node.js server applications. ---- - -import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; - -# Backend Best Practices - -This guide outlines the best practices for implementing Reclaim Protocol in your backend applications, covering both JavaScript and Python implementations. - -## Protect Your Application Secret -It's always recommended to store your `APPLICATION_SECRET` securely on your backend - - - - ```javascript - // Store secrets securely - const APP_SECRET = process.env.RECLAIM_APP_SECRET; - const APP_ID = process.env.RECLAIM_APP_ID; - - // Validate proofs before processing - const isValid = await verifyProof(proof); - if (!isValid) { - throw new Error('Invalid proof'); - } - ``` - - - ```python - # Store secrets securely - APP_SECRET = os.environ.get("RECLAIM_APP_SECRET") - APP_ID = os.environ.get("RECLAIM_APP_ID") - - # Validate proofs before processing - is_valid = await verify_proof(proof) - if not is_valid: - raise ValueError("Invalid proof") - ``` - - - - - Never expose your Application Secret in public repositories or client-side code. This is crucial for maintaining the security of your application. - - -1. Store your `APP_SECRET` securely using environment variables. -2. Use a package like `dotenv` to manage your environment variables. - - -Remember to always refer to the latest SDK documentation for specific version requirements and updates. \ No newline at end of file diff --git a/content/docs/backend/meta.json b/content/docs/backend/meta.json deleted file mode 100644 index 33b1d45..0000000 --- a/content/docs/backend/meta.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "title": "Backend SDKs", - "pages": ["installation", "backend-example","best-practices" ] -} \ No newline at end of file diff --git a/content/docs/flutter/best-practices.mdx b/content/docs/flutter/best-practices.mdx deleted file mode 100644 index c783b6e..0000000 --- a/content/docs/flutter/best-practices.mdx +++ /dev/null @@ -1,150 +0,0 @@ ---- -title: Best Practices -description: Welcome to our best practices guide for integrating the Reclaim SDK into your Flutter application! Following these recommendations will help you implement Reclaim Protocol efficiently and securely. ---- - -## Best Practices for Reclaim SDK Integration - -### Security Best Practices - -### 1. Protect Sensitive Information - - - Never expose your Application Secret in your Flutter app's source code or public repositories. A compromised Application Secret can lead to unauthorized access and potential security breaches. - - -Key security measures: -- Store your `APP_SECRET` securely on your backend server -- Utilize environment variables or secure storage solutions for sensitive credentials like `APP_ID` -- Implement secret rotation policies where applicable - -### 2. Secure Communication Protocols - -Implement end-to-end encrypted communication: -- Use HTTPS for all network communications -- Verify SSL/TLS certificates -- Implement certificate pinning for additional security - -### 3. User Authentication & Authorization - -Implement robust user authentication: -- Use industry-standard authentication protocols -- Implement role-based access control (RBAC) -- Regularly validate user sessions -- Monitor and log authentication attempts - -### Implementation Guidelines - -### 1. Error Handling Strategy - -Implement comprehensive error handling to enhance reliability and user experience: - -```dart -try { - final proofRequestObject = await ReclaimProofRequest.init(appId, appSecret, providerId); - // Call other methods on proofRequestObject -} catch (e) { - // Handle error - print('Error creating proof request: $e'); - // Show user-friendly error message -} -``` - -### 2. SDK Maintenance - - - Regular SDK updates are crucial for maintaining security and accessing new features. Schedule periodic updates as part of your maintenance routine. - - -Update your dependencies using: - -```bash -flutter pub upgrade -``` - -### Performance Optimization - -### 1. Asynchronous Programming - -Implement efficient asynchronous operations to maintain UI responsiveness: - -```dart -Future initiateProofRequest() async { - setState(() => _isLoading = true); - try { - final proofRequest = await ReclaimProofRequest.init(appId, appSecret, providerId); - final result = await proofRequest.getRequestUrl(); - setState(() { - _proofResult = result; - _isLoading = false; - }); - } catch (e) { - setState(() => _isLoading = false); - // Handle error - } -} -``` - -### Quality Assurance - -### 1. Testing Strategy -Implement a comprehensive testing approach: -- Unit tests for core functionality -- Widget tests for UI components -- Integration tests for end-to-end workflows -- Performance testing under various conditions - -### 2. Monitoring and Debugging - -Utilize Flutter DevTools for: -- Performance profiling -- Memory leak detection -- Network request monitoring -- UI rendering analysis - - - Implement structured logging and crash reporting to facilitate troubleshooting and maintain application reliability. - - -### User Experience Enhancement - -### 1. User Guidance -- Provide clear, step-by-step instructions -- Include contextual help where needed -- Use progressive disclosure for complex operations - -### 2. Loading State Management - -Implement informative loading states: - -```dart -if (_isLoading) { - return CircularProgressIndicator(); -} else { - return ProofRequestResult(result: _proofResult); -} -``` - -### 3. Error Recovery -- Implement automatic retry mechanisms -- Provide clear error messages -- Offer alternative paths when operations fail - -### 4. UI Implementation - -Create an intuitive interface for proof requests: - -```dart -ElevatedButton( - onPressed: _initiateProofRequest, - child: Text('Initiate Proof Request'), -) -``` - -### Conclusion - -Following these best practices ensures a secure, efficient, and user-friendly implementation of the Reclaim SDK in your Flutter application. Regular reviews and updates of these practices will help maintain the quality and security of your integration. - -For additional support and updates, refer to the official Reclaim documentation and community resources. - -Happy coding with Reclaim! diff --git a/content/docs/flutter/flutter-example.mdx b/content/docs/flutter/flutter-example.mdx deleted file mode 100644 index 9fa25f8..0000000 --- a/content/docs/flutter/flutter-example.mdx +++ /dev/null @@ -1,178 +0,0 @@ ---- -title: Example -description: This guide will walk you through the fundamental steps to integrate Reclaim's proof verification system into your Flutter application. ---- - -## Prerequisites - -Before you begin integrating the Reclaim SDK into your Flutter application, ensure you have: - -- Installed the Reclaim SDK (see [Installation Guide](./installation)) -- Obtained your credentials from the [Reclaim Developer Portal](https://dev.reclaimprotocol.org/): - - Application ID - - Application Secret - - Provider ID - - - Security Notice: Never expose your Application Secret in client-side code. This credential should be kept secure and only used in server-side operations. - - -## Implementation Guide - -### 1. Import Required Dependencies - -Start by importing the necessary packages in your Dart file: - -```dart -import 'package:flutter/material.dart'; -import 'package:reclaim_sdk/reclaim.dart'; -import 'package:reclaim_sdk/utils/interfaces.dart'; -import 'package:reclaim_sdk/utils/types.dart'; -import 'package:url_launcher/url_launcher.dart'; -``` - -### 2. SDK Initialization - -Initialize the Reclaim SDK with your credentials: - -```dart -Future _initializeProofRequest() async { - final reclaimProofRequest = await ReclaimProofRequest.init( - "YOUR_APP_ID", // Replace with your actual Application ID - "YOUR_APP_SECRET", // Replace with your actual Application Secret - "YOUR_PROVIDER_ID", // Replace with your actual Provider ID - ); - - return reclaimProofRequest; -} -``` - - - Replace the placeholder credentials with your actual values obtained from the Reclaim Developer Portal. - - -### 3. Generate Verification Request URL - -Create a URL that users will use to initiate the proof request process. This URL redirects users to the Reclaim Verifier App through either an app clip or instant app flow: - -```dart -Future _generateRequestUrl(ReclaimProofRequest request) async { - final requestUrl = await request.getRequestUrl(); - print('Request URL: $requestUrl'); - return requestUrl; -} -``` - -### 4. URL Launch Implementation - - - Add the `url_launcher` package to your project by including it in your `pubspec.yaml`: - -```yaml -dependencies: - url_launcher: ^6.0.20 -``` - - -Implement the URL launcher to open the verification request in an external browser: - -```dart -Future _launchUrl(String url) async { - if (await canLaunchUrl(Uri.parse(url))) { - final launched = await launchUrl( - Uri.parse(url), - mode: LaunchMode.externalApplication, - ); - if (launched) { - setState(() => _status = 'Session started. Waiting for proof...'); - } else { - throw 'Could not launch $url'; - } - } else { - throw 'Could not launch $url'; - } -} -``` - -### 5. Verification Session Management - -Implement the verification session handlers: - -```dart -Future _startVerificationSession(ReclaimProofRequest request) async { - await request.startSession( - onSuccess: _handleProofSuccess, - onError: _handleProofError, - ); -} - -void _handleProofSuccess(dynamic proof) { - print('Proof received: $proof'); - var proofDataValue = ''; - if (proof is String) { - // Handle custom callback URL response - proofDataValue = proof; - } else { - if (proof is List) { - /* - when using provider with multiple proofs, we get an array of proofs - we need to extract the claim data from each proof in a variable and then add it to the proofDataValue - */ - var allProofs = ''; - for (var proof in proof) { - allProofs += '${proof.claimData.context}\n\n'; - } - proofDataValue = - 'Extracted data: $allProofs\n\nFull proof: ${proof.toString()}'; - } else { - /* - when using provider with a single proof, we get a single proof object - we need to extract the claim data from the proof object and then add it to the proofDataValue - */ - proofDataValue = - 'Extracted data: ${proof.claimData.context}\n\nFull proof: ${proof.toString()}'; - } - } - setState(() { - _status = 'Proof received!'; - _proofData = proofDataValue; - }); -} - -void _handleProofError(Exception error) { - _handleError('Error in proof generation', error); -} -``` - -For detailed information about the proof object structure, see the [Advance Options](../advance-options/advance-options#understanding-the-proof-structure) documentation. - -[Rest of the documentation remains unchanged as it contains important implementation details and code examples] - -## Key Concepts and Best Practices - -1. **Security Considerations** - - Keep credentials secure - - Implement proper error handling - - Use backend validation for sensitive operations - -2. **User Experience** - - Provide clear feedback during the verification process - - Handle edge cases gracefully - - Implement proper loading states - -3. **Error Handling** - - Implement comprehensive error handling - - Provide meaningful error messages - - Log errors appropriately for debugging - -## Next Steps - -1. Explore [Advance Options](../advance-options/advance-options) options for customization -2. Review [Best Practices](./best-practices) for optimal implementation -3. Join our [Telegram community](https://t.me/protocolreclaim) for support and updates - - - While this guide covers basic implementation, production applications should include additional error handling, state management, and integration with your application's architecture. - - -Need help? Join our developer community or refer to our comprehensive documentation for more detailed guidance. diff --git a/content/docs/flutter/fullstack-example.mdx b/content/docs/flutter/fullstack-example.mdx deleted file mode 100644 index aa3bfc1..0000000 --- a/content/docs/flutter/fullstack-example.mdx +++ /dev/null @@ -1,206 +0,0 @@ ---- -title: Fullstack Example -description: This guide demonstrates how to integrate the Reclaim Protocol Flutter SDK into a fullstack application. We'll focus on the frontend implementation and how it interacts with a backend. ---- - -## Backend Implementation - -For a detailed backend implementation using Node.js and Express, please refer to the [Backend Example](/backend/backend-example). - - - The backend example provides a comprehensive guide on setting up a server that generates the SDK configuration and handles proof verification. - - -## Frontend Implementation - -### Prerequisites -- Flutter development environment set up -- Basic understanding of async operations in Dart -- The following packages installed in your `pubspec.yaml`: - - `reclaim_sdk` - - `url_launcher` - - `http` - -### Implementation Overview -Below is a complete implementation showing how to integrate the Reclaim SDK into your Flutter application. This example demonstrates fetching the SDK configuration from your backend and handling the verification process: - -```dart -import 'package:flutter/material.dart'; -import 'package:reclaim_sdk/reclaim.dart'; -import 'package:reclaim_sdk/utils/interfaces.dart'; -import 'package:reclaim_sdk/utils/types.dart'; -import 'package:url_launcher/url_launcher.dart'; -import 'package:http/http.dart' as http; -import 'dart:convert'; - -class ReclaimExample extends StatefulWidget { - @override - _ReclaimExampleState createState() => _ReclaimExampleState(); -} - -class _ReclaimExampleState extends State { - String _status = ''; - String _proofData = ''; - - Future _fetchReclaimConfig() async { - final response = await http.get(Uri.parse('https://your-backend.com/reclaim/generate-config')); - if (response.statusCode == 200) { - final jsonData = json.decode(response.body); - final reclaimProofRequest = await ReclaimProofRequest.fromJsonString(jsonData['reclaimProofRequestConfig']); - return reclaimProofRequest; - } else { - throw Exception('Failed to fetch Reclaim configuration'); - } - } - - Future _startVerificationSession(ReclaimProofRequest request) async { - await request.startSession( - onSuccess: _handleProofSuccess, - onError: _handleProofError, - ); - } - - void _handleProofSuccess(Proof proof) { - print('Proof received: $proof'); - // check if proof is of type String - var proofDataValue = ''; - if (proof is String) { - // For custom callback URL, the proof is a just a string message suggesting the proof is successfully sent and the user should check their backend for the proof - proofDataValue = proof; - } else { - if (proof is List) { - /* - when using provider with multiple proofs, we get an array of proofs - we need to extract the claim data from each proof in a variable and then add it to the proofDataValue - */ - var allProofs = ''; - for (var proof in proof) { - allProofs += '${proof.claimData.context}\n\n'; - } - proofDataValue = - 'Extracted data: $allProofs\n\nFull proof: ${proof.toString()}'; - } else { - /* - when using provider with a single proof, we get a single proof object - we need to extract the claim data from the proof object and then add it to the proofDataValue - */ - proofDataValue = - 'Extracted data: ${proof.claimData.context}\n\nFull proof: ${proof.toString()}'; - } - } - setState(() { - _status = 'Proof received!'; - _proofData = proofDataValue; - }); - } - - void _handleProofError(Exception error) { - _handleError('Error in proof generation', error); - } - - void _handleError(String message, dynamic error) { - print('$message: $error'); - setState(() => _status = '$message: ${error.toString()}'); - } - - Future _launchUrl(String url) async { - if (await canLaunchUrl(Uri.parse(url))) { - final launched = await launchUrl( - Uri.parse(url), - mode: LaunchMode.externalApplication, - ); - if (launched) { - setState(() => _status = 'Session started. Waiting for proof...'); - } else { - throw 'Could not launch $url'; - } - } - } - - Future startReclaimSession() async { - try { - print('Starting Reclaim session'); - final reclaimProofRequest = await _fetchReclaimConfig(); - final requestUrl = await reclaimProofRequest.getRequestUrl(); - await _launchUrl(requestUrl); - await _startVerificationSession(reclaimProofRequest); - } catch (error) { - _handleError('Error starting Reclaim session', error); - } - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar(title: const Text('Reclaim SDK Demo')), - body: Padding( - padding: const EdgeInsets.all(16.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - ElevatedButton( - onPressed: startReclaimSession, - child: const Text('Start Reclaim Session'), - ), - const SizedBox(height: 20), - Text(_status, style: const TextStyle(fontWeight: FontWeight.bold)), - const SizedBox(height: 20), - if (_proofData.isNotEmpty) - Expanded( - child: SingleChildScrollView( - child: Text(_proofData), - ), - ), - ], - ), - ), - ); - } -} -``` - -For detailed information about the `proof` object structure and properties, refer to the [Advance Configuration](../advance-options/advance-options#understanding-the-proof-structure) section. - - - This implementation provides a streamlined approach to integrating Reclaim SDK. It handles configuration fetching, initialization, and basic error management while maintaining a clean user interface. - - -## Implementation Steps - -1. **Backend Setup** - - Configure your backend server following the [Backend Example](/backend/backend-example) - - Ensure your endpoints are properly secured and accessible - -2. **Frontend Integration** - - Copy the provided code into your Flutter application - - Update the backend URL in `_fetchReclaimConfig()` to match your server - - Implement any additional error handling specific to your use case - -3. **Testing** - - Test the integration in both development and production environments - - Verify error handling and edge cases - - Ensure proper handling of network connectivity issues - - - Replace 'https://your-backend.com/reclaim/generate-config' with your actual backend endpoint URL before deploying. - - -## Enhancement Suggestions - -1. **User Experience Improvements** - - Add loading indicators during network operations - - Implement retry mechanisms for failed operations - - Add clear error messages for users - -2. **Security Considerations** - - Implement proper authentication mechanisms - - Secure your backend endpoints - - Handle sensitive data appropriately - -3. **Performance Optimization** - - Cache configuration where appropriate - - Implement proper state management - - Optimize network requests - -By following this implementation guide, you'll have a robust integration of the Reclaim Protocol in your Flutter application. For additional support or advanced options, refer to our documentation sections. diff --git a/content/docs/flutter/index.mdx b/content/docs/flutter/index.mdx deleted file mode 100644 index 036d323..0000000 --- a/content/docs/flutter/index.mdx +++ /dev/null @@ -1,83 +0,0 @@ ---- -title: Flutter SDK -description: Welcome to the Reclaim Protocol Flutter SDK! This SDK allows you to seamlessly integrate Reclaim functionality into your Flutter applications for both Android and iOS. With our Flutter SDK, you can easily implement a secure process for users to prove their credentials from other websites without sharing sensitive information. ---- - -# Quick Start Guide: Reclaim Flutter SDK - -## Getting Started -Start building with Reclaim in just a few simple steps: - -1. [Installation](./flutter/installation) - - Set up the Reclaim Flutter SDK in your project - -2. [Flutter Example](./flutter/flutter-example) - - Learn core concepts and implementation basics - -## Understanding the Flow -Here's how Reclaim integrates with your Flutter application: - -```mermaid -graph TD - A[User Opens App] --> B[Create Reclaim Session] - B --> C[Generate Request URL] - C --> D[User Authentication] - D --> E[Proof Generation] - E --> F[Submit Proof] - F --> G[Verification] -``` - -1. **Initial Access**: User launches your Flutter application -2. **Session Initialization**: Your app creates a new Reclaim session -3. **URL Generation**: System generates a secure request URL -4. **Authentication Flow**: User authenticates on the target platform (e.g., Amazon.com) -5. **Proof Creation**: System generates a cryptographic proof on the user's device -6. **Proof Handling**: User submits the proof back to your application -7. **Validation**: Your app verifies the proof's authenticity - -## Implementation Options - -Choose the approach that best fits your needs: - -### Mobile-Only Implementation -✓ Best for: -- Quick prototypes -- MVP development -- Simple applications - -### Full Stack Implementation -✓ Recommended for: -- Production applications -- Enhanced security requirements -- Custom authentication needs - -## Practical Examples - -Explore our implementation guides: - -- [Fullstack Example](./flutter/fullstack-example) - Comprehensive guide for backend-integrated implementation - -## Advanced Features - -Take your implementation further: - -- [Advance Options](../advance-options/advance-options) - Detailed configuration options and customization - -- [Best Practices](./flutter/best-practices) - Optimization guidelines and recommended patterns - -## Support Resources - -Get help when you need it: - -### Community Support -- [Telegram Community](https://t.me/protocolreclaim) - Join discussions and get help -- [Website](https://reclaimprotocol.org) - Access documentation and resources - -### Stay Updated -- [Twitter](https://twitter.com/reclaimprotocol) - Latest updates and announcements -- [GitHub](https://github.com/reclaimprotocol/reclaim-flutter-sdk/) - Access source code and contribute - -Ready to start building? Let's dive into the installation process! diff --git a/content/docs/flutter/installation.mdx b/content/docs/flutter/installation.mdx index c2b2cd9..72cf886 100644 --- a/content/docs/flutter/installation.mdx +++ b/content/docs/flutter/installation.mdx @@ -1,78 +1,141 @@ --- title: Installation -description: Welcome to the first step in integrating Reclaim Protocol into your Flutter project! This guide will walk you through the installation process and help you get started quickly. +description: Flutter SDK for Reclaim Protocol --- -## Installing Reclaim Protocol SDK for Flutter + +The Reclaim Protocol SDK for Flutter (android & iOS) applications is ready and available upon request. Contact our team to discuss implementation details. + -### Prerequisites +A Flutter SDK for integrating Reclaim's verification system directly into your Flutter applications. This SDK allows you to verify user credentials and generate proofs in-app. -Before starting the installation, ensure you have the following requirements: +## Features -- Flutter SDK (2.0.0 or higher) - [Install Flutter](https://flutter.dev/docs/get-started/install) -- Dart SDK (2.12.0 or higher) - Included with Flutter installation -- Development Environment: - - Android Studio (recommended) with Flutter and Dart plugins, OR - - Visual Studio Code with Flutter and Dart extensions -- A working Flutter project +- In-app verification flow +- Customizable verification options +- ZK Proof generation +- Compatible when using Flutter "Add to App modules" in your native applications -### Installation Guide +## Prerequisites -### 1. Add Dependencies +- An Android application source code (Support for Android 5.0 or later). +- An Android device or emulator running Android 5.0 or later. +- A Reclaim account where you've created an app and have the app id, app secret. +- A provider id that you've added to your app in Reclaim Devtools. -Add the Reclaim Protocol SDK to your project's dependencies in the `pubspec.yaml` file: +## Get an API Key +Setup your project using the [Get API Key guide](/api-key). + +## Installation + +Add the following to your `pubspec.yaml`: ```yaml dependencies: - flutter: - sdk: flutter - reclaim_sdk: ^latest_version # Replace with the latest version + reclaim_inapp_flutter_sdk: ^latest_version +``` + + +## Usage + +### Basic Setup + +1. Import the SDK in your Dart file: + +```dart +import 'package:reclaim_inapp_flutter_sdk/reclaim_inapp_flutter_sdk.dart'; ``` -### 2. Install Dependencies +2. Initialize the SDK with your app credentials: + +Following is an exmaple. -Execute the following command in your project's root directory: +```dart +const String appId = String.fromEnvironment('APP_ID'); +const String appSecret = String.fromEnvironment('APP_SECRET'); +const String providerId = String.fromEnvironment('PROVIDER_ID'); +``` + +### Starting Verification -```bash -flutter pub get +```dart +final sdk = ReclaimInAppSdk.of(context); +final proofs = await sdk.startVerification( + ReclaimVerificationRequest( + appId: appId, + providerId: providerId, + secret: appSecret, + sessionInformation: ReclaimSessionInformation.empty(), + contextString: '', + parameters: {}, + claimCreationType: ClaimCreationType.standalone, + ), +); ``` -### 3. Verify Installation +### Configuration Options + +The `ReclaimVerificationRequest` supports the following options: -To confirm successful installation: +- `appId`: Your Reclaim application ID +- `providerId`: The ID of the provider you want to verify against +- `secret`: Your application secret (optional if using session information) +- `sessionInformation`: Session information for authentication +- `contextString`: Additional context for the verification +- `parameters`: Custom parameters for the verification +- `claimCreationType`: Type of claim creation (standalone or meChain) +- `autoSubmit`: Whether to auto-submit the verification +- `hideCloseButton`: Whether to hide the close button +- `webhookUrl`: URL for webhook notifications +- `verificationOptions`: Additional verification options -1. Check your `pubspec.lock` file for the `reclaim_flutter_sdk` entry -2. Verify the version matches your specified version -3. Ensure no error messages appeared during installation +### Error Handling -### 4. Import the SDK +The SDK throws specific exceptions that you can handle: -Add the following import statement to your Dart files where you'll use the SDK: +```dart +try { + final proofs = await sdk.startVerification(request); +} on ReclaimExpiredSessionException { + // Handle expired session +} on ReclaimVerificationManualReviewException { + // Handle manual review case +} catch (error) { + // Handle other errors if required +} +``` + +### Pre-warming + +For better performance, you can pre-warm the SDK: ```dart -import 'package:reclaim_sdk/reclaim.dart'; +void main() async { + WidgetsFlutterBinding.ensureInitialized(); + ReclaimInAppSdk.preWarm(); + runApp(MyApp()); +} ``` -### Validation and Next Steps +## Example + +Check out the [example](example/lib/main.dart) for a complete implementation. -### Quick Validation -To verify everything is working correctly: -1. The project should compile without errors -2. The SDK should be recognized in your IDE -3. Auto-completion should work for SDK components +## Environment Variables -### Further Steps +The SDK requires the following environment variables: -Now that you've installed the SDK, you can: +- `APP_ID`: Your Reclaim application ID +- `APP_SECRET`: Your application secret +- `PROVIDER_ID`: The ID of the provider to verify against -1. Explore the [Flutter Example](./flutter-example) for implementation samples -2. Configure advanced settings through our [Advance Options](../advance-options/advance-options) guide -3. Follow our [Best Practices](./best-practices) for optimal integration +You can provide these values using: -### Support and Resources +- Dart Define Env file: `--dart-define-from-file=./.env` +- Hardcoded values (not recommended for production) -Need help? Access these resources: -- [FAQ](https://reclaimprotocol.org/faq) for common questions -- [Telegram Community](https://t.me/protocolreclaim) for direct support +### Stay Updated -**Note**: Keep your SDK version updated for the latest features and security improvements. \ No newline at end of file +- Join our [Telegram community](https://t.me/protocolreclaim) +- Follow [@reclaimprotocol](https://twitter.com/reclaimprotocol) on Twitter +- Watch our [GitHub repository](https://github.com/reclaimprotocol) diff --git a/content/docs/flutter/meta.json b/content/docs/flutter/meta.json index da679dc..9f8a1cf 100644 --- a/content/docs/flutter/meta.json +++ b/content/docs/flutter/meta.json @@ -1,4 +1,4 @@ { "title": "Flutter SDK", - "pages": ["installation", "flutter-example", "fullstack-example", "best-practices"] + "pages": ["installation", "usage"] } \ No newline at end of file diff --git a/content/docs/inapp-sdks/installation/flutter.mdx b/content/docs/flutter/usage.mdx similarity index 65% rename from content/docs/inapp-sdks/installation/flutter.mdx rename to content/docs/flutter/usage.mdx index 96269e3..8fd95ca 100644 --- a/content/docs/inapp-sdks/installation/flutter.mdx +++ b/content/docs/flutter/usage.mdx @@ -1,44 +1,7 @@ --- -title: Flutter -description: Available upon request - Reclaim Protocol integration for Flutter applications +title: Usage +description: Flutter SDK for Reclaim Protocol --- - -# Get Started - - -The Reclaim Protocol SDK for Flutter (android & iOS) applications is ready and available upon request. Contact our team to discuss implementation details. - - -A Flutter SDK for integrating Reclaim's verification system directly into your Flutter applications. This SDK allows you to verify user credentials and generate proofs in-app. - -## Features - -- In-app verification flow -- Customizable verification options -- ZK Proof generation -- Compatible when using Flutter "Add to App modules" in your native applications - -## Prerequisites - -- An Android application source code (Support for Android 5.0 or later). -- An Android device or emulator running Android 5.0 or later. -- A Reclaim account where you've created an app and have the app id, app secret. -- A provider id that you've added to your app in Reclaim Devtools. - -## Installation - -Add the following to your `pubspec.yaml`: - -```yaml -dependencies: - reclaim_inapp_flutter_sdk: ^latest_version -``` - - -## Usage - -### Basic Setup - 1. Import the SDK in your Dart file: ```dart @@ -115,11 +78,6 @@ void main() async { runApp(MyApp()); } ``` - -## Example - -Check out the [example](example/lib/main.dart) for a complete implementation. - ## Environment Variables The SDK requires the following environment variables: @@ -133,8 +91,6 @@ You can provide these values using: - Dart Define Env file: `--dart-define-from-file=./.env` - Hardcoded values (not recommended for production) -### Stay Updated +## Example -- Join our [Telegram community](https://t.me/protocolreclaim) -- Follow [@reclaimprotocol](https://twitter.com/reclaimprotocol) on Twitter -- Watch our [GitHub repository](https://github.com/reclaimprotocol) +Check out the [example](example/lib/main.dart) for a complete implementation. diff --git a/content/docs/hackathon/index.mdx b/content/docs/hackathon/index.mdx deleted file mode 100644 index 2f0b00e..0000000 --- a/content/docs/hackathon/index.mdx +++ /dev/null @@ -1,30 +0,0 @@ ---- -title: Reclaim Protocol Infinite Hackathon -description: The Reclaim Protocol Infinite Hackathon encourages submissions from developers building on Reclaim Protocol and ZKFetch at any hackathon happening anywhere at any time now and in the future, both in-person and online. ---- - -Submit your project [here](https://docs.google.com/forms/d/e/1FAIpQLSfTISBBtJsCralsmlxYbPZfc6p-86WTTOL9hdjySBiCVeqSig/viewform?usp=header). - -If you're in the process of hacking, join our Reclaim Protocol Developer Community [here](https://t.me/protocolreclaim)! - -![Reclaim Protocol Infinite Hackathon](/assets/hackathon.webp) - -*If you are building on Reclaim Protocol as part of your hackathon project, you are qualified to submit and be eligible for the following prize.* - -### Prize - -Any new application that integrates Reclaim Protocol or ZKFetch to access verified data from any website. - -Following the initial prize, projects will be eligible for **retrospective grants** based on the number of verifications achieved. These grants will reward the real-world impact and adoption of the application over time. - -### Judging Criteria - -- **Uniqueness of Solution:** Products/Ideas that are possible specifically because of Reclaim will be prioritized. When asked, "How would I have created the same solution without Reclaim?" the answer should be "It wouldn't have been possible." -- **Functionality:** Teams with end-to-end working prototypes and demos will be prioritized. - -### Eligibility Criteria - -- Participants of hackathons that are already hosted by, or that include prizes offered by, Reclaim Protocol are not eligible. -- Projects must be submitted within 14 days of original hackathon deadline. -- Project code must be open source. -- Full Hackathon Terms of Service are available [here](https://www.notion.so/187275b816cb80eabb7ffacf7f2eccff?pvs=21). \ No newline at end of file diff --git a/content/docs/hackathon/meta.json b/content/docs/hackathon/meta.json deleted file mode 100644 index 0fa0759..0000000 --- a/content/docs/hackathon/meta.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "title": "Reclaim Protocol Infinite Hackathon" -} \ No newline at end of file diff --git a/content/docs/inapp-sdks/advanced/intro.mdx b/content/docs/inapp-sdks/advanced/intro.mdx deleted file mode 100644 index 9e94be2..0000000 --- a/content/docs/inapp-sdks/advanced/intro.mdx +++ /dev/null @@ -1,14 +0,0 @@ ---- -title: Usage -description: Documentation for advanced usage of Reclaim InApp SDKs. ---- - -# More about Reclaim InApp SDKs - -The InApp SDKs also allows more functionalities, like overriding several configurations used in the verification process by the SDK. - -## Table of Contents - -* [Verification Options](./verification-options) -* [Attestor Auth](./attestor-auth) -* [Overrides](./overrides) diff --git a/content/docs/inapp-sdks/advanced/meta.json b/content/docs/inapp-sdks/advanced/meta.json deleted file mode 100644 index 843415d..0000000 --- a/content/docs/inapp-sdks/advanced/meta.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "title": "Usage", - "pages": [ - "intro", - "verification-options", - "attestor-auth", - "overrides" - ] -} \ No newline at end of file diff --git a/content/docs/inapp-sdks/installation/android.mdx b/content/docs/inapp-sdks/installation/android.mdx deleted file mode 100644 index 3dddc24..0000000 --- a/content/docs/inapp-sdks/installation/android.mdx +++ /dev/null @@ -1,164 +0,0 @@ ---- -title: Android -description: Reclaim Protocol's InApp Android SDK for ZK proof generations for requests with an in-app experience of web verification ---- - -import { BadgeGroup } from '@/app/components/badge'; - -# Get Started - - - -This SDK allows you to integrate Reclaim's in-app verification process into your Android application. - -## Prerequisites - -- An Android application source code (Support for Android 5.0 or later). -- An Android device or emulator running Android 5.0 or later. -- A Reclaim account where you've created an app and have the app id, app secret. -- A provider id that you've added to your app in Reclaim Devtools. - -## Example - -- See the [Reclaim Compose Example - Android](https://github.com/reclaimprotocol/reclaim-inapp-android-sdk/tree/main/example/README.md) for a complete example of how to use the SDK in an Android application. - -## Installation - -Add the following repositories to your `settings.gradle` file's repositories block or at the end of settings.gradle: - -```groovy -dependencyResolutionManagement { - repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) - String flutterStorageUrl = System.env.FLUTTER_STORAGE_BASE_URL ?: "https://storage.googleapis.com" - String reclaimStorageUrl = System.env.RECLAIM_STORAGE_BASE_URL ?: "https://reclaim-inapp-sdk.s3.ap-south-1.amazonaws.com/android/0.3.0/repo" - repositories { - google() - mavenCentral() - maven { - url "$reclaimStorageUrl" - } - maven { - url "$flutterStorageUrl/download.flutter.io" - } - } -} -``` - -You can replace the version mentioned in the url of `reclaimStorageUrl` with the version of SDK you're using. Latest is `0.3.0`. - -Some projects may require you to add the repositories to the root `build.gradle` file or your app-level `build.gradle` file's allprojects section. - -Next, add the following to your app level `build.gradle` file: - -```groovy -implementation "org.reclaimprotocol:inapp_sdk:0.3.0" -``` - -Add the following to your app level `AndroidManifest.xml` file under the `` tag: - -```xml - - - -``` - -## Usage - -To use ReclaimInAppSdk in your project, follow these steps: - -1. Import the ReclaimInAppSdk module into your Kotlin/Java file. - -```kotlin -import org.reclaimprotocol.inapp_sdk.ReclaimVerification -``` - -2. Create a request object. - -```kotlin -val request = ReclaimVerification.Request( - appId = "YOUR_APP_ID", - secret = "YOUR_APP_SECRET", - providerId = "YOUR_PROVIDER_ID" - ) -``` - -Or if you have added the APP_ID and APP_SECRET metadata to your AndroidManifest.xml file, you can create the request object using the `ReclaimVerification.Request.fromManifestMetaData` method. - -```kotlin - val request = ReclaimVerification.Request.fromManifestMetaData( - context = context, - providerId = "YOUR_PROVIDER_ID" - ) -``` - -3. Start the verification flow. - - -```kotlin -ReclaimVerification.startVerification( - context = context, - request = request, - handler = object : ReclaimVerification.ResultHandler { - override fun onException(exception: ReclaimVerification.ReclaimVerificationException) { - Log.e("MainActivity", "Something went wrong", exception) - val reason = when (exception) { - is ReclaimVerification.ReclaimVerificationException.Failed -> "Failed because: ${exception.reason}" - is ReclaimVerification.ReclaimVerificationException.Cancelled -> "Verification cancelled" - is ReclaimVerification.ReclaimVerificationException.Dismissed -> "Dismissed by user" - is ReclaimVerification.ReclaimVerificationException.SessionExpired -> "Session expired" - } - Log.d("MainActivity", "reason: $reason") - } - - override fun onResponse(response: ReclaimVerification.Response) { - Log.d("MainActivity", response.toString()) - } - } -) -``` - -The returned result `ReclaimVerification.ResultHandler.onResponse` in is a `ReclaimVerification.Response` object. This object contains a response that has proofs, exception, and the sessionId if the verification is successful. - -If the verification is cancelled or failed, the handler's `ReclaimVerification.ResultHandler.onException` method is called with a `ReclaimVerification.ReclaimVerificationException` object. - -For a complete example, see the [Reclaim Compose Example - Android](https://github.com/reclaimprotocol/reclaim-inapp-android-sdk/tree/main/example/README.md). - -## Advanced Usage - -### Overriding SDK Config - -You can customize the verification flow by overriding the default SDK configuration with `ReclaimVerification.setOverrides`. - -```kotlin -fun setOverrides() { - ReclaimVerification.setOverrides( - context = context, - appInfo = ReclaimOverrides.ReclaimAppInfo( - appName = "Overridden Example", - appImageUrl = "https://placehold.co/400x400/png" - ) - // Add other overrides here - ) { result -> - result - .onSuccess { - Log.d("MainActivity", "Reclaim Overrides set") - } - .onFailure { e -> - Log.e("MainActivity", "Could not set overrides", e) - } - } -} -``` - -Read more about overrides in [Reclaim InApp SDK Documentation | Overrides](./../advanced/overrides) diff --git a/content/docs/inapp-sdks/installation/meta.json b/content/docs/inapp-sdks/installation/meta.json deleted file mode 100644 index 3d9a7d1..0000000 --- a/content/docs/inapp-sdks/installation/meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "title": "Installation", - "pages": [ - "android", - "ios", - "react-native", - "ionic-capacitor", - "flutter", - "react-native-expo" - ] -} \ No newline at end of file diff --git a/content/docs/inapp-sdks/installation/react-native-expo.mdx b/content/docs/inapp-sdks/installation/react-native-expo.mdx deleted file mode 100644 index 152f428..0000000 --- a/content/docs/inapp-sdks/installation/react-native-expo.mdx +++ /dev/null @@ -1,16 +0,0 @@ ---- -title: React Native Expo -description: Available upon request - Reclaim Protocol integration for Expo-managed React Native applications ---- - -# React Native Expo SDK - - -The Reclaim Protocol SDK for Expo-managed React Native applications is available upon request. Contact our team to discuss implementation details. - - -### Stay Updated - -- Join our [Telegram community](https://t.me/protocolreclaim) -- Follow [@reclaimprotocol](https://twitter.com/reclaimprotocol) on Twitter -- Watch our [GitHub repository](https://github.com/reclaimprotocol) diff --git a/content/docs/inapp-sdks/installation/react-native.mdx b/content/docs/inapp-sdks/installation/react-native.mdx deleted file mode 100644 index fb6a4b9..0000000 --- a/content/docs/inapp-sdks/installation/react-native.mdx +++ /dev/null @@ -1,354 +0,0 @@ ---- -title: React Native -description: Reclaim Protocol's InApp React Native SDK for ZK proof generations for requests with an in-app experience of web verification ---- - -import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; -import { BadgeGroup } from '@/app/components/badge'; -import { Accordion, Accordions } from 'fumadocs-ui/components/accordion'; - -# Get Started - - - -This SDK allows you to integrate Reclaim's in-app verification process into your React Native application. - -## Prerequisites - -- A [Reclaim account](https://dev.reclaimprotocol.org/explore) where you've created an app and have the app id, app secret. -- A provider id that you've added to your app in [Reclaim Devtools](https://dev.reclaimprotocol.org/explore). - -Note: -- This SDK may not be compatible with React Native [Frameworks](https://reactnative.dev/architecture/glossary#react-native-framework) like Expo. -- To learn more about React Native apps without a framework, refer to the [React Native documentation](https://reactnative.dev/docs/getting-started-without-a-framework). - -## Example - -- See the [Reclaim Example - React Native](https://github.com/reclaimprotocol/reclaim-inapp-reactnative-sdk/tree/main/samples/example_new_arch) for a complete example of how to use the SDK in a React Native application. - -## Installation - -```package-install -npm install @reclaimprotocol/inapp-rn-sdk -``` - -#### Alternative: Install from git source - -```package-install -npm install git+https://github.com/reclaimprotocol/reclaim-inapp-reactnative-sdk.git -``` - -## Setup - -### Android Setup - -Add the following to your `android/app/src/main/AndroidManifest.xml` file under the `` tag: - -```xml - -``` - -add the following to the end of settings.gradle: - - -```groovy tabs="Groovy" -dependencyResolutionManagement { - repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) - String flutterStorageUrl = System.env.FLUTTER_STORAGE_BASE_URL ?: "https://storage.googleapis.com" - String reclaimStorageUrl = System.env.RECLAIM_STORAGE_BASE_URL ?: "https://reclaim-inapp-sdk.s3.ap-south-1.amazonaws.com/android/0.3.0/repo" - repositories { - google() - mavenCentral() - maven { - url "$reclaimStorageUrl" - } - maven { - url "$flutterStorageUrl/download.flutter.io" - } - } -} -``` - -```kotlin tabs="Kotlin" -dependencyResolutionManagement { - repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) - val flutterStorageUrl = System.env.FLUTTER_STORAGE_BASE_URL ?: "https://storage.googleapis.com" - val reclaimStorageUrl = System.env.RECLAIM_STORAGE_BASE_URL ?: "https://reclaim-inapp-sdk.s3.ap-south-1.amazonaws.com/android/0.3.0/repo" - repositories { - google() - mavenCentral() - maven("$reclaimStorageUrl") - maven("$flutterStorageUrl/download.flutter.io") - } -} -``` - - - -(Ignore if already added in `settings.gradle` from above) -or alternatively add the following repositories to the relevant repositories block: - - - -```groovy tabs="Groovy" -String flutterStorageUrl = System.env.FLUTTER_STORAGE_BASE_URL ?: "https://storage.googleapis.com" -String reclaimStorageUrl = System.env.RECLAIM_STORAGE_BASE_URL ?: "https://reclaim-inapp-sdk.s3.ap-south-1.amazonaws.com/android/0.3.0/repo" -// ... -maven { - url "$reclaimStorageUrl" -} -maven { - url "$flutterStorageUrl/download.flutter.io" -} -``` - -```kotlin tabs="Kotlin" -val flutterStorageUrl = System.env.FLUTTER_STORAGE_BASE_URL ?: "https://storage.googleapis.com" -val reclaimStorageUrl = System.env.RECLAIM_STORAGE_BASE_URL ?: "https://reclaim-inapp-sdk.s3.ap-south-1.amazonaws.com/android/0.3.0/repo" -// ... -maven("$reclaimStorageUrl") -maven("$flutterStorageUrl/download.flutter.io") -``` - - - -### iOS Setup - -1. Make sure to have a platform declaration for your project in your `Podfile` with version 13.0 or higher. - -```ruby -platform :ios, '13.0' # or platform :ios, min_ios_version_supported -``` - -Ignore if you already have this declaration in your `Podfile`. - -2. Add the following to your `Podfile` to override SDK dependency: - -- This step is only required when facing issues with the resolved pod dependency. -- You can override the version of dependency when you wish to use a specific version of the SDK. -- You can add a declaration in your `Podfile` to install the SDK from cocoapods, or from a specific git tag, head, commit, or branch. - - -```ruby tabs="Cocoapods (Recommended)" -# Cocoapods is the recommended way to install the SDK. -pod 'ReclaimInAppSdk', '~> 0.3.0' -``` - -```ruby tabs="Git Tag" -pod 'ReclaimInAppSdk', :git => 'https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git', :tag => '0.3.0' -``` - -```ruby tabs="Git Head" -pod 'ReclaimInAppSdk', :git => 'https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git' -``` - -```ruby tabs="Git Commit" -pod 'ReclaimInAppSdk', :git => 'https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git', :commit => '027e18b8b2365fd935e9e8585e31fa886c3af6ee' -``` - -```ruby tabs="Git Branch" -pod 'ReclaimInAppSdk', :git => 'https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git', :branch => 'main' -``` - - - -- After adding the dependency, your podfile may look like this: - -```ruby -platform :ios, '13.0' - -# ... some podfile content (removed for brevity) - -target 'InappRnSdkExample' do - config = use_native_modules! - - use_react_native!( - :path => config[:reactNativePath], - :app_path => "#{Pod::Config.instance.installation_root}/.." - ) - - # This is the line that you may need to add in your podfile. - pod 'ReclaimInAppSdk', '~> 0.3.0' - - pre_install do |installer| - system("cd ../../ && npx bob build --target codegen") - end - - # ... rest of the podfile. (removed for brevity) -``` - -3. Run `pod install` inside the `ios/` directory of your project. - -```sh -cd ios/ -pod install -``` - -#### Fixing performance issues on IOS physical devices - -Your app performance will be severely impacted when you run debug executable on a physical device. Fixing this requires a simple change in your Xcode project xcscheme. - - - - -1. Open your project in Xcode. -2. Click on the project target. -3. Click on the **Scheme** dropdown. - -Edit current xcscheme in Xcode - -4. Click on the **Edit Scheme** button. -5. Click on the **Run** tab. -6. Click on the **Arguments** tab and check the **Environment Variables** section. - -Enable Debug executable in Xcode - -7. Add the following environment variable: - - Key: `GODEBUG` - - Value: `asyncpreemptoff=1` -8. Click on the **Close** button in the dialog and build the project. -9. Run the app on a physical device. - - - - -This method is **not recommended** but could be useful if you don't want to add environment variables to the xcscheme. - -1. Open your project in Xcode. -2. Click on the project target. -3. Click on the **Scheme** dropdown. - -Edit current xcscheme in Xcode - -4. Click on the **Edit Scheme** button. -5. Click on the **Run** tab. -6. Uncheck the **Debug executable** checkbox. - -Enable Debug executable in Xcode - - - - -## Usage - -To use Reclaim InApp Sdk in your project, follow these steps: - -1. Import the `@reclaimprotocol/inapp-rn-sdk` package in your project file. - -```js -import { ReclaimVerification } from '@reclaimprotocol/inapp-rn-sdk'; -``` - -2. Initialize the `ReclaimVerification` class to create an instance. - -```js -const reclaimVerification = new ReclaimVerification(); -``` - -3. Start the verification flow by providing the app id, secret and provider id. - -```js -const verificationResult = await reclaimVerification.startVerification({ - appId: config.REACT_APP_RECLAIM_APP_ID ?? '', - secret: config.REACT_APP_RECLAIM_APP_SECRET ?? '', - providerId: providerId, -}); -``` - -The returned result is a [ReclaimVerification.Response] object. This object contains a response that has proofs, exception, and the sessionId if the verification is successful. - -### Exception Handling - -If the verification ends with an exception, the exception is thrown as a [ReclaimVerification.ReclaimVerificationException] object. - -Following is an example of how to handle the exception using [error.type]: - -```js -try { - // ... start verification -} catch (error) { - if (error instanceof ReclaimVerification.ReclaimVerificationException) { - switch (error.type) { - case ReclaimVerification.ExceptionType.Cancelled: - Snackbar.show({ - text: 'Verification cancelled', - duration: Snackbar.LENGTH_LONG, - }); - break; - case ReclaimVerification.ExceptionType.Dismissed: - Snackbar.show({ - text: 'Verification dismissed', - duration: Snackbar.LENGTH_LONG, - }); - break; - case ReclaimVerification.ExceptionType.SessionExpired: - Snackbar.show({ - text: 'Verification session expired', - duration: Snackbar.LENGTH_LONG, - }); - break; - case ReclaimVerification.ExceptionType.Failed: - default: - Snackbar.show({ - text: 'Verification failed', - duration: Snackbar.LENGTH_LONG, - }); - } - } else { - Snackbar.show({ - text: error instanceof Error ? error.message : 'An unknown verification error occurred', - duration: Snackbar.LENGTH_LONG, - }); - } -} -``` - -This error also contains `sessionId`, `reason`, and `innerError` that can be used to get more details about the occurred error. - -```js -error.sessionId -error.reason -error.innerError -``` - -## Migration - -- Migration steps for [0.3.1](https://github.com/reclaimprotocol/reclaim-inapp-reactnative-sdk/blob/main/documentation/migration.md#031) -- Migration steps for [0.3.0](https://github.com/reclaimprotocol/reclaim-inapp-reactnative-sdk/blob/main/documentation/migration.md#030) -- Migration steps for [0.2.1](https://github.com/reclaimprotocol/reclaim-inapp-reactnative-sdk/blob/main/documentation/migration.md#021) - -## Advanced Usage - -### Overriding SDK Config - -You can customize the verification flow by overriding the default SDK configuration with `reclaimVerification.setOverrides`. - -```js -reclaimVerification.setOverrides({ - appInfo: { - appName: "Overridden Example", - appImageUrl: "https://placehold.co/400x400/png" - } - // .. other overrides -}) -``` - -Read more about overrides in [Reclaim InApp SDK Documentation | Overrides](../advanced/overrides) - -## Contributing - -See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow. - -## License - -MIT \ No newline at end of file diff --git a/content/docs/inapp-sdks/introduction.mdx b/content/docs/inapp-sdks/introduction.mdx deleted file mode 100644 index fe941bb..0000000 --- a/content/docs/inapp-sdks/introduction.mdx +++ /dev/null @@ -1,47 +0,0 @@ ---- -title: Introduction -description: The InApp SDKs enables seamless in-app verification experience for your users. No redirection, and no requirement for installing a new app—really no need for your users to leave your app! ---- - -## Integration - -Following is an example on how we used the [Github Username Provider](https://dev.reclaimprotocol.org/provider/6d3f6753-7ee6-49ee-a545-62f1b1822ae5) with the InApp SDK in an ios native application to verify Github account ownership. - - - -This is how Reclaim's verification flow can be fully integrated within your native mobile application. - -## Installation - -The InApp SDKs are available on all major mobile platforms. For each platform, you can find the installation instructions in the following pages: - -* [Android](./installation/android) -* [iOS](./installation/ios) -* [React Native](./installation/react-native) -* [React Native Expo](./installation/react-native-expo) -* [Flutter](./installation/flutter) -* [Ionic - Capacitor](./installation/ionic-capacitor) - -You can request an addition of new platform/framework, contact us for more info. - -## Verification - -Proofs generated on the client must be verified at the backend. Follow the instructions from [the Backend Verification Guide](./verification). - -## Advanced Usage - -You can customize the verification flow with options, and, as an advanced use—set up overrides or use authentication with the attestor. Learn more from [the Usage documentation](./advanced/intro). - -### Contributing - -Contributions are welcome! Please feel free to submit a Pull Request. - -### Issues and Feedback - -Please feel free to file feature requests and bugs at the issue tracker of InApp sdks. Don't hesitate to contact us if you need any help ;) - -### Stay Updated - -- Join our [Telegram community](https://t.me/protocolreclaim) -- Follow [@reclaimprotocol](https://twitter.com/reclaimprotocol) on Twitter -- Watch our [GitHub repository](https://github.com/reclaimprotocol) diff --git a/content/docs/inapp-sdks/meta.json b/content/docs/inapp-sdks/meta.json deleted file mode 100644 index 00f6e27..0000000 --- a/content/docs/inapp-sdks/meta.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "title": "Reclaim InApp SDKs", - "pages": [ - "introduction", - "installation", - "verification", - "advanced" - ] -} \ No newline at end of file diff --git a/content/docs/index.mdx b/content/docs/index.mdx index 8b3367c..2458927 100644 --- a/content/docs/index.mdx +++ b/content/docs/index.mdx @@ -3,13 +3,7 @@ title: Reclaim Protocol Docs description: Reclaim SDKs make it simple to bring user activity, reputation, and identity from external websites into your own platform. --- -import { IntegrationCard } from '../../app/components/integration-card'; - - - -### Overview - -Reclaim Protocol enables secure data portability across web, mobile, and blockchain platforms. Through our SDKs, developers can build applications that access authenticated user data, activity history, and identity information from various internet services - all while maintaining user privacy and security. +Reclaim Protocol has the best in class coverage of data sources ([2500+](https://dev.reclaimprotocol.org/explore)) and best coverage of platforms. So no matter what data point you need, no matter on what platform your app is built - you will have a first class integration experience.