diff --git a/content/docs/backend/installation.mdx b/content/docs/backend/installation.mdx index fc6b5fb..5f299cc 100644 --- a/content/docs/backend/installation.mdx +++ b/content/docs/backend/installation.mdx @@ -68,7 +68,7 @@ yarn add @reclaimprotocol/js-sdk #### Importing the SDK ```python - from reclaim-python-sdk import ReclaimProofRequest + from reclaim_python_sdk import ReclaimProofRequest ``` diff --git a/content/docs/inapp-sdks/usage/attestor-auth.mdx b/content/docs/inapp-sdks/advanced/attestor-auth.mdx similarity index 100% rename from content/docs/inapp-sdks/usage/attestor-auth.mdx rename to content/docs/inapp-sdks/advanced/attestor-auth.mdx diff --git a/content/docs/inapp-sdks/usage/intro.mdx b/content/docs/inapp-sdks/advanced/intro.mdx similarity index 75% rename from content/docs/inapp-sdks/usage/intro.mdx rename to content/docs/inapp-sdks/advanced/intro.mdx index e868632..9e94be2 100644 --- a/content/docs/inapp-sdks/usage/intro.mdx +++ b/content/docs/inapp-sdks/advanced/intro.mdx @@ -1,13 +1,14 @@ --- -title: More about Reclaim InApp SDKs +title: Usage description: Documentation for advanced usage of Reclaim InApp SDKs. --- -# Usage +# 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/usage/meta.json b/content/docs/inapp-sdks/advanced/meta.json similarity index 77% rename from content/docs/inapp-sdks/usage/meta.json rename to content/docs/inapp-sdks/advanced/meta.json index e16e44a..843415d 100644 --- a/content/docs/inapp-sdks/usage/meta.json +++ b/content/docs/inapp-sdks/advanced/meta.json @@ -2,6 +2,7 @@ "title": "Usage", "pages": [ "intro", + "verification-options", "attestor-auth", "overrides" ] diff --git a/content/docs/inapp-sdks/usage/overrides.mdx b/content/docs/inapp-sdks/advanced/overrides.mdx similarity index 100% rename from content/docs/inapp-sdks/usage/overrides.mdx rename to content/docs/inapp-sdks/advanced/overrides.mdx diff --git a/content/docs/inapp-sdks/advanced/verification-options.mdx b/content/docs/inapp-sdks/advanced/verification-options.mdx new file mode 100644 index 0000000..82f06cf --- /dev/null +++ b/content/docs/inapp-sdks/advanced/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/flutter.mdx b/content/docs/inapp-sdks/flutter.mdx deleted file mode 100644 index bf92249..0000000 --- a/content/docs/inapp-sdks/flutter.mdx +++ /dev/null @@ -1,16 +0,0 @@ ---- -title: Flutter SDK -description: Coming soon - Reclaim Protocol integration for Flutter applications ---- - -# Flutter SDK - - - The Reclaim Protocol SDK for Flutter is currently under development. Stay tuned for updates! - - -### 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/android.mdx b/content/docs/inapp-sdks/installation/android.mdx similarity index 99% rename from content/docs/inapp-sdks/android.mdx rename to content/docs/inapp-sdks/installation/android.mdx index 2e9a4e0..3dddc24 100644 --- a/content/docs/inapp-sdks/android.mdx +++ b/content/docs/inapp-sdks/installation/android.mdx @@ -1,5 +1,5 @@ --- -title: Android SDK +title: Android description: Reclaim Protocol's InApp Android SDK for ZK proof generations for requests with an in-app experience of web verification --- @@ -161,4 +161,4 @@ fun setOverrides() { } ``` -Read more about overrides in [Reclaim InApp SDK Documentation | Overrides](./usage/overrides) +Read more about overrides in [Reclaim InApp SDK Documentation | Overrides](./../advanced/overrides) diff --git a/content/docs/inapp-sdks/installation/flutter.mdx b/content/docs/inapp-sdks/installation/flutter.mdx new file mode 100644 index 0000000..96269e3 --- /dev/null +++ b/content/docs/inapp-sdks/installation/flutter.mdx @@ -0,0 +1,140 @@ +--- +title: Flutter +description: Available upon request - Reclaim Protocol integration for Flutter applications +--- + +# 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 +import 'package:reclaim_inapp_flutter_sdk/reclaim_inapp_flutter_sdk.dart'; +``` + +2. Initialize the SDK with your app credentials: + +Following is an exmaple. + +```dart +const String appId = String.fromEnvironment('APP_ID'); +const String appSecret = String.fromEnvironment('APP_SECRET'); +const String providerId = String.fromEnvironment('PROVIDER_ID'); +``` + +### Starting Verification + +```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, + ), +); +``` + +### Configuration Options + +The `ReclaimVerificationRequest` supports the following options: + +- `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 + +### Error Handling + +The SDK throws specific exceptions that you can handle: + +```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 +void main() async { + WidgetsFlutterBinding.ensureInitialized(); + ReclaimInAppSdk.preWarm(); + runApp(MyApp()); +} +``` + +## Example + +Check out the [example](example/lib/main.dart) for a complete implementation. + +## Environment Variables + +The SDK requires the following environment variables: + +- `APP_ID`: Your Reclaim application ID +- `APP_SECRET`: Your application secret +- `PROVIDER_ID`: The ID of the provider to verify against + +You can provide these values using: + +- Dart Define Env file: `--dart-define-from-file=./.env` +- Hardcoded values (not recommended for production) + +### 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/ionic-capacitor.mdx b/content/docs/inapp-sdks/installation/ionic-capacitor.mdx similarity index 99% rename from content/docs/inapp-sdks/ionic-capacitor.mdx rename to content/docs/inapp-sdks/installation/ionic-capacitor.mdx index 4b1cdd3..b627cff 100644 --- a/content/docs/inapp-sdks/ionic-capacitor.mdx +++ b/content/docs/inapp-sdks/installation/ionic-capacitor.mdx @@ -1,5 +1,5 @@ --- -title: Ionic - Capacitor SDK +title: Ionic - Capacitor description: Reclaim Protocol's Capacitor SDK for ZK proof generations for requests with an in-app experience of web verification --- @@ -391,7 +391,7 @@ reclaimVerification.setOverrides({ }) ``` -Read more about overrides in [Reclaim InApp SDK Documentation | Overrides](./usage/overrides) +Read more about overrides in [Reclaim InApp SDK Documentation | Overrides](../advanced/overrides) ## Contributing diff --git a/content/docs/inapp-sdks/ios.mdx b/content/docs/inapp-sdks/installation/ios.mdx similarity index 99% rename from content/docs/inapp-sdks/ios.mdx rename to content/docs/inapp-sdks/installation/ios.mdx index 42062c0..725ab6c 100644 --- a/content/docs/inapp-sdks/ios.mdx +++ b/content/docs/inapp-sdks/installation/ios.mdx @@ -1,5 +1,5 @@ --- -title: iOS SDK +title: iOS description: Reclaim Protocol's InApp iOS SDK for ZK proof generations for requests with an in-app experience of web verification --- @@ -319,7 +319,7 @@ func setOverrides() { } ``` -Read more about overrides in [Reclaim InApp SDK Documentation | Overrides](./usage/overrides) +Read more about overrides in [Reclaim InApp SDK Documentation | Overrides](../advanced/overrides) ## Upgrading diff --git a/content/docs/inapp-sdks/installation/meta.json b/content/docs/inapp-sdks/installation/meta.json new file mode 100644 index 0000000..3d9a7d1 --- /dev/null +++ b/content/docs/inapp-sdks/installation/meta.json @@ -0,0 +1,11 @@ +{ + "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/react-native-expo.mdx b/content/docs/inapp-sdks/installation/react-native-expo.mdx similarity index 69% rename from content/docs/inapp-sdks/react-native-expo.mdx rename to content/docs/inapp-sdks/installation/react-native-expo.mdx index 151df83..152f428 100644 --- a/content/docs/inapp-sdks/react-native-expo.mdx +++ b/content/docs/inapp-sdks/installation/react-native-expo.mdx @@ -1,12 +1,12 @@ --- -title: React Native Expo SDK +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. +The Reclaim Protocol SDK for Expo-managed React Native applications is available upon request. Contact our team to discuss implementation details. ### Stay Updated diff --git a/content/docs/inapp-sdks/react-native.mdx b/content/docs/inapp-sdks/installation/react-native.mdx similarity index 99% rename from content/docs/inapp-sdks/react-native.mdx rename to content/docs/inapp-sdks/installation/react-native.mdx index d344ff8..fb6a4b9 100644 --- a/content/docs/inapp-sdks/react-native.mdx +++ b/content/docs/inapp-sdks/installation/react-native.mdx @@ -1,5 +1,5 @@ --- -title: React Native SDK +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 --- @@ -343,7 +343,7 @@ reclaimVerification.setOverrides({ }) ``` -Read more about overrides in [Reclaim InApp SDK Documentation | Overrides](./usage/overrides) +Read more about overrides in [Reclaim InApp SDK Documentation | Overrides](../advanced/overrides) ## Contributing diff --git a/content/docs/inapp-sdks/introduction.mdx b/content/docs/inapp-sdks/introduction.mdx new file mode 100644 index 0000000..fe941bb --- /dev/null +++ b/content/docs/inapp-sdks/introduction.mdx @@ -0,0 +1,47 @@ +--- +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 index e8c0efb..00f6e27 100644 --- a/content/docs/inapp-sdks/meta.json +++ b/content/docs/inapp-sdks/meta.json @@ -1,12 +1,9 @@ { "title": "Reclaim InApp SDKs", "pages": [ - "android", - "ios", - "react-native", - "ionic-capacitor", - "flutter", - "react-native-expo", - "usage" + "introduction", + "installation", + "verification", + "advanced" ] } \ No newline at end of file diff --git a/content/docs/inapp-sdks/verification.mdx b/content/docs/inapp-sdks/verification.mdx new file mode 100644 index 0000000..5882649 --- /dev/null +++ b/content/docs/inapp-sdks/verification.mdx @@ -0,0 +1,122 @@ +--- +title: Backend Verification +description: Learn how to create session and verify with Reclaim Backend SDKs +--- + +import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; + +As best practice, we **strongly** recommend verifying proofs generated from client-side SDKs with a [Reclaim Protocol Backend SDK](http://localhost:3000/backend/installation). + +## Step-by-Step Guide + +### 1. Install the SDK + +Make sure you have installed the SDKs by following the instructions on the [Installation page](./../backend/installation). + +### 2. Prepare your variables +- You will need to have the `APPLICATION_ID` and `APPLICATION_SECRET` from dev.reclaimprotocol.org. +- You will also need to add providers to your application, keep the `PROVIDER_ID` handy too. +- The providers you add to the application, will be the providers you will be able to ask the user to generate a proof for. +- Make sure you add to your [Application from the dev tool](https://dev.reclaimprotocol.org/my-applications/). + +### 3. Get request URL from Backend SDK + +- Set the `useAppClip` option to `true` when initializing proof request: `ReclaimProofRequest.init`. +- Get the `request_url` by calling `getRequestUrl` method on proof request object. + +```js +import { ReclaimProofRequest } from '@reclaimprotocol/js-sdk'; + +app.get('/reclaim/request', async (req: any, res: any) => { + try { + const reclaimProofRequest = await ReclaimProofRequest.init(APPLICATION_ID, APPLICATION_SECRET, PROVIDER_ID, { useAppClip: true }) + + const request_url = await reclaimProofRequest.getRequestUrl() + + return res.json({ request_url }) + } catch (error) { + console.error('Error generating request config:', error) + return res.status(500).json({ error: 'Failed to generate request config' }) + } +}); +``` + +### 4. Generate proof on client mobile + +- Your native mobile application should use the `request_url` from the backend and start verification with this url. + + + + +Start verification with `request_url` using the following sample code: + +```swift +let result = try await ReclaimVerification.startVerification(.url(requestUrl)) +``` + +Send `result.proofs` to the backend for verification and further processing + + + + +Start verification with `request_url` using the following sample code: + +```kotlin +ReclaimVerification.startVerificationFromUrl( + context = context, + requestUrl = requestUrl, + handler = object : ReclaimVerification.ResultHandler { + override fun onException(exception: ReclaimVerification.ReclaimVerificationException) { + // + } + + override fun onResponse(response: ReclaimVerification.Response) { + Log.d("MainActivity", response.toString()) + // response.proofs + } + } +) +``` + +Send the `response.proofs`, that was received in handler's `onResponse` method, to the backend for verification and further processing + + + + +Start verification with `request_url` using the following sample code: + +```js +const sdk = new ReclaimVerification(); +// `startVerificationFromUrl` will be added to sdk in an upcoming update. +// For now, access it from `sdk.platform`. +const result = await sdk.platform.startVerificationFromUrl(requestUrl); +``` + +Send `result.proofs` to the backend for verification and further processing + + + + +### 5. Verify proofs at backend + +- Mobile application (client) should send the proof to your backend for verification and then processing. +- Use `verifyProof` from the reclaim backend sdk for verifying the proof received from the client. + +```js +import { verifyProof } from '@reclaimprotocol/js-sdk'; + +app.post('/reclaim/verify', async (req: any, res: any) => { + try { + const data = req.body; // json object/array as body + const is_valid = await verifyProof(data); + + if (is_valid) { + return res.json({ is_valid: is_valid }) + } + return res.status(400).json({ is_valid: is_valid }) + } catch (error) { + console.error('Error verifying proof:', error) + return res.status(500).json({ error: 'Failed to verify proof' }) + } +}) +``` diff --git a/package.json b/package.json index 027b022..ff44ee4 100644 --- a/package.json +++ b/package.json @@ -36,4 +36,4 @@ "tailwindcss": "^3.4.16", "typescript": "^5.7.2" } -} \ No newline at end of file +} diff --git a/public/assets/inapp/inapp_demo.mp4 b/public/assets/inapp/inapp_demo.mp4 new file mode 100644 index 0000000..aa241aa Binary files /dev/null and b/public/assets/inapp/inapp_demo.mp4 differ