From 263461b1e926e5863fae9fbfed6eee4a66944f85 Mon Sep 17 00:00:00 2001 From: madhavanmalolan Date: Fri, 16 May 2025 03:24:25 +0000 Subject: [PATCH 01/12] removing verbosity and chatgpt generated useless content --- .../attestor-auth.mdx | 0 .../usage => advance-options}/overrides.mdx | 0 content/docs/android-kotlin/installation.mdx | 72 ++++ content/docs/android-kotlin/meta.json | 7 + content/docs/android-kotlin/usage.mdx | 71 ++++ content/docs/api-key.mdx | 39 ++ content/docs/backend/best-practices.mdx | 51 --- content/docs/backend/meta.json | 4 - content/docs/flutter/index.mdx | 83 ---- content/docs/hackathon/index.mdx | 30 -- content/docs/hackathon/meta.json | 3 - content/docs/inapp-sdks/android.mdx | 164 -------- content/docs/inapp-sdks/meta.json | 12 - content/docs/inapp-sdks/react-native-expo.mdx | 16 - content/docs/inapp-sdks/react-native.mdx | 354 ------------------ content/docs/inapp-sdks/usage/intro.mdx | 13 - content/docs/inapp-sdks/usage/meta.json | 8 - .../installation.mdx} | 123 +----- content/docs/ionic/usage.mdx | 98 +++++ .../ios.mdx => ios-swift/installation.mdx} | 119 +----- content/docs/ios-swift/meta.json | 7 + content/docs/ios-swift/usage.mdx | 97 +++++ .../docs/{ => javascript}/backend/index.mdx | 0 .../{ => javascript}/backend/installation.mdx | 13 +- content/docs/javascript/backend/meta.json | 4 + .../backend/usage.mdx} | 15 +- .../docs/javascript/frontend/fullstack.mdx | 179 +++++++++ content/docs/javascript/frontend/index.mdx | 14 + .../frontend}/installation.mdx | 36 +- content/docs/javascript/frontend/meta.json | 4 + .../docs/javascript/frontend/quickstart.mdx | 82 ++++ content/docs/javascript/index.mdx | 17 + content/docs/javascript/meta.json | 4 + content/docs/js/frontend-example.mdx | 181 --------- content/docs/js/fullstack-example.mdx | 124 ------ content/docs/js/index.mdx | 69 ---- content/docs/js/meta.json | 4 - content/docs/meta.json | 12 +- content/docs/react-native/basic-example.mdx | 161 -------- content/docs/react-native/best-practices.mdx | 145 ------- .../docs/react-native/fullstack-example.mdx | 132 ------- content/docs/react-native/index.mdx | 95 ----- content/docs/react-native/installation.mdx | 259 ++++++++++--- content/docs/react-native/meta.json | 7 +- content/docs/react-native/usage.mdx | 94 +++++ next.config.mjs | 10 - .../docs => temp}/flutter/best-practices.mdx | 0 .../docs => temp}/flutter/flutter-example.mdx | 0 .../flutter/fullstack-example.mdx | 0 .../flutter.mdx => temp/flutter/index.mdx | 0 .../docs => temp}/flutter/installation.mdx | 0 {content/docs => temp}/flutter/meta.json | 0 52 files changed, 1039 insertions(+), 1993 deletions(-) rename content/docs/{inapp-sdks/usage => advance-options}/attestor-auth.mdx (100%) rename content/docs/{inapp-sdks/usage => advance-options}/overrides.mdx (100%) create mode 100644 content/docs/android-kotlin/installation.mdx create mode 100644 content/docs/android-kotlin/meta.json create mode 100644 content/docs/android-kotlin/usage.mdx create mode 100644 content/docs/api-key.mdx delete mode 100644 content/docs/backend/best-practices.mdx delete mode 100644 content/docs/backend/meta.json delete mode 100644 content/docs/flutter/index.mdx delete mode 100644 content/docs/hackathon/index.mdx delete mode 100644 content/docs/hackathon/meta.json delete mode 100644 content/docs/inapp-sdks/android.mdx delete mode 100644 content/docs/inapp-sdks/meta.json delete mode 100644 content/docs/inapp-sdks/react-native-expo.mdx delete mode 100644 content/docs/inapp-sdks/react-native.mdx delete mode 100644 content/docs/inapp-sdks/usage/intro.mdx delete mode 100644 content/docs/inapp-sdks/usage/meta.json rename content/docs/{inapp-sdks/ionic-capacitor.mdx => ionic/installation.mdx} (74%) create mode 100644 content/docs/ionic/usage.mdx rename content/docs/{inapp-sdks/ios.mdx => ios-swift/installation.mdx} (66%) create mode 100644 content/docs/ios-swift/meta.json create mode 100644 content/docs/ios-swift/usage.mdx rename content/docs/{ => javascript}/backend/index.mdx (100%) rename content/docs/{ => javascript}/backend/installation.mdx (68%) create mode 100644 content/docs/javascript/backend/meta.json rename content/docs/{backend/backend-example.mdx => javascript/backend/usage.mdx} (92%) create mode 100644 content/docs/javascript/frontend/fullstack.mdx create mode 100644 content/docs/javascript/frontend/index.mdx rename content/docs/{js => javascript/frontend}/installation.mdx (54%) create mode 100644 content/docs/javascript/frontend/meta.json create mode 100644 content/docs/javascript/frontend/quickstart.mdx create mode 100644 content/docs/javascript/index.mdx create mode 100644 content/docs/javascript/meta.json delete mode 100644 content/docs/js/frontend-example.mdx delete mode 100644 content/docs/js/fullstack-example.mdx delete mode 100644 content/docs/js/index.mdx delete mode 100644 content/docs/js/meta.json delete mode 100644 content/docs/react-native/basic-example.mdx delete mode 100644 content/docs/react-native/best-practices.mdx delete mode 100644 content/docs/react-native/fullstack-example.mdx delete mode 100644 content/docs/react-native/index.mdx create mode 100644 content/docs/react-native/usage.mdx rename {content/docs => temp}/flutter/best-practices.mdx (100%) rename {content/docs => temp}/flutter/flutter-example.mdx (100%) rename {content/docs => temp}/flutter/fullstack-example.mdx (100%) rename content/docs/inapp-sdks/flutter.mdx => temp/flutter/index.mdx (100%) rename {content/docs => temp}/flutter/installation.mdx (100%) rename {content/docs => temp}/flutter/meta.json (100%) diff --git a/content/docs/inapp-sdks/usage/attestor-auth.mdx b/content/docs/advance-options/attestor-auth.mdx similarity index 100% rename from content/docs/inapp-sdks/usage/attestor-auth.mdx rename to content/docs/advance-options/attestor-auth.mdx diff --git a/content/docs/inapp-sdks/usage/overrides.mdx b/content/docs/advance-options/overrides.mdx similarity index 100% rename from content/docs/inapp-sdks/usage/overrides.mdx rename to content/docs/advance-options/overrides.mdx diff --git a/content/docs/android-kotlin/installation.mdx b/content/docs/android-kotlin/installation.mdx new file mode 100644 index 0000000..d9cd37d --- /dev/null +++ b/content/docs/android-kotlin/installation.mdx @@ -0,0 +1,72 @@ +--- +title: Installation +description: Integrate Reclaim Protocol into Android Native Applications. +--- + +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. + + +## 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/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/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/android.mdx b/content/docs/inapp-sdks/android.mdx deleted file mode 100644 index 2e9a4e0..0000000 --- a/content/docs/inapp-sdks/android.mdx +++ /dev/null @@ -1,164 +0,0 @@ ---- -title: Android SDK -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](./usage/overrides) diff --git a/content/docs/inapp-sdks/meta.json b/content/docs/inapp-sdks/meta.json deleted file mode 100644 index e8c0efb..0000000 --- a/content/docs/inapp-sdks/meta.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "title": "Reclaim InApp SDKs", - "pages": [ - "android", - "ios", - "react-native", - "ionic-capacitor", - "flutter", - "react-native-expo", - "usage" - ] -} \ No newline at end of file diff --git a/content/docs/inapp-sdks/react-native-expo.mdx b/content/docs/inapp-sdks/react-native-expo.mdx deleted file mode 100644 index 151df83..0000000 --- a/content/docs/inapp-sdks/react-native-expo.mdx +++ /dev/null @@ -1,16 +0,0 @@ ---- -title: React Native Expo SDK -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/react-native.mdx b/content/docs/inapp-sdks/react-native.mdx deleted file mode 100644 index d344ff8..0000000 --- a/content/docs/inapp-sdks/react-native.mdx +++ /dev/null @@ -1,354 +0,0 @@ ---- -title: React Native SDK -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](./usage/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/usage/intro.mdx b/content/docs/inapp-sdks/usage/intro.mdx deleted file mode 100644 index e868632..0000000 --- a/content/docs/inapp-sdks/usage/intro.mdx +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: More about Reclaim InApp SDKs -description: Documentation for advanced usage of Reclaim InApp SDKs. ---- - -# Usage - -The InApp SDKs also allows more functionalities, like overriding several configurations used in the verification process by the SDK. - -## Table of Contents - -* [Attestor Auth](./attestor-auth) -* [Overrides](./overrides) diff --git a/content/docs/inapp-sdks/usage/meta.json b/content/docs/inapp-sdks/usage/meta.json deleted file mode 100644 index e16e44a..0000000 --- a/content/docs/inapp-sdks/usage/meta.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "title": "Usage", - "pages": [ - "intro", - "attestor-auth", - "overrides" - ] -} \ No newline at end of file diff --git a/content/docs/inapp-sdks/ionic-capacitor.mdx b/content/docs/ionic/installation.mdx similarity index 74% rename from content/docs/inapp-sdks/ionic-capacitor.mdx rename to content/docs/ionic/installation.mdx index 4b1cdd3..d85e728 100644 --- a/content/docs/inapp-sdks/ionic-capacitor.mdx +++ b/content/docs/ionic/installation.mdx @@ -1,6 +1,6 @@ --- -title: Ionic - Capacitor SDK -description: Reclaim Protocol's Capacitor SDK for ZK proof generations for requests with an in-app experience of web verification +title: Installation +description: Reclaim Protocol's Capacitor SDK --- import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; @@ -22,9 +22,8 @@ This SDK allows you to integrate Reclaim's in-app verification process into your - 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). -## Example - -- See the [Reclaim Example - Capacitor](https://github.com/reclaimprotocol/reclaim-inapp-capacitor-sdk/tree/main/example-app) for a complete example of how to use the SDK in a Capacitor application. +## Get an API Key +Setup your project using the [Get API Key guide](/api-key). ## Installation @@ -286,117 +285,3 @@ This method is **not recommended** but could be useful if you don't want to add - -## Usage - -To use Reclaim InApp Sdk in your project, follow these steps: - -1. Import the `@reclaimprotocol/inapp-capacitor-sdk` package in your project file. - -```js -import { ReclaimVerification } from '@reclaimprotocol/inapp-capacitor-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.RECLAIM_APP_ID ?? '', - secret: config.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-capacitor-sdk/blob/main/documentation/migration.md#031) -- Migration steps for [0.3.0](https://github.com/reclaimprotocol/reclaim-inapp-capacitor-sdk/blob/main/documentation/migration.md#030) -- Migration steps for [0.2.1](https://github.com/reclaimprotocol/reclaim-inapp-capacitor-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](./usage/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/ionic/usage.mdx b/content/docs/ionic/usage.mdx new file mode 100644 index 0000000..3bc9cfe --- /dev/null +++ b/content/docs/ionic/usage.mdx @@ -0,0 +1,98 @@ +--- +title: Usage +description: Reclaim Protocol's Capacitor SDK +--- + +To use Reclaim InApp Sdk in your project, follow these steps: + +1. Import the `@reclaimprotocol/inapp-capacitor-sdk` package in your project file. + +```js +import { ReclaimVerification } from '@reclaimprotocol/inapp-capacitor-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.RECLAIM_APP_ID ?? '', + secret: config.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-capacitor-sdk/blob/main/documentation/migration.md#031) +- Migration steps for [0.3.0](https://github.com/reclaimprotocol/reclaim-inapp-capacitor-sdk/blob/main/documentation/migration.md#030) +- Migration steps for [0.2.1](https://github.com/reclaimprotocol/reclaim-inapp-capacitor-sdk/blob/main/documentation/migration.md#021) + +## Example + +- See the [Reclaim Example - Capacitor](https://github.com/reclaimprotocol/reclaim-inapp-capacitor-sdk/tree/main/example-app) for a complete example of how to use the SDK in a Capacitor application. + + +## Advanced Usage +For more usage options see [Advance Options guide](/advance-options/advance-options) diff --git a/content/docs/inapp-sdks/ios.mdx b/content/docs/ios-swift/installation.mdx similarity index 66% rename from content/docs/inapp-sdks/ios.mdx rename to content/docs/ios-swift/installation.mdx index 42062c0..5fba3a5 100644 --- a/content/docs/inapp-sdks/ios.mdx +++ b/content/docs/ios-swift/installation.mdx @@ -1,6 +1,6 @@ --- -title: iOS SDK -description: Reclaim Protocol's InApp iOS SDK for ZK proof generations for requests with an in-app experience of web verification +title: Installation +description: Integrate Reclaim Protocol into iOS Native Applications. --- import { BadgeGroup } from '@/app/components/badge'; @@ -27,10 +27,9 @@ This SDK allows you to integrate Reclaim's in-app verification process into your - 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 +## Get an API Key +Setup your project using the [Get API Key guide](/api-key). -- See the [Reclaim Example - SwiftUI](https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk/blob/53a19f88c8d90df485a60dc20190f740cd9fd108/Examples/SwiftUIExample/README.md) for a complete example of how to use the SDK in a SwiftUI application. -- See the [Reclaim Example - SwiftUI with CocoaPods](https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk/blob/main/Examples/SwiftUIWithPodExample/README.md) for a complete example of how to use the SDK in a SwiftUI application with CocoaPods. ## Installation @@ -219,113 +218,3 @@ This method is **not recommended** but could be useful if you don't want to add - -### 3. Use ReclaimInAppSdk in your project - -To use ReclaimInAppSdk in your project, follow these steps: - -1. Import the ReclaimInAppSdk module into your Swift file. - -```swift -import ReclaimInAppSdk -``` - -2. Create a request object. - -```swift -let request = ReclaimVerification.Request.params( - try .init( - /// You can use the appId and secret from Reclaim Devtools to create a request. - /// Providing appId and secret here in this initializer is optional. - /// If you don't provide it, the SDK will use the appId and secret from the Info.plist file. - // appId: "YOUR_APP_ID_FROM_RECLAIM_DEVTOOLS", - // secret: "YOUR_APP_SECRET_FROM_RECLAIM_DEVTOOLS", - /// This is the provider id that you've added to your app in Reclaim Devtools. - /// The verification flow will use the provider information fetch by this provider id. - providerId: providerId - ) -) -``` - -More ways to create a request object are available in the `ReclaimVerification.Request.*` apis. - -3. Start the verification flow. - -```swift -// This is the function that starts the verification flow. -// This may fail if device screen is getting shared. -let result = try await ReclaimVerification.startVerification(request) -``` - -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. - -If the verification is cancelled or failed, the result will contain an exception. - -You can use the `ReclaimVerification.Response` object to get the proof, exception, and sessionId. - -```swift -let proof = result.response.proofs -let exception = result.response.exception -let sessionId = result.response.sessionId -``` - -If the verification is successful, the proof will contain the data that you need to store in your database. - -If the verification is cancelled or failed, the exception will contain the error details. - -In the above apis, `ReclaimVerification.Request.*`, `ReclaimVerification.startVerification` or `ReclaimVerification.startVerificationFromUrl` can also throw an error. The error can be one of the following: - -- `ReclaimVerificationError.cancelled`: The verification was cancelled by the user. -- `ReclaimVerificationError.dismissed`: The verification was dismissed by the sdk. -- `ReclaimVerificationError.failed(let error)`: The verification failed due to an error. -- `ReclaimVerificationError.sessionExpired`: The verification session expired. - -You can handle the error by using a `do-catch` block. For example: - -```swift -do { - let result = try await ReclaimVerification.startVerification(request) -} catch ReclaimVerificationError.cancelled { - print("Verification cancelled") -} catch ReclaimVerificationError.dismissed { - print("Verification dismissed") -} -``` - -For a complete example, see the [Reclaim Example - SwiftUI](https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk/blob/53a19f88c8d90df485a60dc20190f740cd9fd108/Examples/SwiftUIExample/SwiftUIExample/ContentView.swift). - -## Advanced Usage - -### Overriding SDK Config - -You can customize the verification flow by overriding the default SDK configuration with `ReclaimVerification.setOverrides`. - -```swift -func setOverrides() { - Task { @MainActor in - do { - try await ReclaimVerification.setOverrides( - appInfo: ReclaimOverrides.ReclaimAppInfo( - appName: "Overridden Example", - appImageUrl: "https://placehold.co/400x400/png" - ) - // Add other overrides here - ) - } catch { - print("unexpected failure error details: \(error)") - showAlert(message: "Could not set overrides") - } - } -} -``` - -Read more about overrides in [Reclaim InApp SDK Documentation | Overrides](./usage/overrides) - -## Upgrading - -To upgrade to a new version of the Reclaim InApp SDK, follow these steps: - -1. Make sure you have the latest version of the Reclaim InApp SDK. Currently the latest version is `v0.3.0`. -1. Incase of any problems: remove package, clear build, restart Xcode, and add package again. - -Migration guides will be available when a new version with API changes is released. \ No newline at end of file diff --git a/content/docs/ios-swift/meta.json b/content/docs/ios-swift/meta.json new file mode 100644 index 0000000..0a0d7b2 --- /dev/null +++ b/content/docs/ios-swift/meta.json @@ -0,0 +1,7 @@ +{ + "title": "iOS SDK", + "pages": [ + "installation", + "usage" + ] +} \ No newline at end of file diff --git a/content/docs/ios-swift/usage.mdx b/content/docs/ios-swift/usage.mdx new file mode 100644 index 0000000..6275b52 --- /dev/null +++ b/content/docs/ios-swift/usage.mdx @@ -0,0 +1,97 @@ +--- +title: Usage +description: Reclaim Protocol's InApp iOS SDK for ZK proof generations for requests with an in-app experience of web verification +--- + + +### Use ReclaimInAppSdk in your project + +To use ReclaimInAppSdk in your project, follow these steps: + +1. Import the ReclaimInAppSdk module into your Swift file. + +```swift +import ReclaimInAppSdk +``` + +2. Create a request object. + +```swift +let request = ReclaimVerification.Request.params( + try .init( + /// You can use the appId and secret from Reclaim Devtools to create a request. + /// Providing appId and secret here in this initializer is optional. + /// If you don't provide it, the SDK will use the appId and secret from the Info.plist file. + // appId: "YOUR_APP_ID_FROM_RECLAIM_DEVTOOLS", + // secret: "YOUR_APP_SECRET_FROM_RECLAIM_DEVTOOLS", + /// This is the provider id that you've added to your app in Reclaim Devtools. + /// The verification flow will use the provider information fetch by this provider id. + providerId: providerId + ) +) +``` + +More ways to create a request object are available in the `ReclaimVerification.Request.*` apis. + +3. Start the verification flow. + +```swift +// This is the function that starts the verification flow. +// This may fail if device screen is getting shared. +let result = try await ReclaimVerification.startVerification(request) +``` + +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. + +If the verification is cancelled or failed, the result will contain an exception. + +You can use the `ReclaimVerification.Response` object to get the proof, exception, and sessionId. + +```swift +let proof = result.response.proofs +let exception = result.response.exception +let sessionId = result.response.sessionId +``` + +If the verification is successful, the proof will contain the data that you need to store in your database. + +If the verification is cancelled or failed, the exception will contain the error details. + +In the above apis, `ReclaimVerification.Request.*`, `ReclaimVerification.startVerification` or `ReclaimVerification.startVerificationFromUrl` can also throw an error. The error can be one of the following: + +- `ReclaimVerificationError.cancelled`: The verification was cancelled by the user. +- `ReclaimVerificationError.dismissed`: The verification was dismissed by the sdk. +- `ReclaimVerificationError.failed(let error)`: The verification failed due to an error. +- `ReclaimVerificationError.sessionExpired`: The verification session expired. + +You can handle the error by using a `do-catch` block. For example: + +```swift +do { + let result = try await ReclaimVerification.startVerification(request) +} catch ReclaimVerificationError.cancelled { + print("Verification cancelled") +} catch ReclaimVerificationError.dismissed { + print("Verification dismissed") +} +``` + +For a complete example, see the [Reclaim Example - SwiftUI](https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk/blob/53a19f88c8d90df485a60dc20190f740cd9fd108/Examples/SwiftUIExample/SwiftUIExample/ContentView.swift). + +## Advanced Usage +For more usage options see [Advance Options guide](/advance-options/advance-options) + +## Example + +- See the [Reclaim Example - SwiftUI](https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk/blob/53a19f88c8d90df485a60dc20190f740cd9fd108/Examples/SwiftUIExample/README.md) for a complete example of how to use the SDK in a SwiftUI application. +- See the [Reclaim Example - SwiftUI with CocoaPods](https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk/blob/main/Examples/SwiftUIWithPodExample/README.md) for a complete example of how to use the SDK in a SwiftUI application with CocoaPods. + + +## Upgrading + +To upgrade to a new version of the Reclaim InApp SDK, follow these steps: + +1. Make sure you have the latest version of the Reclaim InApp SDK. Currently the latest version is `v0.3.0`. +1. Incase of any problems: remove package, clear build, restart Xcode, and add package again. + +Migration guides will be available when a new version with API changes is released. \ No newline at end of file diff --git a/content/docs/backend/index.mdx b/content/docs/javascript/backend/index.mdx similarity index 100% rename from content/docs/backend/index.mdx rename to content/docs/javascript/backend/index.mdx diff --git a/content/docs/backend/installation.mdx b/content/docs/javascript/backend/installation.mdx similarity index 68% rename from content/docs/backend/installation.mdx rename to content/docs/javascript/backend/installation.mdx index fc6b5fb..627c3af 100644 --- a/content/docs/backend/installation.mdx +++ b/content/docs/javascript/backend/installation.mdx @@ -38,11 +38,6 @@ Using yarn: ```bash yarn add @reclaimprotocol/js-sdk ``` - - #### Verify Installation - - Check your `package.json` file. You should see `@reclaimprotocol/js-sdk` listed in the `dependencies` section. - #### Importing the SDK ```javascript @@ -74,11 +69,5 @@ yarn add @reclaimprotocol/js-sdk ## Get an API Key -In order for you to integrate Reclaim Protocol on your backend, you will need to create an application and have the `APPLICATION_ID` and `APPLICATION_SECRET` handy for the next step. Make sure you have signed up on the [Reclaim Dev Tool](https://dev.reclaimprotocol.org) and created an application. - -## Next Steps - -Check out the [Backend Example](./backend-example) guide to create your first proof request on the server-side. - -If you encounter any issues during installation, please refer to our [FAQ](https://reclaimprotocol.org/faq) or join our [Telegram community](https://t.me/protocolreclaim) for support. +Setup your project using the [Get API Key guide](/api-key). diff --git a/content/docs/javascript/backend/meta.json b/content/docs/javascript/backend/meta.json new file mode 100644 index 0000000..45d4814 --- /dev/null +++ b/content/docs/javascript/backend/meta.json @@ -0,0 +1,4 @@ +{ + "title": "Backend (JS/Py)", + "pages": ["installation", "usage"] +} \ No newline at end of file diff --git a/content/docs/backend/backend-example.mdx b/content/docs/javascript/backend/usage.mdx similarity index 92% rename from content/docs/backend/backend-example.mdx rename to content/docs/javascript/backend/usage.mdx index f3306af..72998d7 100644 --- a/content/docs/backend/backend-example.mdx +++ b/content/docs/javascript/backend/usage.mdx @@ -1,5 +1,5 @@ --- -title: Backend Example +title: Usage description: This example will help you get started with a basic backend implementation to start proof requests and verify proofs. --- @@ -19,6 +19,8 @@ Make sure you have installed the SDKs by following the instructions on the [Inst ### 3. Create the Proof Request generator endpoint This endpoint defines what proof you are requesting from the user. +If you are deploying this on localhost, be sure to use [ngrok](https://ngrok.com) to make your server accessible over the internet. + @@ -34,8 +36,10 @@ This endpoint defines what proof you are requesting from the user. app.use(express.json()) app.use(express.text({ type: '*/*', limit: '50mb' })) // This is to parse the urlencoded proof object that is returned to the callback url + const BASE_URL = "https://your-domain.com"; // if using ngrok, provide the ngrok base url + // Route to generate SDK configuration - app.get('/reclaim/generate-config', async (req, res) => { + app.get('/generate-config', async (req, res) => { const APP_ID = 'YOUR_APPLICATION_ID' const APP_SECRET = 'YOUR_APPLICATION_SECRET' const PROVIDER_ID = 'YOUR_PROVIDER_ID' @@ -44,7 +48,7 @@ This endpoint defines what proof you are requesting from the user. const reclaimProofRequest = await ReclaimProofRequest.init(APP_ID, APP_SECRET, PROVIDER_ID) // we will be defining this endpoint in the next step - reclaimProofRequest.setAppCallbackUrl('https://your-backend.com/receive-proofs') + reclaimProofRequest.setAppCallbackUrl(BASE_URL+'/receive-proofs') const reclaimProofRequestConfig = reclaimProofRequest.toJsonString() @@ -77,9 +81,10 @@ This endpoint defines what proof you are requesting from the user. from urllib.parse import unquote app = FastAPI() + BASE_URL = "https://your-domain.com"; // if using ngrok, provide the ngrok base url # Route to generate SDK configuration - @app.get("/reclaim/generate-config") + @app.get("/generate-config") async def generate_config(): APP_ID = "YOUR_APPLICATION_ID" APP_SECRET = "YOUR_APPLICATION_SECRET" @@ -89,7 +94,7 @@ This endpoint defines what proof you are requesting from the user. reclaim_proof_request = await ReclaimProofRequest.init(APP_ID, APP_SECRET, PROVIDER_ID) // we will be defining this endpoint in the next step - reclaim_proof_request.set_app_callback_url("https://your-backend.com/receive-proofs") + reclaim_proof_request.set_app_callback_url(BASE_URL+"/receive-proofs") reclaim_proof_request_config = reclaim_proof_request.to_json_string() diff --git a/content/docs/javascript/frontend/fullstack.mdx b/content/docs/javascript/frontend/fullstack.mdx new file mode 100644 index 0000000..3fb35ab --- /dev/null +++ b/content/docs/javascript/frontend/fullstack.mdx @@ -0,0 +1,179 @@ +--- +title: Fullstack Usage +description: This guide demonstrates how to integrate the Reclaim Protocol JavaScript SDK into a fullstack application securely. We'll cover both the backend and frontend implementations. +--- + +## Video Walkthrough + +