Skip to content

Conversation

@transphorm
Copy link
Member

@transphorm transphorm commented Aug 31, 2025

Will work on polishing the demo app in a follow up pull request

iOS
Screenshot 2025-09-19 at 12 54 35 AM

Android
Screenshot 2025-09-19 at 12 59 19 AM

Summary

  • build a simple GenerateMock screen for the SDK demo app
  • link demo app to the mobile SDK package

Testing

  • yarn lint (fails: Unable to resolve path to module '@selfxyz/common/utils/passports/validate')
  • yarn build
  • yarn workspace @selfxyz/contracts build (fails: Invalid account in Hardhat config)
  • yarn types
  • yarn workspace @selfxyz/mobile-sdk-alpha test
  • yarn workspace demo-app test

https://chatgpt.com/codex/tasks/task_b_68b3c9451c78832d8df29a73733b293d

Summary by CodeRabbit

  • New Features

    • New Mobile Demo app with screen-based navigation and eight demo screens (Generate, Register, Prove, Camera, NFC, Onboarding, QR); mock document generator and flows to register or prove.
    • Native-styled React Native UI for demo screens; browser & RN crypto polyfills included.
    • CI bundle-size checker and demo-specific test/setup tooling.
  • Bug Fixes

    • Improved unsupported-web NFC messaging, Aadhaar handling adjustments, and image/source fixes.
  • Documentation

    • Added mobile-demo README; removed outdated demo docs.
  • Chores

    • Updated build, CI, Metro, Babel, Jest, lint configs and project scaffolding.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 31, 2025

Walkthrough

Adds a new mobile demo workspace and app, consolidates/commonizes many exports (including a noble-hashes crypto polyfill), migrates and rewires demo-app Android/iOS and Metro/Jest/Vite configs, refactors many imports to @selfxyz/common, and updates CI/workspace/build scripts and tests.

Changes

Cohort / File(s) Summary
New demo workspace & app
packages/mobile-sdk-demo/*, packages/mobile-sdk-demo/App.tsx, packages/mobile-sdk-demo/src/*.tsx, packages/mobile-sdk-demo/package.json, packages/mobile-sdk-demo/android/**, packages/mobile-sdk-demo/ios/**
New React Native demo app with screen-based navigation, placeholder feature screens, platform projects, Metro/Jest/Babel/ESLint/Prettier configs, Gradle wrapper and Gradle/Pod wiring, test fixtures, a crypto polyfill wrapper, and CI/bundle analysis scripts.
Demo app UI / navigation
packages/mobile-sdk-demo/App.tsx, packages/mobile-sdk-demo/src/{GenerateMock,RegisterDocument,ProveQRCode,DocumentCamera,DocumentNFCScan,DocumentOnboarding,QRCodeViewFinder}.tsx, packages/mobile-sdk-demo/src/*
Adds App screen state + navigate helper, mockDocument state flow, lazy require-based screen loading, MenuButton component, and multiple screen UI scaffolds with styles.
Old demo cleanup / relocation
packages/mobile-sdk-alpha/demo-app/**, packages/mobile-sdk-alpha/demo-app/android/**, packages/mobile-sdk-alpha/demo-app/metro.config.cjs
Removes MainActivity/MainApplication for old demo, rewrites Android Gradle RN config (explicit RN artifacts, hermes), updates metro to workspace-aware watchFolders/extraNodeModules, and strips legacy react { } block.
Root workspace & CI config
package.json, .github/workflows/mobile-sdk-demo-ci.yml, .github/workflows/mobile-e2e.yml, .yarnrc.yml, .gitignore, .cursorignore
Reframes Yarn workspaces object, adds build:demo/build:mobile-sdk/demo:mobile scripts, changes CI path filters and adds topological build step, adjusts e2e verbosity, and sets nmHoistingLimits.
Common exports & crypto polyfill
common/index.ts, common/src/polyfills/crypto.ts, common/package.json, common/tests/*, common/src/types/globals.d.ts
Expands public exports (types/utilities), adds @noble/hashes-based crypto polyfill (createHash/createHmac/pbkdf2Sync/randomBytes), adds tests for hash/HMAC, and declares global DEV type.
Mobile SDK alpha: UI, exports, and build
packages/mobile-sdk-alpha/src/components/screens/*, packages/mobile-sdk-alpha/src/index.ts, packages/mobile-sdk-alpha/tsup.config.ts, packages/mobile-sdk-alpha/tsconfig.json, packages/mobile-sdk-alpha/vitest.config.ts, packages/mobile-sdk-alpha/.eslintrc.cjs
Replaces Tamagui screens with RN primitives, consolidates imports to @selfxyz/common, updates export path for generateTEEInputsDisclose → generateDisclosureInputs, enables tsup splitting and extends externals, and tightens lint/test configs.
App (main) tooling & resolver
app/metro.config.cjs, app/package.json, app/tsconfig.json, babel.config.js, app/ios/Podfile, app/web/index.html, app/declarations.d.ts, app/src/mocks/nfcScanner.ts
Makes Metro workspace-aware with custom resolveRequest and node redirects, updates deps/resolutions and TS paths, adds babel.config, web Buffer shims, NFC web mock, and Podfile tweaks.
Proving / Aadhaar / stores
app/src/utils/proving/provingMachine.ts, app/src/providers/*, app/src/stores/*, various app screens and tests
Adds Aadhaar-specific guards (DSC disallowed), changes alt-CSCA mapping for Aadhaar to Record<string,string>, improves per-item error handling in DB updates, and updates many import paths and test mocks to match new barrels.
Scripts & header tooling
scripts/check-duplicate-headers.cjs, scripts/check-license-headers.mjs, scripts/lint-headers.cjs
Extend license/header checks to accept multiple roots and add lint wrapper that runs duplicate-header and license checks (with --fix support).
Misc tooling & tests
app/jest.setup.js, packages/mobile-sdk-demo/jest.setup.js, packages/mobile-sdk-demo/jest.config.cjs, packages/mobile-sdk-demo/scripts/*, sdk/*/package.json, various tests`
Adds deterministic Jest setup mocks, new bundle-analyze CI script, adds webpack devDeps in some SDK packages, adjusts many tests/mocks to reflect moved/renamed modules and polyfills.

Sequence Diagram(s)

%%{init: {"themeVariables":{"primaryColor":"#0b5fff","secondaryColor":"#00a676"}}}%%
sequenceDiagram
  autonumber
  participant User
  participant DemoApp as packages/mobile-sdk-demo/App
  participant Screen as Screen Component
  participant Common as @selfxyz/common
  participant SDK as @selfxyz/mobile-sdk-alpha

  User->>DemoApp: tap "Generate Mock"
  DemoApp->>DemoApp: set screen = 'generate'
  DemoApp->>Screen: require('GenerateMock') (lazy)
  Screen->>Common: generateMockDocument(params)
  Common-->>Screen: IDDocument
  Screen-->>DemoApp: onGenerate(document)
  DemoApp->>DemoApp: set mockDocument
  DemoApp->>SDK: register/prove flows use mockDocument
  SDK->>Common: use crypto polyfill (createHash, randomBytes, pbkdf2Sync)
  Common-->>SDK: cryptographic results
Loading
%%{init: {"themeVariables":{"primaryColor":"#7b61ff","tertiaryColor":"#f6c343"}}}%%
sequenceDiagram
  autonumber
  participant Module
  participant Common as @selfxyz/common
  participant Poly as crypto polyfill
  participant WebCrypto as globalThis.crypto

  Module->>Common: import { createHash, randomBytes, pbkdf2Sync }
  Common->>Poly: re-export polyfill implementations
  Module->>Poly: createHash('sha256').update(msg).digest('hex')
  Poly->>WebCrypto: getRandomValues(...) for randomBytes
  Poly-->>Module: Buffer/Uint8Array/hex result
  Note right of Poly: throws helpful error if WebCrypto unavailable
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120+ minutes

Possibly related PRs

Suggested reviewers

  • aaronmgdr

Poem

In demo halls new screens unfurl,
Hashes hum and buffers whirl.
Exports tidy, builds aligned,
Aadhaar guarded, tests defined.
Merge the branch — the demo's primed! 🚀

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Title Check ✅ Passed The title “[SELF-700] feat: add mock document generator demo” succinctly describes the primary new feature—adding a mock document generator screen to the demo app—and adheres to a clear, conventional commit style without extraneous details. This phrasing focuses on the main enhancement and will make the change easily discoverable in project history.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/ideate-mock-document-screen-for-demo-app

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@transphorm transphorm marked this pull request as ready for review August 31, 2025 05:25
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (2)
packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx (1)

114-121: Consider guarding result rendering in production if real data could appear.

If this screen ever receives real documents, rendering full JSON is unsafe. Gate behind DEV or redact sensitive fields before display.

Do we guarantee only synthetic/mock data reaches this screen? If not, I can add a redact helper that whitelists non-sensitive fields.

packages/mobile-sdk-alpha/demo-app/App.tsx (1)

10-39: Consider wrapping App with the SDK provider now to avoid future integration churn.

Per prior learnings, SelfClientProvider should sit at the top so screens can opt-in to useSelfClient without refactoring App later. Even if current screens don’t call the SDK, adding the provider now reduces future risk and aligns with the “link to mobile SDK” objective.

If the provider is available via the SDK entrypoint, the structure would look like:

 import React, { useState } from 'react';
 import { Button, StyleSheet, Text, View } from 'react-native';
+// import { SelfClientProvider } from '@selfxyz/mobile-sdk-alpha' // verify actual export path

 function App() {
-  return (
-    <View style={styles.container}>
+  return (
+    // <SelfClientProvider config={/* minimal demo config */}>
+    <View style={styles.container}>
       ...
-    </View>
+    </View>
+    // </SelfClientProvider>
   );
 }

Please confirm the correct provider import path and whether minimal demo config is ready; I can follow up with a precise snippet once confirmed.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled
  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 520c05d and e8a92b6.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (6)
  • packages/mobile-sdk-alpha/demo-app/App.tsx (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/package.json (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/src/ProveQRCode.tsx (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/src/RegisterDocument.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/technical-specification.mdc)

**/*.{ts,tsx}: Define IdentityCommitment with fields: commitment (Poseidon hash), nullifier (domain-separated), timestamp (UTC number), version (circuit version), documentType ('passport' | 'eu_id_card')
Define DSCKeyCommitment with fields: publicKeyHash (Poseidon hash), certificateChain (hashes), revocationStatus (boolean), issuer (country code)
Define VerificationConfig with fields: circuitVersion (semver), complianceRules array, timeWindow (seconds, 24h), clockDrift (±5 min), trustAnchors, revocationRoots, timeSource (NTP), nullifierScope (domain separation)

Files:

  • packages/mobile-sdk-alpha/demo-app/src/RegisterDocument.tsx
  • packages/mobile-sdk-alpha/demo-app/src/ProveQRCode.tsx
  • packages/mobile-sdk-alpha/demo-app/App.tsx
  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
packages/mobile-sdk-alpha/**/*.{ts,tsx}

📄 CodeRabbit inference engine (packages/mobile-sdk-alpha/AGENTS.md)

packages/mobile-sdk-alpha/**/*.{ts,tsx}: Use strict TypeScript type checking across the codebase
Follow ESLint TypeScript-specific rules
Avoid introducing circular dependencies

Files:

  • packages/mobile-sdk-alpha/demo-app/src/RegisterDocument.tsx
  • packages/mobile-sdk-alpha/demo-app/src/ProveQRCode.tsx
  • packages/mobile-sdk-alpha/demo-app/App.tsx
  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
packages/mobile-sdk-alpha/**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

packages/mobile-sdk-alpha/**/*.{ts,tsx,js,jsx}: Review alpha mobile SDK code for:

  • API consistency with core SDK
  • Platform-neutral abstractions
  • Performance considerations
  • Clear experimental notes or TODOs

Files:

  • packages/mobile-sdk-alpha/demo-app/src/RegisterDocument.tsx
  • packages/mobile-sdk-alpha/demo-app/src/ProveQRCode.tsx
  • packages/mobile-sdk-alpha/demo-app/App.tsx
  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
packages/mobile-sdk-alpha/**/package.json

📄 CodeRabbit inference engine (packages/mobile-sdk-alpha/AGENTS.md)

packages/mobile-sdk-alpha/**/package.json: Ensure package exports are properly configured
Verify package conditions are valid (e.g., exports conditions)

Files:

  • packages/mobile-sdk-alpha/demo-app/package.json
packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}}

📄 CodeRabbit inference engine (packages/mobile-sdk-alpha/AGENTS.md)

packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}}: Do NOT mock @selfxyz/mobile-sdk-alpha in tests (avoid jest.mock('@selfxyz/mobile-sdk-alpha') and replacing real functions with mocks)
Use actual imports from @selfxyz/mobile-sdk-alpha in tests
Write integration tests that exercise the real validation logic (not mocks)
Test isPassportDataValid() with realistic synthetic passport data (never real user data)
Verify extractMRZInfo() using published sample MRZ strings (e.g., ICAO examples)
Ensure parseNFCResponse() works with representative, synthetic NFC data
Never use real user PII in tests; use only synthetic, anonymized, or approved test vectors

Files:

  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
**/*.{test,spec}.{ts,js,tsx,jsx}

⚙️ CodeRabbit configuration file

**/*.{test,spec}.{ts,js,tsx,jsx}: Review test files for:

  • Test coverage completeness
  • Test case quality and edge cases
  • Mock usage appropriateness
  • Test readability and maintainability

Files:

  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
🧠 Learnings (23)
📓 Common learnings
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/demo/** : Provide an in-SDK lightweight React Native demo under packages/mobile-sdk-alpha/demo/
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/src/index.ts : Re-export new SDK modules via packages/mobile-sdk-alpha/src/index.ts

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/src/RegisterDocument.tsx
  • packages/mobile-sdk-alpha/demo-app/package.json
  • packages/mobile-sdk-alpha/demo-app/App.tsx
  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/demo/** : Provide an in-SDK lightweight React Native demo under packages/mobile-sdk-alpha/demo/

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/package.json
  • packages/mobile-sdk-alpha/demo-app/App.tsx
📚 Learning: 2025-08-29T15:31:15.911Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.911Z
Learning: Applies to packages/mobile-sdk-alpha/**/*.{ts,tsx} : Avoid introducing circular dependencies

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/package.json
📚 Learning: 2025-08-29T15:31:15.911Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.911Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Use actual imports from selfxyz/mobile-sdk-alpha in tests

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/package.json
  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/package.json : Enable tree shaking for the SDK (e.g., ensure 'sideEffects' is correctly set in package.json and exports are ESM-friendly)

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/package.json
📚 Learning: 2025-08-29T15:31:15.911Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.911Z
Learning: Applies to packages/mobile-sdk-alpha/**/package.json : Ensure package exports are properly configured

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Update the app to consume the mobile-sdk-alpha package and replace local modules with SDK imports

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/README.md : Document new/updated SDK modules and usage in packages/mobile-sdk-alpha/README.md

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/samples/** : Create sample applications under packages/mobile-sdk-alpha/samples/ (RN demo and web demo)

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/package.json
📚 Learning: 2025-08-29T15:31:15.911Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.911Z
Learning: Applies to packages/mobile-sdk-alpha/**/package.json : Verify package conditions are valid (e.g., exports conditions)

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/package.json
📚 Learning: 2025-08-26T14:49:11.190Z
Learnt from: shazarre
PR: selfxyz/self#936
File: app/src/screens/passport/PassportNFCScanScreen.tsx:28-31
Timestamp: 2025-08-26T14:49:11.190Z
Learning: The main App.tsx file is located at app/App.tsx (not in app/src), and it properly wraps the entire app with SelfClientProvider at the top of the provider hierarchy, enabling useSelfClient() hook usage throughout all navigation screens.

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/App.tsx
📚 Learning: 2025-08-24T18:52:25.796Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-08-24T18:52:25.796Z
Learning: Applies to src/navigation/**/*.{ts,tsx} : Set platform-specific initial routes: web → Home, mobile → Splash

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/App.tsx
📚 Learning: 2025-08-24T18:52:25.796Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-08-24T18:52:25.796Z
Learning: Applies to src/navigation/**/*.{ts,tsx} : Use react-navigation/native with createStaticNavigation for type-safe navigation

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/App.tsx
📚 Learning: 2025-08-29T15:31:15.911Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.911Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Do NOT mock selfxyz/mobile-sdk-alpha in tests (avoid jest.mock('selfxyz/mobile-sdk-alpha') and replacing real functions with mocks)

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
📚 Learning: 2025-08-29T15:31:15.911Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.911Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Test isPassportDataValid() with realistic synthetic passport data (never real user data)

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to app/jest.setup.js : Provide comprehensive Jest setup in app/jest.setup.js with required mocks

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
📚 Learning: 2025-08-24T18:52:25.796Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-08-24T18:52:25.796Z
Learning: Applies to jest.setup.js : Maintain comprehensive mocks in jest.setup.js for all native modules

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
📚 Learning: 2025-08-29T15:31:15.911Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.911Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Write integration tests that exercise the real validation logic (not mocks)

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
📚 Learning: 2025-08-29T15:31:15.911Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.911Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Verify extractMRZInfo() using published sample MRZ strings (e.g., ICAO examples)

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
📚 Learning: 2025-08-29T15:31:15.911Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.911Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Ensure parseNFCResponse() works with representative, synthetic NFC data

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
📚 Learning: 2025-08-29T15:31:15.911Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.911Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Never use real user PII in tests; use only synthetic, anonymized, or approved test vectors

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
📚 Learning: 2025-08-24T18:52:25.796Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-08-24T18:52:25.796Z
Learning: Applies to tests/src/**/*.{test,spec}.{ts,tsx,js,jsx} : Use renderHook for custom hook testing

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
🧬 Code graph analysis (2)
packages/mobile-sdk-alpha/demo-app/src/RegisterDocument.tsx (2)
app/src/screens/MainScreen.tsx (1)
  • setSelectedTab (343-343)
app/src/screens/AppScreen.tsx (2)
  • AppScreenProps (11-14)
  • registered (94-100)
packages/mobile-sdk-alpha/demo-app/App.tsx (3)
packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx (1)
  • GenerateMock (30-125)
packages/mobile-sdk-alpha/demo-app/src/RegisterDocument.tsx (1)
  • RegisterDocument (13-21)
packages/mobile-sdk-alpha/demo-app/src/ProveQRCode.tsx (1)
  • ProveQRCode (13-21)
🪛 GitHub Actions: Mobile SDK Demo CI
packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx

[error] 9-9: During 'yarn workspace demo-app build': TS2307: Cannot find module '@selfxyz/mobile-sdk-alpha' or its corresponding type declarations.

⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: build-android
  • GitHub Check: test
  • GitHub Check: build-ios
  • GitHub Check: analyze-android
🔇 Additional comments (6)
packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx (1)

9-12: Switch deep CJS require to stable ESM export
Metro bundler will break on a deep-path CJS import and you lose TypeScript types. Replace

// eslint-disable-next-line @typescript-eslint/no-var-requires
const { countryCodes } = require('@selfxyz/common/dist/cjs/src/constants/constants.cjs');

with

import { countryCodes } from '@selfxyz/common/constants';

Verify that countryCodes is re-exported in @selfxyz/common (update its exports and type declarations if needed).

packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx (1)

10-16: LGTM — test aligns with the new button-based menu.

The assertions reflect the current UI and avoid mocking the SDK, matching our testing guidance.

packages/mobile-sdk-alpha/demo-app/App.tsx (4)

5-6: LGTM on base imports.

Appropriate minimal RN imports; no perf or security issues here.


8-8: Screen union is clear and type-safe.

Keeps navigation states constrained to known routes.


11-15: State and navigation are straightforward and side-effect free.

No unnecessary re-renders or leaks; fine for a lightweight demo flow.


31-37: Home UI is simple and deterministic.

Buttons are explicit and keep the flow predictable; no perf or security concerns.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled
  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between fd65a2c and 9458b00.

⛔ Files ignored due to path filters (1)
  • app/Gemfile.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • .github/workflows/mobile-sdk-demo-ci.yml (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
.github/workflows/**/*.{yml,yaml}

📄 CodeRabbit inference engine (AGENTS.md)

.github/workflows/**/*.{yml,yaml}: In GitHub Actions workflows, use shared composite caching actions from .github/actions (cache-yarn, cache-bundler, cache-gradle, cache-pods)
Do not call actions/cache directly; rely on the shared composite caching actions
When using cache actions, optionally pass cache-version (often with GH_CACHE_VERSION and tool version) for stable keys

Files:

  • .github/workflows/mobile-sdk-demo-ci.yml
🧠 Learnings (6)
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/package.json : Expose a 'test:build' script in the SDK's package.json that runs build, test, types, and lint

Applied to files:

  • .github/workflows/mobile-sdk-demo-ci.yml
📚 Learning: 2025-08-24T18:52:25.796Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-08-24T18:52:25.796Z
Learning: Use yarn scripts: yarn ios/android for builds, yarn test for unit tests, and Fastlane for deployments

Applied to files:

  • .github/workflows/mobile-sdk-demo-ci.yml
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to app/package.json : Expose a 'test:build' script in the app's package.json that builds deps, types, performs bundle analysis, and runs tests

Applied to files:

  • .github/workflows/mobile-sdk-demo-ci.yml
📚 Learning: 2025-08-29T15:29:47.689Z
Learnt from: CR
PR: selfxyz/self#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:29:47.689Z
Learning: Use nvm and Corepack to set up the Yarn v4 monorepo before any other commands (nvm use; corepack enable; corepack prepare yarnstable --activate; yarn install)

Applied to files:

  • .github/workflows/mobile-sdk-demo-ci.yml
📚 Learning: 2025-08-29T15:29:47.689Z
Learnt from: CR
PR: selfxyz/self#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:29:47.689Z
Learning: Before committing, run repository checks (yarn nice, yarn lint, yarn build, contracts build, yarn types)

Applied to files:

  • .github/workflows/mobile-sdk-demo-ci.yml
📚 Learning: 2025-08-29T15:31:15.911Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.911Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Use actual imports from selfxyz/mobile-sdk-alpha in tests

Applied to files:

  • .github/workflows/mobile-sdk-demo-ci.yml
⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: e2e-ios
  • GitHub Check: analyze-android

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 9

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/mobile-sdk-alpha/package.json (1)

53-53: Publishing pipeline uses npm in a Yarn v4 monorepo

Using npm here can break CI/publish environments that rely on Yarn Plug’n’Play and Yarn’s script lifecycle.

Apply this diff:

-    "prepublishOnly": "npm run build && npm run typecheck && npm run validate:exports && npm run validate:pkg",
+    "prepublishOnly": "yarn build && yarn typecheck && yarn validate:exports && yarn validate:pkg",
♻️ Duplicate comments (4)
packages/mobile-sdk-alpha/demo-app/src/ProveQRCode.tsx (1)

5-7: Gate document JSON behind DEV and memoize to prevent PII leaks and re-render jank.

Rendering raw document data in production risks sensitive info exposure; stringify on every render is also costly for large payloads. Gate to dev and memoize the pretty-print.

Apply:

- import React from 'react';
+ import React, { useMemo } from 'react';
  import { Button, ScrollView, StyleSheet, Text, View } from 'react-native';
@@
-export default function ProveQRCode({ document, onBack }: Props) {
-  return (
+export default function ProveQRCode({ document, onBack }: Props) {
+  const prettyDoc = useMemo(
+    () => (document ? JSON.stringify(document, null, 2) : null),
+    [document]
+  );
+  return (
@@
-        {document && (
+        {__DEV__ && prettyDoc && (
           <View style={styles.documentSection}>
             <Text style={styles.documentTitle}>Mock Document Data:</Text>
             <Text style={styles.documentData} selectable>
-              {JSON.stringify(document, null, 2)}
+              {prettyDoc.length > 50000 ? prettyDoc.slice(0, 50000) + '\n…[truncated]' : prettyDoc}
             </Text>
           </View>
         )}

Run to find any other unguarded JSON rendering:

#!/bin/bash
set -euo pipefail

# JSON pretty-print occurrences likely rendered in UI
rg -nP --type=ts --type=tsx -C2 'JSON\.stringify\(' packages/mobile-sdk-alpha -g '!**/__tests__/**'

# Any direct render of "document" without __DEV__ guard in demo-app
rg -nP --type=tsx -C2 '(document\s*&&\s*<|{document[^}]*})' packages/mobile-sdk-alpha/demo-app

Also applies to: 13-18, 33-40

packages/mobile-sdk-alpha/demo-app/src/RegisterDocument.tsx (1)

33-40: Don’t render raw document JSON in production — gate behind DEV.

Rendering full document payloads can leak PII and bloat the UI. Show raw JSON only in development builds.

-        {document && (
+        {__DEV__ && document && (
           <View style={styles.documentSection}>
             <Text style={styles.documentTitle}>Mock Document Data:</Text>
             <Text style={styles.documentData} selectable>
               {JSON.stringify(document, null, 2)}
             </Text>
           </View>
-        )}
+        )}
packages/mobile-sdk-alpha/demo-app/App.tsx (2)

16-29: Inline require returns any — add typed assertions to preserve strict props checking.

Keep Metro’s inlineRequires, but assert component types so TS validates props in the alpha SDK.

   if (screen === 'generate') {
-    const GenerateMock = require('./src/GenerateMock').default;
+    const GenerateMock = require('./src/GenerateMock').default as GenerateMockCmp;
     return <GenerateMock onGenerate={setMockDocument} onNavigate={navigate} onBack={() => navigate('home')} />;
   }

   if (screen === 'register') {
-    const RegisterDocument = require('./src/RegisterDocument').default;
+    const RegisterDocument = require('./src/RegisterDocument').default as RegisterDocumentCmp;
     return <RegisterDocument document={mockDocument} onBack={() => navigate('home')} />;
   }

   if (screen === 'prove') {
-    const ProveQRCode = require('./src/ProveQRCode').default;
+    const ProveQRCode = require('./src/ProveQRCode').default as ProveQRCodeCmp;
     return <ProveQRCode document={mockDocument} onBack={() => navigate('home')} />;
   }

   if (screen === 'camera') {
-    const DocumentCamera = require('./src/DocumentCamera').default;
+    const DocumentCamera = require('./src/DocumentCamera').default as DocumentCameraCmp;
     return <DocumentCamera onBack={() => navigate('home')} />;
   }

   if (screen === 'nfc') {
-    const DocumentNFCScan = require('./src/DocumentNFCScan').default;
+    const DocumentNFCScan = require('./src/DocumentNFCScan').default as DocumentNFCScanCmp;
     return <DocumentNFCScan onBack={() => navigate('home')} />;
   }

   if (screen === 'onboarding') {
-    const DocumentOnboarding = require('./src/DocumentOnboarding').default;
+    const DocumentOnboarding = require('./src/DocumentOnboarding').default as DocumentOnboardingCmp;
     return <DocumentOnboarding onPress={() => navigate('home')} onBack={() => navigate('home')} />;
   }

   if (screen === 'qr') {
-    const QRCodeViewFinder = require('./src/QRCodeViewFinder').default;
+    const QRCodeViewFinder = require('./src/QRCodeViewFinder').default as QRCodeViewFinderCmp;
     return <QRCodeViewFinder onBack={() => navigate('home')} />;
   }

Add near the top (outside the changed ranges):

type GenerateMockCmp = typeof import('./src/GenerateMock').default;
type RegisterDocumentCmp = typeof import('./src/RegisterDocument').default;
type ProveQRCodeCmp = typeof import('./src/ProveQRCode').default;
type DocumentCameraCmp = typeof import('./src/DocumentCamera').default;
type DocumentNFCScanCmp = typeof import('./src/DocumentNFCScan').default;
type DocumentOnboardingCmp = typeof import('./src/DocumentOnboarding').default;
type QRCodeViewFinderCmp = typeof import('./src/QRCodeViewFinder').default;

Also applies to: 31-49


16-49: Annotate all inline requires with explicit types
To comply with strict TypeScript checking, add a type assertion to each require('./src/...').default.
Affected in packages/mobile-sdk-alpha/demo-app/App.tsx at lines 17, 22, 27, 32, 37, 42, 47.
Example:

const GenerateMock = require('./src/GenerateMock').default as React.ComponentType<GenerateMockProps>;
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled
  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 9458b00 and 53c7983.

📒 Files selected for processing (18)
  • package.json (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/App.tsx (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/android/app/build.gradle (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/android/app/src/main/java/com/selfdemoapp/MainActivity.kt (0 hunks)
  • packages/mobile-sdk-alpha/demo-app/android/app/src/main/java/com/selfdemoapp/MainApplication.kt (0 hunks)
  • packages/mobile-sdk-alpha/demo-app/android/app/src/main/java/com/selfxyz/demoapp/MainActivity.kt (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/android/app/src/main/java/com/selfxyz/demoapp/MainApplication.kt (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/android/app/src/main/res/layout/activity_main.xml (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/android/build.gradle (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/android/settings.gradle (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/package.json (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/src/DocumentCamera.tsx (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/src/DocumentNFCScan.tsx (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/src/DocumentOnboarding.tsx (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/src/ProveQRCode.tsx (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/src/QRCodeViewFinder.tsx (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/src/RegisterDocument.tsx (1 hunks)
  • packages/mobile-sdk-alpha/package.json (1 hunks)
💤 Files with no reviewable changes (2)
  • packages/mobile-sdk-alpha/demo-app/android/app/src/main/java/com/selfdemoapp/MainApplication.kt
  • packages/mobile-sdk-alpha/demo-app/android/app/src/main/java/com/selfdemoapp/MainActivity.kt
✅ Files skipped from review due to trivial changes (1)
  • package.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/mobile-sdk-alpha/demo-app/package.json
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/technical-specification.mdc)

**/*.{ts,tsx}: Define IdentityCommitment with fields: commitment (Poseidon hash), nullifier (domain-separated), timestamp (UTC number), version (circuit version), documentType ('passport' | 'eu_id_card')
Define DSCKeyCommitment with fields: publicKeyHash (Poseidon hash), certificateChain (hashes), revocationStatus (boolean), issuer (country code)
Define VerificationConfig with fields: circuitVersion (semver), complianceRules array, timeWindow (seconds, 24h), clockDrift (±5 min), trustAnchors, revocationRoots, timeSource (NTP), nullifierScope (domain separation)

Files:

  • packages/mobile-sdk-alpha/demo-app/src/DocumentNFCScan.tsx
  • packages/mobile-sdk-alpha/demo-app/src/DocumentOnboarding.tsx
  • packages/mobile-sdk-alpha/demo-app/src/DocumentCamera.tsx
  • packages/mobile-sdk-alpha/demo-app/src/QRCodeViewFinder.tsx
  • packages/mobile-sdk-alpha/demo-app/src/RegisterDocument.tsx
  • packages/mobile-sdk-alpha/demo-app/src/ProveQRCode.tsx
  • packages/mobile-sdk-alpha/demo-app/App.tsx
packages/mobile-sdk-alpha/**/*.{ts,tsx}

📄 CodeRabbit inference engine (packages/mobile-sdk-alpha/AGENTS.md)

packages/mobile-sdk-alpha/**/*.{ts,tsx}: Use strict TypeScript type checking across the codebase
Follow ESLint TypeScript-specific rules
Avoid introducing circular dependencies

Files:

  • packages/mobile-sdk-alpha/demo-app/src/DocumentNFCScan.tsx
  • packages/mobile-sdk-alpha/demo-app/src/DocumentOnboarding.tsx
  • packages/mobile-sdk-alpha/demo-app/src/DocumentCamera.tsx
  • packages/mobile-sdk-alpha/demo-app/src/QRCodeViewFinder.tsx
  • packages/mobile-sdk-alpha/demo-app/src/RegisterDocument.tsx
  • packages/mobile-sdk-alpha/demo-app/src/ProveQRCode.tsx
  • packages/mobile-sdk-alpha/demo-app/App.tsx
packages/mobile-sdk-alpha/**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

packages/mobile-sdk-alpha/**/*.{ts,tsx,js,jsx}: Review alpha mobile SDK code for:

  • API consistency with core SDK
  • Platform-neutral abstractions
  • Performance considerations
  • Clear experimental notes or TODOs

Files:

  • packages/mobile-sdk-alpha/demo-app/src/DocumentNFCScan.tsx
  • packages/mobile-sdk-alpha/demo-app/src/DocumentOnboarding.tsx
  • packages/mobile-sdk-alpha/demo-app/src/DocumentCamera.tsx
  • packages/mobile-sdk-alpha/demo-app/src/QRCodeViewFinder.tsx
  • packages/mobile-sdk-alpha/demo-app/src/RegisterDocument.tsx
  • packages/mobile-sdk-alpha/demo-app/src/ProveQRCode.tsx
  • packages/mobile-sdk-alpha/demo-app/App.tsx
packages/mobile-sdk-alpha/package.json

📄 CodeRabbit inference engine (.cursor/rules/mobile-sdk-migration.mdc)

packages/mobile-sdk-alpha/package.json: Expose a 'test:build' script in the SDK's package.json that runs build, test, types, and lint
Enable tree shaking for the SDK (e.g., ensure 'sideEffects' is correctly set in package.json and exports are ESM-friendly)

Files:

  • packages/mobile-sdk-alpha/package.json
packages/mobile-sdk-alpha/**/package.json

📄 CodeRabbit inference engine (packages/mobile-sdk-alpha/AGENTS.md)

packages/mobile-sdk-alpha/**/package.json: Ensure package exports are properly configured
Verify package conditions are valid (e.g., exports conditions)

Files:

  • packages/mobile-sdk-alpha/package.json
🧠 Learnings (32)
📓 Common learnings
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/samples/** : Create sample applications under packages/mobile-sdk-alpha/samples/ (RN demo and web demo)
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/demo/** : Provide an in-SDK lightweight React Native demo under packages/mobile-sdk-alpha/demo/
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/demo/** : Provide an in-SDK lightweight React Native demo under packages/mobile-sdk-alpha/demo/

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/src/DocumentNFCScan.tsx
  • packages/mobile-sdk-alpha/demo-app/src/DocumentOnboarding.tsx
  • packages/mobile-sdk-alpha/demo-app/src/DocumentCamera.tsx
  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-alpha/demo-app/src/QRCodeViewFinder.tsx
  • packages/mobile-sdk-alpha/demo-app/src/RegisterDocument.tsx
  • packages/mobile-sdk-alpha/demo-app/android/settings.gradle
  • packages/mobile-sdk-alpha/demo-app/android/build.gradle
  • packages/mobile-sdk-alpha/demo-app/src/ProveQRCode.tsx
  • packages/mobile-sdk-alpha/demo-app/android/app/src/main/java/com/selfxyz/demoapp/MainActivity.kt
  • packages/mobile-sdk-alpha/demo-app/android/app/build.gradle
  • packages/mobile-sdk-alpha/demo-app/App.tsx
📚 Learning: 2025-08-29T15:31:15.911Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.911Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Ensure parseNFCResponse() works with representative, synthetic NFC data

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/src/DocumentNFCScan.tsx
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/README.md : Document new/updated SDK modules and usage in packages/mobile-sdk-alpha/README.md

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/src/DocumentNFCScan.tsx
  • packages/mobile-sdk-alpha/demo-app/src/DocumentOnboarding.tsx
  • packages/mobile-sdk-alpha/demo-app/src/DocumentCamera.tsx
  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-alpha/demo-app/src/RegisterDocument.tsx
  • packages/mobile-sdk-alpha/demo-app/android/build.gradle
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/src/index.ts : Re-export new SDK modules via packages/mobile-sdk-alpha/src/index.ts

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/src/DocumentNFCScan.tsx
  • packages/mobile-sdk-alpha/demo-app/src/DocumentOnboarding.tsx
  • packages/mobile-sdk-alpha/demo-app/src/DocumentCamera.tsx
  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-alpha/demo-app/src/QRCodeViewFinder.tsx
  • packages/mobile-sdk-alpha/demo-app/src/RegisterDocument.tsx
  • packages/mobile-sdk-alpha/demo-app/App.tsx
📚 Learning: 2025-08-29T15:30:12.155Z
Learnt from: CR
PR: selfxyz/self#0
File: app/AGENTS.md:0-0
Timestamp: 2025-08-29T15:30:12.155Z
Learning: Document complex native module changes for AI review

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/src/DocumentNFCScan.tsx
  • packages/mobile-sdk-alpha/demo-app/src/DocumentOnboarding.tsx
  • packages/mobile-sdk-alpha/demo-app/src/DocumentCamera.tsx
  • packages/mobile-sdk-alpha/demo-app/src/RegisterDocument.tsx
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/package.json : Expose a 'test:build' script in the SDK's package.json that runs build, test, types, and lint

Applied to files:

  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/package.json : Enable tree shaking for the SDK (e.g., ensure 'sideEffects' is correctly set in package.json and exports are ESM-friendly)

Applied to files:

  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-29T15:31:15.911Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.911Z
Learning: Applies to packages/mobile-sdk-alpha/**/package.json : Ensure package exports are properly configured

Applied to files:

  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/samples/** : Create sample applications under packages/mobile-sdk-alpha/samples/ (RN demo and web demo)

Applied to files:

  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-29T15:31:15.911Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.911Z
Learning: Applies to packages/mobile-sdk-alpha/**/package.json : Verify package conditions are valid (e.g., exports conditions)

Applied to files:

  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-29T15:31:15.911Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.911Z
Learning: Applies to packages/mobile-sdk-alpha/**/*.{ts,tsx} : Avoid introducing circular dependencies

Applied to files:

  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-alpha/demo-app/App.tsx
📚 Learning: 2025-08-29T15:31:15.911Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.911Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Use actual imports from selfxyz/mobile-sdk-alpha in tests

Applied to files:

  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-alpha/demo-app/App.tsx
📚 Learning: 2025-08-24T18:52:25.796Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-08-24T18:52:25.796Z
Learning: Use yarn scripts: yarn ios/android for builds, yarn test for unit tests, and Fastlane for deployments

Applied to files:

  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to app/package.json : Expose a 'test:build' script in the app's package.json that builds deps, types, performs bundle analysis, and runs tests

Applied to files:

  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-29T15:31:15.911Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.911Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Verify extractMRZInfo() using published sample MRZ strings (e.g., ICAO examples)

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/src/QRCodeViewFinder.tsx
  • packages/mobile-sdk-alpha/demo-app/App.tsx
📚 Learning: 2025-08-23T02:02:02.556Z
Learnt from: transphorm
PR: selfxyz/self#942
File: app/vite.config.ts:170-0
Timestamp: 2025-08-23T02:02:02.556Z
Learning: In the selfxyz/self React Native app, devTools from '@/navigation/devTools' are intentionally shipped to production builds for testing purposes, not excluded as is typical in most applications.

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/src/RegisterDocument.tsx
  • packages/mobile-sdk-alpha/demo-app/android/settings.gradle
  • packages/mobile-sdk-alpha/demo-app/src/ProveQRCode.tsx
📚 Learning: 2025-07-29T01:08:28.530Z
Learnt from: transphorm
PR: selfxyz/self#795
File: app/android/app/build.gradle:157-158
Timestamp: 2025-07-29T01:08:28.530Z
Learning: For this React Native project, the team prefers build flexibility over fail-fast behavior for release builds in app/android/app/build.gradle. They intentionally allow fallback to debug signing for local development runs, relying on Google Play Console validation to catch any improperly signed releases during upload.

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/android/settings.gradle
  • packages/mobile-sdk-alpha/demo-app/android/build.gradle
  • packages/mobile-sdk-alpha/demo-app/android/app/build.gradle
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Update the app to consume the mobile-sdk-alpha package and replace local modules with SDK imports

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/android/settings.gradle
  • packages/mobile-sdk-alpha/demo-app/android/build.gradle
  • packages/mobile-sdk-alpha/demo-app/android/app/build.gradle
📚 Learning: 2025-06-30T15:51:11.193Z
Learnt from: transphorm
PR: selfxyz/self#636
File: app/android/app/build.gradle:76-76
Timestamp: 2025-06-30T15:51:11.193Z
Learning: For React Native 0.80, the correct JSC version is `io.github.react-native-community:jsc-android:2026004.+`. This version was specifically built with Android NDK r23 to align with React Native 0.80's NDK requirements and prevent compatibility issues. The `2026004` version pattern is the official version for RN 0.80, not an outdated pin.

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/android/build.gradle
📚 Learning: 2025-08-26T14:49:11.190Z
Learnt from: shazarre
PR: selfxyz/self#936
File: app/src/screens/passport/PassportNFCScanScreen.tsx:28-31
Timestamp: 2025-08-26T14:49:11.190Z
Learning: The main App.tsx file is located at app/App.tsx (not in app/src), and it properly wraps the entire app with SelfClientProvider at the top of the provider hierarchy, enabling useSelfClient() hook usage throughout all navigation screens.

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/App.tsx
📚 Learning: 2025-08-24T18:52:25.796Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-08-24T18:52:25.796Z
Learning: Applies to src/navigation/**/*.{ts,tsx} : Use react-navigation/native with createStaticNavigation for type-safe navigation

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/App.tsx
📚 Learning: 2025-08-24T18:52:25.796Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-08-24T18:52:25.796Z
Learning: Applies to src/navigation/**/*.{ts,tsx} : Set platform-specific initial routes: web → Home, mobile → Splash

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/App.tsx
📚 Learning: 2025-08-26T14:41:41.821Z
Learnt from: shazarre
PR: selfxyz/self#936
File: app/src/screens/aesop/PassportOnboardingScreen.tsx:0-0
Timestamp: 2025-08-26T14:41:41.821Z
Learning: When verifying provider hierarchies in React Native apps, always check the main App.tsx file at the app root, not just navigation/index.tsx and layout files, as providers are often configured at the top-level App component.

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/App.tsx
📚 Learning: 2025-08-29T15:31:15.911Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.911Z
Learning: Applies to packages/mobile-sdk-alpha/**/*.{ts,tsx} : Use strict TypeScript type checking across the codebase

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/App.tsx
📚 Learning: 2025-08-29T15:31:15.911Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.911Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Do NOT mock selfxyz/mobile-sdk-alpha in tests (avoid jest.mock('selfxyz/mobile-sdk-alpha') and replacing real functions with mocks)

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/App.tsx
📚 Learning: 2025-08-29T15:31:15.911Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.911Z
Learning: Applies to packages/mobile-sdk-alpha/**/*.{ts,tsx} : Follow ESLint TypeScript-specific rules

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/App.tsx
📚 Learning: 2025-08-29T15:31:15.911Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.911Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Never use real user PII in tests; use only synthetic, anonymized, or approved test vectors

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/App.tsx
📚 Learning: 2025-08-29T15:31:15.911Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.911Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Write integration tests that exercise the real validation logic (not mocks)

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/App.tsx
📚 Learning: 2025-08-25T14:25:57.586Z
Learnt from: aaronmgdr
PR: selfxyz/self#951
File: app/src/providers/authProvider.web.tsx:17-18
Timestamp: 2025-08-25T14:25:57.586Z
Learning: The selfxyz/mobile-sdk-alpha/constants/analytics import path is properly configured with SDK exports, Metro aliases, and TypeScript resolution. Import changes from @/consts/analytics to this path are part of valid analytics migration, not TypeScript resolution issues.

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/App.tsx
📚 Learning: 2025-08-26T14:49:11.190Z
Learnt from: shazarre
PR: selfxyz/self#936
File: app/src/screens/passport/PassportNFCScanScreen.tsx:28-31
Timestamp: 2025-08-26T14:49:11.190Z
Learning: SelfClientProvider is wrapped in app/App.tsx, providing context for useSelfClient() hook usage throughout the React Native app navigation stacks.

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/App.tsx
📚 Learning: 2025-08-26T14:49:15.210Z
Learnt from: shazarre
PR: selfxyz/self#936
File: app/src/screens/passport/PassportNFCScanScreen.web.tsx:8-11
Timestamp: 2025-08-26T14:49:15.210Z
Learning: The main App.tsx file is located at app/App.tsx (at the app root), not at app/src/App.tsx, and contains the SelfClientProvider wrapping the entire application.

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/App.tsx
🧬 Code graph analysis (1)
packages/mobile-sdk-alpha/demo-app/App.tsx (7)
packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx (1)
  • GenerateMock (30-125)
packages/mobile-sdk-alpha/demo-app/src/RegisterDocument.tsx (1)
  • RegisterDocument (13-46)
packages/mobile-sdk-alpha/demo-app/src/ProveQRCode.tsx (1)
  • ProveQRCode (13-46)
packages/mobile-sdk-alpha/demo-app/src/DocumentCamera.tsx (1)
  • DocumentCamera (12-35)
packages/mobile-sdk-alpha/demo-app/src/DocumentNFCScan.tsx (1)
  • DocumentNFCScan (12-36)
packages/mobile-sdk-alpha/demo-app/src/DocumentOnboarding.tsx (1)
  • DocumentOnboarding (12-36)
packages/mobile-sdk-alpha/demo-app/src/QRCodeViewFinder.tsx (1)
  • QRCodeViewFinder (12-36)
⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: build-ios
  • GitHub Check: build-android
  • GitHub Check: test
  • GitHub Check: e2e-ios
  • GitHub Check: analyze-android
🔇 Additional comments (10)
packages/mobile-sdk-alpha/demo-app/src/DocumentOnboarding.tsx (1)

12-36: LGTM for placeholder screen.

Stateless, no side effects, and safe defaults. Good for demo wiring.

packages/mobile-sdk-alpha/demo-app/src/DocumentCamera.tsx (1)

12-35: LGTM for demo-only screen.

Clear separation and no runtime risks introduced.

packages/mobile-sdk-alpha/demo-app/src/DocumentNFCScan.tsx (1)

12-36: LGTM.

Appropriate placeholder; no medium+ risks.

packages/mobile-sdk-alpha/demo-app/src/QRCodeViewFinder.tsx (1)

12-36: LGTM.

Suitable for demo wiring; no security/perf issues introduced.

packages/mobile-sdk-alpha/package.json (1)

14-32: Export map and build entries validated
All source entrypoints exist under packages/mobile-sdk-alpha/src, tsup.config.ts correctly references them, and package.json exports align with the emitted dist files.

packages/mobile-sdk-alpha/demo-app/android/settings.gradle (1)

3-5: Prefer npx for cross-platform autolink
Replace the Yarn subcommand with an npx invocation to avoid brittle PATH resolution on CI/Windows:

 extensions.configure(com.facebook.react.ReactSettingsExtension){ ex ->
-  ex.autolinkLibrariesFromCommand(['yarn','exec','react-native','config'])
+  ex.autolinkLibrariesFromCommand(['npx','react-native','config'])
 }

Validate in CI by running from the app root (where the Gradle wrapper lives):

cd packages/mobile-sdk-alpha/demo-app
./gradlew -q :app:reactNativeAutolinkLibraries
packages/mobile-sdk-alpha/demo-app/android/build.gradle (4)

18-21: AGP 8.6: ensure Gradle wrapper compatibility to avoid build failure

AGP 8.6 requires a specific Gradle 8.x minimum. If the wrapper is older, configuration will fail early. Align gradle-wrapper.properties to the required version in this PR or pin AGP to what CI uses.

Use the script in the previous comment to confirm the wrapper version and bump if needed.


29-33: RN/JSC local Maven repos look correct for monorepo consumption

These paths match the monorepo layout and align with the team’s RN/JSC setup. Keep them confined to the demo-app scope (as done here).


13-15: Plugin portal added for Gradle plugins — good

Necessary for resolving non-Google/MavenCentral Gradle plugins.


3-8: Install and verify React Native & JSC versions

  • Gradle wrapper 8.12 with AGP 8.6.0 and JDK 17 is compatible.
  • React Native and JSC weren’t detected at repo root—install dependencies in packages/mobile-sdk-alpha/demo-app and rerun version checks (e.g. jq -r .version node_modules/react-native/package.json and node_modules/jsc-android/package.json) to confirm they work with NDK 27.0.11718014 and Kotlin 1.9.24.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
.github/workflows/mobile-sdk-demo-ci.yml (2)

3-9: Broaden path filters so changes in SDK/common trigger this CI

Right now, SDK changes won’t run this workflow unless demo-app files also change, risking stale CI signal for the demo. Include SDK and common packages that the demo depends on.

   pull_request:
     paths:
-      - "packages/mobile-sdk-alpha/demo-app/**"
+      - "packages/mobile-sdk-alpha/demo-app/**"
+      - "packages/mobile-sdk-alpha/**"
+      - "packages/common/**"
       - ".github/workflows/mobile-sdk-demo-ci.yml"
       - ".github/actions/**"

19-31: Add typecheck and lint to catch the unresolved import early

PR testing already reports “yarn lint” failing on an unresolved module. Run demo-app typecheck and lint in CI to fail fast before tests.

       - name: Install Dependencies
         uses: ./.github/actions/yarn-install
       - name: Build dependencies (topological)
         shell: bash
         run: |
           # Build demo-app and all its transitive workspace deps in the correct order
-          yarn workspaces foreach -At --from demo-app run build
+          yarn workspaces foreach -t --from demo-app run build
+      - name: Typecheck (demo-app)
+        run: |
+          yarn workspace demo-app types
+      - name: Lint (demo-app)
+        run: |
+          yarn workspace demo-app lint
       - name: Run demo app tests
         run: |
           yarn workspace demo-app test
packages/mobile-sdk-alpha/package.json (1)

15-21: Expose a react-native condition in exports to avoid wrong entrypoint resolution

With "exports" present, bundlers prioritize its conditions and may ignore the top-level "react-native" field. Add a "react-native" condition for the root entry to ensure Metro picks the ESM build consistently and to allow RN-specific shims if needed.

   "exports": {
     ".": {
       "types": "./dist/esm/index.d.ts",
       "browser": "./dist/esm/browser.js",
       "import": "./dist/esm/index.js",
-      "require": "./dist/cjs/index.cjs"
+      "react-native": "./dist/esm/index.js",
+      "require": "./dist/cjs/index.cjs"
     },
♻️ Duplicate comments (3)
.github/workflows/mobile-sdk-demo-ci.yml (1)

21-25: Limit the foreach scope: drop -A or you’ll build unrelated workspaces (e.g., contracts) and fail CI

Using -A builds every workspace, ignoring --from demo-app intent. This can inadvertently hit @selfxyz/contracts and reproduce the “Invalid account in Hardhat config” failure noted in PR testing. Restrict to the demo-app dependency graph only.

-          yarn workspaces foreach -At --from demo-app run build
+          # Build only demo-app and its transitive workspace deps, in-order
+          yarn workspaces foreach -t --from demo-app run build
packages/mobile-sdk-alpha/demo-app/android/app/src/main/java/com/selfxyz/demoapp/MainApplication.kt (1)

13-46: Ensure Application class is registered in AndroidManifest

If android:name isn’t set to .MainApplication on , this class won’t be used.

#!/bin/bash
rg -nP '<application[^>]*android:name="\.MainApplication"' -C2 packages/mobile-sdk-alpha/demo-app/android/app/src/main/AndroidManifest.xml || {
  echo "Missing android:name on <application>"; exit 1; }
packages/mobile-sdk-alpha/demo-app/android/app/build.gradle (1)

2-2: RN Gradle plugin applied — previous blocker resolved

This unblocks Metro bundling, Hermes config, and autolink wiring.

🧹 Nitpick comments (2)
packages/mobile-sdk-alpha/demo-app/android/app/build.gradle (2)

46-49: Avoid blanket pickFirst on Hermes libs; use modern AGP packaging DSL and scope precisely

pickFirst can mask ABI collisions. Prefer AGP 8+ packaging.jniLibs and constrain to the exact files you need.

-    packagingOptions {
-        pickFirst '**/libhermes.so'
-        pickFirst '**/libhermes_executor.so'
-    }
+    packaging {
+        jniLibs {
+            // Narrow if possible (e.g., to specific ABIs) instead of global globs.
+            pickFirsts += ['**/libhermes.so', '**/libhermes_executor.so']
+        }
+    }

5-11: Monorepo path overrides in react{} are brittle; prefer plugin auto-detection

Hardcoding root/reactNativeDir/codegenDir/cliFile is easy to desync with repo moves and RN upgrades. The plugin discovers these automatically and wires autolink.

-react {
-    root = file("../../../../../")
-    reactNativeDir = file("../../../../../node_modules/react-native")
-    codegenDir = file("../../../../../node_modules/@react-native/codegen")
-    cliFile = file("../../../../../node_modules/react-native/cli.js")
-    autolinkLibrariesWithApp()
-}
+// The RN Gradle plugin auto-detects project root and autolink; explicit react{} is typically unnecessary.

If you keep it for edge cases, at minimum drop the explicit deps in dependencies{} (see other comment).

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled
  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 53c7983 and b1f42db.

📒 Files selected for processing (11)
  • .github/workflows/mobile-sdk-demo-ci.yml (1 hunks)
  • .gitignore (1 hunks)
  • .watchmanconfig (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/App.tsx (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/android/app/build.gradle (2 hunks)
  • packages/mobile-sdk-alpha/demo-app/android/app/src/main/java/com/selfxyz/demoapp/MainActivity.kt (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/android/app/src/main/java/com/selfxyz/demoapp/MainApplication.kt (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/android/build.gradle (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/android/gradle.properties (2 hunks)
  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx (1 hunks)
  • packages/mobile-sdk-alpha/package.json (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .gitignore
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/mobile-sdk-alpha/demo-app/android/app/src/main/java/com/selfxyz/demoapp/MainActivity.kt
  • packages/mobile-sdk-alpha/demo-app/App.tsx
  • packages/mobile-sdk-alpha/demo-app/android/build.gradle
🧰 Additional context used
📓 Path-based instructions (6)
.github/workflows/**/*.{yml,yaml}

📄 CodeRabbit inference engine (AGENTS.md)

.github/workflows/**/*.{yml,yaml}: In GitHub Actions workflows, use shared composite caching actions from .github/actions (cache-yarn, cache-bundler, cache-gradle, cache-pods)
Do not call actions/cache directly; rely on the shared composite caching actions
When using cache actions, optionally pass cache-version (often with GH_CACHE_VERSION and tool version) for stable keys

Files:

  • .github/workflows/mobile-sdk-demo-ci.yml
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/technical-specification.mdc)

**/*.{ts,tsx}: Define IdentityCommitment with fields: commitment (Poseidon hash), nullifier (domain-separated), timestamp (UTC number), version (circuit version), documentType ('passport' | 'eu_id_card')
Define DSCKeyCommitment with fields: publicKeyHash (Poseidon hash), certificateChain (hashes), revocationStatus (boolean), issuer (country code)
Define VerificationConfig with fields: circuitVersion (semver), complianceRules array, timeWindow (seconds, 24h), clockDrift (±5 min), trustAnchors, revocationRoots, timeSource (NTP), nullifierScope (domain separation)

Files:

  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
packages/mobile-sdk-alpha/**/*.{ts,tsx}

📄 CodeRabbit inference engine (packages/mobile-sdk-alpha/AGENTS.md)

packages/mobile-sdk-alpha/**/*.{ts,tsx}: Use strict TypeScript type checking across the codebase
Follow ESLint TypeScript-specific rules
Avoid introducing circular dependencies

Files:

  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
packages/mobile-sdk-alpha/**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

packages/mobile-sdk-alpha/**/*.{ts,tsx,js,jsx}: Review alpha mobile SDK code for:

  • API consistency with core SDK
  • Platform-neutral abstractions
  • Performance considerations
  • Clear experimental notes or TODOs

Files:

  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
packages/mobile-sdk-alpha/package.json

📄 CodeRabbit inference engine (.cursor/rules/mobile-sdk-migration.mdc)

packages/mobile-sdk-alpha/package.json: Expose a 'test:build' script in the SDK's package.json that runs build, test, types, and lint
Enable tree shaking for the SDK (e.g., ensure 'sideEffects' is correctly set in package.json and exports are ESM-friendly)

Files:

  • packages/mobile-sdk-alpha/package.json
packages/mobile-sdk-alpha/**/package.json

📄 CodeRabbit inference engine (packages/mobile-sdk-alpha/AGENTS.md)

packages/mobile-sdk-alpha/**/package.json: Ensure package exports are properly configured
Verify package conditions are valid (e.g., exports conditions)

Files:

  • packages/mobile-sdk-alpha/package.json
🧠 Learnings (28)
📓 Common learnings
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/demo/** : Provide an in-SDK lightweight React Native demo under packages/mobile-sdk-alpha/demo/
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/samples/** : Create sample applications under packages/mobile-sdk-alpha/samples/ (RN demo and web demo)
Learnt from: transphorm
PR: selfxyz/self#942
File: app/vite.config.ts:170-0
Timestamp: 2025-08-23T02:02:02.556Z
Learning: In the selfxyz/self React Native app, devTools from '@/navigation/devTools' are intentionally shipped to production builds for testing purposes, not excluded as is typical in most applications.
📚 Learning: 2025-08-29T15:29:47.689Z
Learnt from: CR
PR: selfxyz/self#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:29:47.689Z
Learning: Before PRs, ensure yarn build succeeds for all workspaces

Applied to files:

  • .github/workflows/mobile-sdk-demo-ci.yml
  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-29T15:29:47.689Z
Learnt from: CR
PR: selfxyz/self#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:29:47.689Z
Learning: Use nvm and Corepack to set up the Yarn v4 monorepo before any other commands (nvm use; corepack enable; corepack prepare yarnstable --activate; yarn install)

Applied to files:

  • .github/workflows/mobile-sdk-demo-ci.yml
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to app/package.json : Expose a 'test:build' script in the app's package.json that builds deps, types, performs bundle analysis, and runs tests

Applied to files:

  • .github/workflows/mobile-sdk-demo-ci.yml
  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-29T15:29:47.689Z
Learnt from: CR
PR: selfxyz/self#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:29:47.689Z
Learning: Before committing, run repository checks (yarn nice, yarn lint, yarn build, contracts build, yarn types)

Applied to files:

  • .github/workflows/mobile-sdk-demo-ci.yml
📚 Learning: 2025-08-24T18:52:25.796Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-08-24T18:52:25.796Z
Learning: Use yarn scripts: yarn ios/android for builds, yarn test for unit tests, and Fastlane for deployments

Applied to files:

  • .github/workflows/mobile-sdk-demo-ci.yml
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/demo/** : Provide an in-SDK lightweight React Native demo under packages/mobile-sdk-alpha/demo/

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/android/gradle.properties
  • packages/mobile-sdk-alpha/demo-app/android/app/src/main/java/com/selfxyz/demoapp/MainApplication.kt
  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-alpha/demo-app/android/app/build.gradle
📚 Learning: 2025-07-29T01:08:28.530Z
Learnt from: transphorm
PR: selfxyz/self#795
File: app/android/app/build.gradle:157-158
Timestamp: 2025-07-29T01:08:28.530Z
Learning: For this React Native project, the team prefers build flexibility over fail-fast behavior for release builds in app/android/app/build.gradle. They intentionally allow fallback to debug signing for local development runs, relying on Google Play Console validation to catch any improperly signed releases during upload.

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/android/gradle.properties
  • packages/mobile-sdk-alpha/demo-app/android/app/build.gradle
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/samples/** : Create sample applications under packages/mobile-sdk-alpha/samples/ (RN demo and web demo)

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/android/app/src/main/java/com/selfxyz/demoapp/MainApplication.kt
📚 Learning: 2025-08-24T21:22:29.459Z
Learnt from: transphorm
PR: selfxyz/self#943
File: app/android/app/src/main/java/com/proofofpassportapp/MainApplication.kt:17-17
Timestamp: 2025-08-24T21:22:29.459Z
Learning: OpenSourceMergedSoMapping from com.facebook.react.soloader.OpenSourceMergedSoMapping is available and functional in React Native 0.75.x. It can be safely imported and used for SoLoader initialization in MainApplication.kt without causing build failures.

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/android/app/src/main/java/com/selfxyz/demoapp/MainApplication.kt
📚 Learning: 2025-08-29T15:31:15.911Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.911Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Test isPassportDataValid() with realistic synthetic passport data (never real user data)

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
📚 Learning: 2025-08-29T15:31:15.911Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.911Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Do NOT mock selfxyz/mobile-sdk-alpha in tests (avoid jest.mock('selfxyz/mobile-sdk-alpha') and replacing real functions with mocks)

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
📚 Learning: 2025-08-29T15:31:15.911Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.911Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Verify extractMRZInfo() using published sample MRZ strings (e.g., ICAO examples)

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
📚 Learning: 2025-08-29T15:31:15.911Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.911Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Write integration tests that exercise the real validation logic (not mocks)

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
📚 Learning: 2025-08-29T15:31:15.911Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.911Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Ensure parseNFCResponse() works with representative, synthetic NFC data

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
📚 Learning: 2025-08-29T15:30:12.155Z
Learnt from: CR
PR: selfxyz/self#0
File: app/AGENTS.md:0-0
Timestamp: 2025-08-29T15:30:12.155Z
Learning: Document complex native module changes for AI review

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to app/jest.setup.js : Provide comprehensive Jest setup in app/jest.setup.js with required mocks

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
📚 Learning: 2025-08-24T18:52:25.796Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-08-24T18:52:25.796Z
Learning: Applies to jest.setup.js : Maintain comprehensive mocks in jest.setup.js for all native modules

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
📚 Learning: 2025-08-29T15:31:15.911Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.911Z
Learning: Applies to packages/mobile-sdk-alpha/**/package.json : Ensure package exports are properly configured

Applied to files:

  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/package.json : Enable tree shaking for the SDK (e.g., ensure 'sideEffects' is correctly set in package.json and exports are ESM-friendly)

Applied to files:

  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/package.json : Expose a 'test:build' script in the SDK's package.json that runs build, test, types, and lint

Applied to files:

  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/src/index.ts : Re-export new SDK modules via packages/mobile-sdk-alpha/src/index.ts

Applied to files:

  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-29T15:31:15.911Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.911Z
Learning: Applies to packages/mobile-sdk-alpha/**/package.json : Verify package conditions are valid (e.g., exports conditions)

Applied to files:

  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/README.md : Document new/updated SDK modules and usage in packages/mobile-sdk-alpha/README.md

Applied to files:

  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-29T15:31:15.911Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.911Z
Learning: Applies to packages/mobile-sdk-alpha/**/*.{ts,tsx} : Avoid introducing circular dependencies

Applied to files:

  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-29T15:31:15.911Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.911Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Use actual imports from selfxyz/mobile-sdk-alpha in tests

Applied to files:

  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Update the app to consume the mobile-sdk-alpha package and replace local modules with SDK imports

Applied to files:

  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-alpha/demo-app/android/app/build.gradle
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to app/jest.config.cjs : Use Jest in the app with a React Native preset configured in app/jest.config.cjs

Applied to files:

  • packages/mobile-sdk-alpha/package.json
🧬 Code graph analysis (1)
packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx (1)
contracts/scripts/testTokenUri.ts (1)
  • main (12-100)
⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: build-android
  • GitHub Check: build-ios
  • GitHub Check: test
  • GitHub Check: analyze-android
  • GitHub Check: e2e-ios
🔇 Additional comments (8)
packages/mobile-sdk-alpha/demo-app/android/gradle.properties (2)

47-47: react.projectRoot path verified
Validated that react.projectRoot=../../../../ resolves to the repository root’s package.json. No further changes needed.


35-35: Confirm New Architecture compatibility
newArchEnabled=true requires all React Native dependencies to be Fabric/Turbo-ready. We couldn’t locate the Gradle wrapper at the specified path—please run a clean release build (e.g. ./gradlew :app:assembleRelease from packages/mobile-sdk-alpha/demo-app/android or the correct Android project root) and perform a device smoke test to catch any runtime crashes.

packages/mobile-sdk-alpha/package.json (3)

35-35: Top-level react-native field is fine but may be shadowed by exports

Keep it for older tooling, but the exports condition above is the authoritative path in modern setups.


43-46: Good call: rebuild SDK before launching Metro

Prepending yarn build eliminates stale artifacts during demo runs.


56-56: test:build script matches guidelines

Runs build, test, types, and lint as required.

packages/mobile-sdk-alpha/demo-app/android/app/src/main/java/com/selfxyz/demoapp/MainApplication.kt (1)

41-44: No action needed: OpenSourceMergedSoMapping is supported since React Native 0.75.x (including 0.76.9), so the import and signature are safe.

packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx (1)

58-65: Input validation looks solid

Guards against NaN and out-of-range values; clear messages.

packages/mobile-sdk-alpha/demo-app/android/app/build.gradle (1)

17-17: Verify rootProject.ext.compileSdkVersion is defined and ≥34
I didn’t find any ext.compileSdkVersion declaration in the repo; please ensure it’s added (e.g. in packages/mobile-sdk-alpha/demo-app/android/build.gradle or your top-level Gradle file) and set to at least 34 for React Native 0.76.x compatibility.

def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'

android {
namespace "com.selfxyz.demoapp"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Verify package rename consistency across AndroidManifest and Kotlin sources

Namespace/applicationId changed to com.selfxyz.demoapp. Ensure Manifest package and all source package declarations match to prevent runtime crashes.

Run:

Expected: Manifest set to com.selfxyz.demoapp; no com.selfdemoapp occurrences.

Also applies to: 20-20


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# 1) Manifest package
rg -n 'package="([^"]+)"' packages/mobile-sdk-alpha/demo-app/android/app/src/main/AndroidManifest.xml

# 2) Kotlin package declarations
rg -nP '^\s*package\s+com\.selfxyz\.demoapp\b' packages/mobile-sdk-alpha/demo-app/android/app/src/main/java -g '!**/build/**'

# 3) Detect old package remnants
rg -nP '^\s*package\s+com\.selfdemoapp\b' packages/mobile-sdk-alpha/demo-app/android/app/src/main/java -g '!**/build/**' || true

Length of output: 123


🏁 Script executed:

#!/bin/bash
set -euo pipefail

MANIFEST=packages/mobile-sdk-alpha/demo-app/android/app/src/main/AndroidManifest.xml

echo "🔍 Checking AndroidManifest for namespace:"
rg -n 'package="com\.selfxyz\.demoapp"' "$MANIFEST" || echo "⚠️ No matching package declaration in AndroidManifest"

echo
echo "🔍 Scanning Kotlin/Java sources for correct package declarations:"
rg -nP '^\s*package\s+com\.selfxyz\.demoapp\b' packages/mobile-sdk-alpha/demo-app/android/app/src/main/java -g '!**/build/**' || echo "⚠️ No com.selfxyz.demoapp package declarations found"

echo
echo "🔍 Looking for any old package remnants (com.selfdemoapp):"
rg -nP '^\s*package\s+com\.selfdemoapp\b' packages/mobile-sdk-alpha/demo-app/android/app/src/main/java -g '!**/build/**' || echo "✅ No com.selfdemoapp remnants detected"

Length of output: 1315


Update AndroidManifest.xml’s package to com.selfxyz.demoapp
AndroidManifest.xml still declares the old package name—change the <manifest> tag’s package attribute in packages/mobile-sdk-alpha/demo-app/android/app/src/main/AndroidManifest.xml to com.selfxyz.demoapp to align with build.gradle and your Kotlin sources.

🤖 Prompt for AI Agents
In packages/mobile-sdk-alpha/demo-app/android/app/src/main/AndroidManifest.xml
(update the <manifest> tag’s package attribute), change the package from the old
value to "com.selfxyz.demoapp" so it matches android/app/build.gradle namespace
and your Kotlin sources; open that AndroidManifest.xml and replace the
package="..." value with package="com.selfxyz.demoapp".

@gitguardian
Copy link

gitguardian bot commented Sep 3, 2025

⚠️ GitGuardian has uncovered 11 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
20511340 Triggered Generic Private Key 9a05151 common/src/mock_certificates/sha256_rsa_130689_4096/mock_csca.key View secret
20511341 Triggered Generic Private Key 9a05151 common/src/mock_certificates/sha1_rsa_64321_4096/mock_csca.key View secret
20511342 Triggered Generic Private Key 9a05151 common/src/mock_certificates/sha256_rsa_107903_4096/mock_dsc.key View secret
20511343 Triggered Generic Private Key 9a05151 common/src/mock_certificates/sha1_rsa_64321_4096/mock_dsc.key View secret
20511344 Triggered Generic Private Key 9a05151 common/src/mock_certificates/sha256_rsa_130689_4096/mock_dsc.key View secret
21022104 Triggered Generic Private Key 2205c3f common/src/mock_certificates/aadhaar/mockAadhaarCert.ts View secret
20511345 Triggered Generic Private Key 9a05151 common/src/constants/mockCertificates.ts View secret
20511346 Triggered Generic Private Key 9a05151 common/src/mock_certificates/sha256_rsa_107903_4096/mock_csca.key View secret
20511347 Triggered Generic Private Key 9a05151 common/src/constants/mockCertificates.ts View secret
20511348 Triggered Generic Private Key 9a05151 common/src/mock_certificates/sha256_rsa_122125_4096/mock_csca.key View secret
20511349 Triggered Generic Private Key 9a05151 common/src/mock_certificates/sha256_rsa_56611_4096/mock_csca.key View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

♻️ Duplicate comments (1)
packages/mobile-sdk-alpha/package.json (1)

15-21: Add a 'react-native' export condition for robust RN resolution.

You added the top-level "react-native" field (good). Add the same condition under the "." export to help tools that prioritize export conditions.

   "exports": {
     ".": {
       "types": "./dist/esm/index.d.ts",
       "browser": "./dist/esm/browser.js",
+      "react-native": "./dist/esm/index.js",
       "import": "./dist/esm/index.js",
       "require": "./dist/cjs/index.cjs"
     },
🧹 Nitpick comments (3)
packages/mobile-sdk-alpha/scripts/build-demo.mjs (1)

24-33: Avoid double-building the demo app (saves time and flakiness).

packages/mobile-sdk-alpha/package.json’s build already runs demo:validate (which builds the demo). Step 2 here repeats that build. Drop Step 2 or gate it via an env flag to cut build time and reduce surface for intermittent failures.

Apply:

-  // Step 2: Validate demo app can build
-  console.log('\n✅ Validating demo app...');
-  execSync('yarn build', { cwd: DEMO_APP, stdio: 'inherit' });
+  // Demo validation runs inside the SDK build (via `yarn demo:validate`).
+  console.log('\n✅ Demo app validated via SDK build.');
packages/mobile-sdk-alpha/demo-app/package.json (1)

13-15: Prebuild only compiles the SDK; also build @selfxyz/common to ensure types are ready.

If the demo imports from @selfxyz/common, ensure its types/artifacts exist before TS/Metro resolution to reduce typecheck flakiness.

-    "prebuild": "yarn workspace @selfxyz/mobile-sdk-alpha build",
+    "prebuild": "yarn workspace @selfxyz/common build && yarn workspace @selfxyz/mobile-sdk-alpha build",
packages/mobile-sdk-alpha/package.json (1)

40-40: Single-source the demo validation to avoid duplicated work.

Your build script runs demo:validate, and build-demo.mjs also validates the demo. Pick one place (recommend build-demo.mjs) to own demo validation to keep builds fast and predictable.

-    "build": "rm -rf dist && tsup && yarn postbuild && yarn demo:validate",
+    "build": "rm -rf dist && tsup && yarn postbuild",

If you keep validation here instead, remove Step 2 in build-demo.mjs (see my comment there).

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled
  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between b1f42db and 3d50569.

📒 Files selected for processing (8)
  • package.json (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/README.md (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/android/gradle.properties (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/ios/Podfile (2 hunks)
  • packages/mobile-sdk-alpha/demo-app/package.json (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx (1 hunks)
  • packages/mobile-sdk-alpha/package.json (2 hunks)
  • packages/mobile-sdk-alpha/scripts/build-demo.mjs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/mobile-sdk-alpha/demo-app/android/gradle.properties
  • package.json
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/technical-specification.mdc)

**/*.{ts,tsx}: Define IdentityCommitment with fields: commitment (Poseidon hash), nullifier (domain-separated), timestamp (UTC number), version (circuit version), documentType ('passport' | 'eu_id_card')
Define DSCKeyCommitment with fields: publicKeyHash (Poseidon hash), certificateChain (hashes), revocationStatus (boolean), issuer (country code)
Define VerificationConfig with fields: circuitVersion (semver), complianceRules array, timeWindow (seconds, 24h), clockDrift (±5 min), trustAnchors, revocationRoots, timeSource (NTP), nullifierScope (domain separation)

Files:

  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
packages/mobile-sdk-alpha/**/*.{ts,tsx}

📄 CodeRabbit inference engine (packages/mobile-sdk-alpha/AGENTS.md)

packages/mobile-sdk-alpha/**/*.{ts,tsx}: Use strict TypeScript type checking across the codebase
Follow ESLint TypeScript-specific rules
Avoid introducing circular dependencies

Files:

  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
packages/mobile-sdk-alpha/**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

packages/mobile-sdk-alpha/**/*.{ts,tsx,js,jsx}: Review alpha mobile SDK code for:

  • API consistency with core SDK
  • Platform-neutral abstractions
  • Performance considerations
  • Clear experimental notes or TODOs

Files:

  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
packages/mobile-sdk-alpha/package.json

📄 CodeRabbit inference engine (.cursor/rules/mobile-sdk-migration.mdc)

packages/mobile-sdk-alpha/package.json: Expose a 'test:build' script in the SDK's package.json that runs build, test, types, and lint
Enable tree shaking for the SDK (e.g., ensure 'sideEffects' is correctly set in package.json and exports are ESM-friendly)

Files:

  • packages/mobile-sdk-alpha/package.json
packages/mobile-sdk-alpha/**/package.json

📄 CodeRabbit inference engine (packages/mobile-sdk-alpha/AGENTS.md)

packages/mobile-sdk-alpha/**/package.json: Ensure package exports are properly configured
Verify package conditions are valid (e.g., exports conditions)

Files:

  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-alpha/demo-app/package.json
🧠 Learnings (28)
📓 Common learnings
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/demo/** : Provide an in-SDK lightweight React Native demo under packages/mobile-sdk-alpha/demo/
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/samples/** : Create sample applications under packages/mobile-sdk-alpha/samples/ (RN demo and web demo)
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/package.json : Expose a 'test:build' script in the SDK's package.json that runs build, test, types, and lint

Applied to files:

  • packages/mobile-sdk-alpha/scripts/build-demo.mjs
  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-alpha/demo-app/package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/demo/** : Provide an in-SDK lightweight React Native demo under packages/mobile-sdk-alpha/demo/

Applied to files:

  • packages/mobile-sdk-alpha/scripts/build-demo.mjs
  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-alpha/demo-app/ios/Podfile
  • packages/mobile-sdk-alpha/demo-app/package.json
  • packages/mobile-sdk-alpha/demo-app/README.md
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/samples/** : Create sample applications under packages/mobile-sdk-alpha/samples/ (RN demo and web demo)

Applied to files:

  • packages/mobile-sdk-alpha/scripts/build-demo.mjs
  • packages/mobile-sdk-alpha/demo-app/package.json
  • packages/mobile-sdk-alpha/demo-app/README.md
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/src/index.ts : Re-export new SDK modules via packages/mobile-sdk-alpha/src/index.ts

Applied to files:

  • packages/mobile-sdk-alpha/scripts/build-demo.mjs
  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/package.json : Enable tree shaking for the SDK (e.g., ensure 'sideEffects' is correctly set in package.json and exports are ESM-friendly)

Applied to files:

  • packages/mobile-sdk-alpha/scripts/build-demo.mjs
  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-alpha/demo-app/package.json
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/**/package.json : Ensure package exports are properly configured

Applied to files:

  • packages/mobile-sdk-alpha/scripts/build-demo.mjs
  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-alpha/demo-app/package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/README.md : Document new/updated SDK modules and usage in packages/mobile-sdk-alpha/README.md

Applied to files:

  • packages/mobile-sdk-alpha/scripts/build-demo.mjs
  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-alpha/demo-app/package.json
  • packages/mobile-sdk-alpha/demo-app/README.md
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Use actual imports from selfxyz/mobile-sdk-alpha in tests

Applied to files:

  • packages/mobile-sdk-alpha/scripts/build-demo.mjs
  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-alpha/demo-app/package.json
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/**/*.{ts,tsx} : Avoid introducing circular dependencies

Applied to files:

  • packages/mobile-sdk-alpha/scripts/build-demo.mjs
  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-alpha/demo-app/package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to app/package.json : Expose a 'test:build' script in the app's package.json that builds deps, types, performs bundle analysis, and runs tests

Applied to files:

  • packages/mobile-sdk-alpha/scripts/build-demo.mjs
  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-alpha/demo-app/package.json
📚 Learning: 2025-08-24T18:55:07.940Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/technical-specification.mdc:0-0
Timestamp: 2025-08-24T18:55:07.940Z
Learning: Applies to package.json : Distribute the SDK via npm/yarn with proper package metadata

Applied to files:

  • packages/mobile-sdk-alpha/scripts/build-demo.mjs
📚 Learning: 2025-08-24T18:52:25.796Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-08-24T18:52:25.796Z
Learning: Use yarn scripts: yarn ios/android for builds, yarn test for unit tests, and Fastlane for deployments

Applied to files:

  • packages/mobile-sdk-alpha/scripts/build-demo.mjs
  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-alpha/demo-app/package.json
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Test isPassportDataValid() with realistic synthetic passport data (never real user data)

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Do NOT mock selfxyz/mobile-sdk-alpha in tests (avoid jest.mock('selfxyz/mobile-sdk-alpha') and replacing real functions with mocks)

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
  • packages/mobile-sdk-alpha/demo-app/package.json
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Write integration tests that exercise the real validation logic (not mocks)

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
📚 Learning: 2025-08-25T14:25:57.586Z
Learnt from: aaronmgdr
PR: selfxyz/self#951
File: app/src/providers/authProvider.web.tsx:17-18
Timestamp: 2025-08-25T14:25:57.586Z
Learning: The selfxyz/mobile-sdk-alpha/constants/analytics import path is properly configured with SDK exports, Metro aliases, and TypeScript resolution. Import changes from @/consts/analytics to this path are part of valid analytics migration, not TypeScript resolution issues.

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
  • packages/mobile-sdk-alpha/demo-app/package.json
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Verify extractMRZInfo() using published sample MRZ strings (e.g., ICAO examples)

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
  • packages/mobile-sdk-alpha/demo-app/package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to app/jest.setup.js : Provide comprehensive Jest setup in app/jest.setup.js with required mocks

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
📚 Learning: 2025-08-24T18:52:25.796Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-08-24T18:52:25.796Z
Learning: Applies to jest.setup.js : Maintain comprehensive mocks in jest.setup.js for all native modules

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/**/package.json : Verify package conditions are valid (e.g., exports conditions)

Applied to files:

  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-alpha/demo-app/package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Update the app to consume the mobile-sdk-alpha package and replace local modules with SDK imports

Applied to files:

  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-alpha/demo-app/package.json
📚 Learning: 2025-08-29T15:29:47.727Z
Learnt from: CR
PR: selfxyz/self#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:29:47.727Z
Learning: Before PRs, ensure yarn build succeeds for all workspaces

Applied to files:

  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to app/jest.config.cjs : Use Jest in the app with a React Native preset configured in app/jest.config.cjs

Applied to files:

  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-29T15:30:12.210Z
Learnt from: CR
PR: selfxyz/self#0
File: app/AGENTS.md:0-0
Timestamp: 2025-08-29T15:30:12.210Z
Learning: From app/ios, run bundle install && bundle exec pod install (or from app run npx pod-install)

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/ios/Podfile
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/**/*.{ts,tsx} : Use strict TypeScript type checking across the codebase

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/package.json
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Ensure parseNFCResponse() works with representative, synthetic NFC data

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/tests/setup.ts : Provide Vitest setup file at packages/mobile-sdk-alpha/tests/setup.ts to suppress console noise

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/package.json
🪛 RuboCop (1.76.1)
packages/mobile-sdk-alpha/demo-app/ios/Podfile

[convention] 25-25: Avoid comma after the last parameter of a method call.

(Style/TrailingCommaInArguments)

🪛 LanguageTool
packages/mobile-sdk-alpha/demo-app/README.md

[grammar] ~7-~7: There might be a mistake here.
Context: ... ## Configuration ### New Architecture The new architecture (Fabric + TurboModu...

(QB_NEW_EN)


[grammar] ~18-~18: There might be a mistake here.
Context: ...rchitecture (default) ### Hermes Engine Hermes JavaScript engine can be toggled ...

(QB_NEW_EN)


[grammar] ~29-~29: There might be a mistake here.
Context: ...` - Use JSC instead ## Current Settings - New Architecture: Disabled - *Hermes...

(QB_NEW_EN)


[grammar] ~30-~30: There might be a mistake here.
Context: ...ettings - New Architecture: Disabled - Hermes: Enabled ## Build Commands Af...

(QB_NEW_EN)

🪛 GitHub Actions: Mobile SDK CI
packages/mobile-sdk-alpha/demo-app/README.md

[warning] 1-1: Prettier formatting issues detected in demo-app/README.md. Run 'prettier --write' to fix.


[error] 1-1: Prettier check failed. Command 'yarn workspace @selfxyz/mobile-sdk-alpha prettier --check .' exited with code 1 due to formatting issues in demo-app/README.md.

⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: build-android
  • GitHub Check: test
  • GitHub Check: build-ios
  • GitHub Check: e2e-ios
  • GitHub Check: analyze-android
🔇 Additional comments (5)
packages/mobile-sdk-alpha/demo-app/README.md (1)

1-45: Enable Corepack or use the correct Yarn version, then re-run Prettier
CI is failing on formatting in packages/mobile-sdk-alpha/demo-app/README.md. Either:

  • Run corepack enable (to activate Yarn 4.6.0 per your packageManager field), then:
    yarn workspace @selfxyz/mobile-sdk-alpha prettier --write packages/mobile-sdk-alpha/demo-app/README.md
    
  • Or bypass Yarn and use the local Prettier directly:
    npx prettier --write packages/mobile-sdk-alpha/demo-app/README.md
    

After formatting, commit the changes and confirm with:

npx prettier --check packages/mobile-sdk-alpha/demo-app/README.md
packages/mobile-sdk-alpha/demo-app/ios/Podfile (1)

24-26: Hermes enabled on iOS — matches README and RN best practices.

This aligns with the stated defaults (Hermes ON, Fabric OFF). LGTM.

packages/mobile-sdk-alpha/demo-app/package.json (1)

21-22: Deep-import paths already exported by @selfxyz/common – no change needed
Exports in common/package.json include "./utils/passports/validate"; adjust ESLint’s resolver to honor package exports instead of adding re-exports.

Likely an incorrect or invalid review comment.

packages/mobile-sdk-alpha/demo-app/src/GenerateMock.tsx (2)

59-64: Confirm integer-only constraints for age/expiry

If generateMockDocument expects integers, decimals will slip through current checks.

Proposed guard (apply only if the API requires integers):

-      if (!Number.isFinite(ageNum) || ageNum < 0 || ageNum > 120) {
+      if (!Number.isFinite(ageNum) || ageNum < 0 || ageNum > 120 || !Number.isInteger(ageNum)) {
         throw new Error('Age must be a number between 0 and 120');
       }
-      if (!Number.isFinite(expiryNum) || expiryNum < 0 || expiryNum > 30) {
+      if (!Number.isFinite(expiryNum) || expiryNum < 0 || expiryNum > 30 || !Number.isInteger(expiryNum)) {
         throw new Error('Expiry years must be a number between 0 and 30');
       }

If integers aren’t required, please ignore.


8-8: Verify countryCodes is a public root export
Ensure countryCodes is listed under the "exports" field in the root package.json of @selfxyz/common, or switch the import to a documented subpath (e.g. @selfxyz/common/constants) to avoid Metro/TypeScript resolution issues.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
package.json (1)

16-16: Use a topological Yarn workspace build for the SDK and demo
Replace your build:mobile-sdk script with:

-    "build:mobile-sdk": "yarn workspace @selfxyz/mobile-sdk-alpha build && yarn workspace demo-app build",
+    "build:mobile-sdk": "yarn workspaces foreach --topological-dev -v --from @selfxyz/mobile-sdk-alpha --to demo-app -i run build",

This will let Yarn order the builds automatically and avoid manual sequencing.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3d50569 and 28cd19b.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (6)
  • .gitignore (1 hunks)
  • README.md (1 hunks)
  • package.json (2 hunks)
  • packages/mobile-sdk-alpha/demo-app/README.md (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/package.json (1 hunks)
  • packages/mobile-sdk-alpha/package.json (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • README.md
  • .gitignore
  • packages/mobile-sdk-alpha/demo-app/package.json
  • packages/mobile-sdk-alpha/demo-app/README.md
  • packages/mobile-sdk-alpha/package.json
🧰 Additional context used
📓 Path-based instructions (1)
package.json

📄 CodeRabbit inference engine (.cursor/rules/technical-specification.mdc)

Distribute the SDK via npm/yarn with proper package metadata

Files:

  • package.json
🧠 Learnings (15)
📓 Common learnings
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/demo/** : Provide an in-SDK lightweight React Native demo under packages/mobile-sdk-alpha/demo/
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/samples/** : Create sample applications under packages/mobile-sdk-alpha/samples/ (RN demo and web demo)
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/package.json : Expose a 'test:build' script in the SDK's package.json that runs build, test, types, and lint

Applied to files:

  • package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/package.json : Enable tree shaking for the SDK (e.g., ensure 'sideEffects' is correctly set in package.json and exports are ESM-friendly)

Applied to files:

  • package.json
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/**/package.json : Ensure package exports are properly configured

Applied to files:

  • package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/demo/** : Provide an in-SDK lightweight React Native demo under packages/mobile-sdk-alpha/demo/

Applied to files:

  • package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/src/index.ts : Re-export new SDK modules via packages/mobile-sdk-alpha/src/index.ts

Applied to files:

  • package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to app/package.json : Expose a 'test:build' script in the app's package.json that builds deps, types, performs bundle analysis, and runs tests

Applied to files:

  • package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/README.md : Document new/updated SDK modules and usage in packages/mobile-sdk-alpha/README.md

Applied to files:

  • package.json
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/**/*.{ts,tsx} : Avoid introducing circular dependencies

Applied to files:

  • package.json
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/**/package.json : Verify package conditions are valid (e.g., exports conditions)

Applied to files:

  • package.json
📚 Learning: 2025-08-24T18:55:07.940Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/technical-specification.mdc:0-0
Timestamp: 2025-08-24T18:55:07.940Z
Learning: Applies to package.json : Distribute the SDK via npm/yarn with proper package metadata

Applied to files:

  • package.json
📚 Learning: 2025-08-24T18:52:25.796Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-08-24T18:52:25.796Z
Learning: Use yarn scripts: yarn ios/android for builds, yarn test for unit tests, and Fastlane for deployments

Applied to files:

  • package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/samples/** : Create sample applications under packages/mobile-sdk-alpha/samples/ (RN demo and web demo)

Applied to files:

  • package.json
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Use actual imports from selfxyz/mobile-sdk-alpha in tests

Applied to files:

  • package.json
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Do NOT mock selfxyz/mobile-sdk-alpha in tests (avoid jest.mock('selfxyz/mobile-sdk-alpha') and replacing real functions with mocks)

Applied to files:

  • package.json
⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: build-android
  • GitHub Check: build-ios
  • GitHub Check: test
  • GitHub Check: analyze-ios
  • GitHub Check: analyze-android
🔇 Additional comments (2)
package.json (2)

36-37: No functional change from reordering of resolutions.

Reordering only; versions unchanged. No issues.


18-18: No action required — demo-app start script and SDK dependency verified.

* chore(app): map common src paths and declare svg flag module

* ci fix

* update lock

* save wip

* chore: address yarn lock issues (#1004)

* address yarn lock issues

* fix postinstall

* fix ci

* use metro js proxy

* android build working for /app

* save wip

* fix merge

* pipeline fixes

* format

* fix pipelines

* bump limit and split
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 24

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (14)
common/src/utils/bytes.ts (1)

94-108: Fix BigInt literal warnings and make return type explicit

Web CI warns that BigInt literals may crash under es2018 targets. Replace literals with BigInt() calls in this function and annotate the tuple return for clarity.

-export function packBytes(unpacked: number[]) {
+export function packBytes(unpacked: number[]): [bigint, bigint, bigint] {
   const bytesCount = [31, 31, 31];
-  const packed = [0n, 0n, 0n];
+  const packed: [bigint, bigint, bigint] = [BigInt(0), BigInt(0), BigInt(0)];
 
   let byteIndex = 0;
   for (let i = 0; i < bytesCount.length; i++) {
     for (let j = 0; j < bytesCount[i]; j++) {
       if (byteIndex < unpacked.length) {
-        packed[i] |= BigInt(unpacked[byteIndex]) << (BigInt(j) * 8n);
+        packed[i] |= BigInt(unpacked[byteIndex]) << (BigInt(j) * BigInt(8));
       }
       byteIndex++;
     }
   }
   return packed;
 }

Follow-up (outside this hunk): apply the same replacement to other BigInt literals in this file (e.g., 1n, 0n, 8n) to silence remaining warnings and avoid accidental es2018 targets from breaking builds.

common/src/utils/certificate_parsing/curves.ts (2)

44-45: Stop logging sensitive crypto params in production

These logs can leak certificate/curve parameters. Gate them behind DEV (or remove) to avoid sensitive data in device logs.

Apply this diff:

-  console.log('\x1b[31m%s\x1b[0m', `curve name ${curveName} not found in curveBits`);
+  if (typeof __DEV__ !== 'undefined' && __DEV__) {
+    console.warn('\x1b[31m%s\x1b[0m', `curve name ${curveName} not found in curveBits`);
+  }
-  console.log('Unknown curve:', normalizedParams);
+  if (typeof __DEV__ !== 'undefined' && __DEV__) {
+    console.warn('Unknown curve:', normalizedParams);
+  }

Also applies to: 70-71


74-76: normalizeHex drops only a single leading 00

This can break identifyCurve matching when more than two leading zeros are present.

Apply this diff:

-export function normalizeHex(hex: string): string {
-  return hex.toLowerCase().replace(/^0x/, '').replace(/^00/, '');
-}
+export function normalizeHex(hex: string): string {
+  return hex.toLowerCase().replace(/^0x/, '').replace(/^0+/, '');
+}
app/scripts/bundle-analyze-ci.cjs (1)

69-77: Analyze production-like size (minify) and auto-detect entry file

Non-minified bundles under-report real app size variance. Also, hardcoding index.js can break TypeScript entrypoints.

Apply this diff:

-  execSync(
-    `npx react-native bundle ` +
-      `--platform ${platform} ` +
-      `--dev false ` +
-      `--entry-file index.js ` +
-      `--bundle-output ${bundleFile} ` +
-      `--sourcemap-output ${sourcemapFile} ` +
-      `--minify false ` +
-      `--config metro.config.cjs ` +
-      `--reset-cache`,
+  const entryCandidates = ['index.ts', 'index.tsx', 'index.js'];
+  const entryFile = entryCandidates.find(f => existsSync(f)) || 'index.js';
+  execSync(
+    `npx react-native bundle ` +
+      `--platform ${platform} ` +
+      `--dev false ` +
+      `--entry-file ${entryFile} ` +
+      `--bundle-output ${bundleFile} ` +
+      `--sourcemap-output ${sourcemapFile} ` +
+      `--minify true ` +
+      `--config metro.config.cjs ` +
+      `--reset-cache`,
packages/mobile-sdk-alpha/src/components/screens/PassportCameraScreen.tsx (1)

21-35: Type mismatch: extra 'validation' prop breaks MRZInfo (excess property check).

onMRZDetected expects MRZInfo (per types/ui.ts). Adding validation causes TS error and will fail strict checks.

Option A (remove validation here):

       onMRZDetected({
         documentNumber: 'L898902C3',
         dateOfBirth: '740812',
         dateOfExpiry: '120415',
         issuingCountry: 'UTO',
-        documentType: 'P',
-        validation: {
-          format: true,
-          passportNumberChecksum: true,
-          dateOfBirthChecksum: true,
-          dateOfExpiryChecksum: true,
-          compositeChecksum: true,
-          overall: true,
-        },
+        documentType: 'P',
       })

Option B: extend MRZInfo with an optional validation field and update all call sites accordingly.

packages/mobile-sdk-alpha/demo-app/metro.config.cjs (1)

27-39: Pinning RN/react is good; add nodeModulesPaths to prefer app and workspace roots.

This prevents accidental resolution from nested node_modules within packages.

   resolver: {
-    extraNodeModules: {
+    nodeModulesPaths: [
+      path.resolve(projectRoot, 'node_modules'),
+      path.resolve(workspaceRoot, 'node_modules'),
+    ],
+    extraNodeModules: {
       '@babel/runtime': path.resolve(__dirname, '../../../node_modules/@babel/runtime'),
       // Pin React and React Native to monorepo root
       react: path.resolve(__dirname, '../../../node_modules/react'),
       'react-native': path.resolve(__dirname, '../../../node_modules/react-native'),
       // Crypto polyfills
       stream: require.resolve('stream-browserify'),
       buffer: require.resolve('buffer'),
       util: require.resolve('util'),
       assert: require.resolve('assert'),
     },
packages/mobile-sdk-alpha/package.json (1)

79-88: Ensure builds run during pack/publish flows (Yarn v4): add prepack.

prepublishOnly won’t run on yarn pack; missing prepack risks publishing stale/empty dist.

   "scripts": {
     "build": "rm -rf dist && tsup && yarn postbuild && yarn demo:validate",
...
-    "prepublishOnly": "npm run build && npm run typecheck && npm run validate:exports && npm run validate:pkg",
+    "prepack": "yarn build && yarn typecheck && yarn validate:exports && yarn validate:pkg",
+    "prepublishOnly": "yarn build && yarn typecheck && yarn validate:exports && yarn validate:pkg",
packages/mobile-sdk-alpha/tests/documents/utils.test.ts (2)

56-60: Remove non-metadata fields from DocumentCatalog fixtures.

DocumentCatalog.documents entries should be metadata only; extra data fields break excess property checks and drift from runtime behavior.

-  const catalog: DocumentCatalog = {
-    documents: [
-      { id: '23', documentType: 'passport', documentCategory: 'passport', data: 'data1', mock: true },
-      { id: '45', documentType: 'passport', documentCategory: 'passport', data: 'data2', mock: true },
-    ],
+  const catalog: DocumentCatalog = {
+    documents: [
+      { id: '23', documentType: 'passport', documentCategory: 'passport', mock: true },
+      { id: '45', documentType: 'passport', documentCategory: 'passport', mock: true },
+    ],

24-25: Avoid relying on global Response in Node test env.

Using new Response(null) can break under node environment; stub a minimal Response-like object instead.

-        http: { fetch: async () => new Response(null) },
+        http: {
+          fetch: async () =>
+            ({ ok: true, status: 200, json: async () => ({}), text: async () => '' } as any),
+        },
packages/mobile-sdk-alpha/src/documents/utils.ts (2)

25-33: Load documents concurrently to reduce latency.

Sequential loads can be slow with multiple documents. Use Promise.all with a bounded map if needed later.

-  for (const metadata of catalog.documents) {
-    const data = await selfClient.loadDocumentById(metadata.id);
-    if (data) {
-      allDocs[metadata.id] = { data, metadata };
-    }
-  }
+  await Promise.all(
+    catalog.documents.map(async metadata => {
+      const data = await selfClient.loadDocumentById(metadata.id);
+      if (data) {
+        allDocs[metadata.id] = { data, metadata };
+      }
+    }),
+  );

41-52: Remove or gate console logging in the SDK.

Unconditional console.log/console.error in library code is noisy and can leak info in production builds. Gate behind NODE_ENV or route via a logger adapter.

+const devLog = (...args: any[]) => {
+  if (process.env.NODE_ENV !== 'production') console.log(...args);
+};
@@
-export const hasAnyValidRegisteredDocument = async (client: SelfClient): Promise<boolean> => {
-  console.log('Checking if there are any valid registered documents');
+export const hasAnyValidRegisteredDocument = async (client: SelfClient): Promise<boolean> => {
+  devLog('Checking if there are any valid registered documents');
@@
-  } catch (error) {
-    console.error('Error loading document catalog:', error);
+  } catch (error) {
+    devLog('Error loading document catalog:', error);
@@
-  const catalog = await selfClient.loadDocumentCatalog();
-  console.log('Catalog loaded');
+  const catalog = await selfClient.loadDocumentCatalog();
+  devLog('Catalog loaded');
@@
-  if (!catalog.selectedDocumentId) {
-    console.log('No selectedDocumentId found');
-    if (catalog.documents.length > 0) {
-      console.log('Using first document as fallback');
-      catalog.selectedDocumentId = catalog.documents[0].id;
-
-      await selfClient.saveDocumentCatalog(catalog);
+  if (!catalog.selectedDocumentId) {
+    devLog('No selectedDocumentId found');
+    if (catalog.documents.length > 0) {
+      devLog('Using first document as fallback');
+      const updated = { ...catalog, selectedDocumentId: catalog.documents[0].id };
+      await selfClient.saveDocumentCatalog(updated);
     } else {
-      console.log('No documents in catalog, returning null');
+      devLog('No documents in catalog, returning null');
       return null;
     }
   }
@@
-  if (!metadata) {
-    console.log('Metadata not found for selectedDocumentId:', catalog.selectedDocumentId);
+  if (!metadata) {
+    devLog('Metadata not found for selectedDocumentId:', catalog.selectedDocumentId);
     return null;
   }
@@
-  if (!data) {
-    console.log('Document data not found for id:', catalog.selectedDocumentId);
+  if (!data) {
+    devLog('Document data not found for id:', catalog.selectedDocumentId);
     return null;
   }
@@
-  console.log('Successfully loaded document:', metadata.documentType);
+  devLog('Successfully loaded document:', metadata.documentType);

Also applies to: 61-89

packages/mobile-sdk-alpha/src/client.ts (1)

106-124: Make proof timeout cancelable to prevent spurious error events.

In generateProof (packages/mobile-sdk-alpha/src/client.ts lines 116–124), replace the one-shot _adapters.clock.sleep(...).then(...) with a cancellable setTimeout, and clear the timer in cancel() (and optionally on proof resolution or via opts.signal) to avoid emitting a timeout after the proof completes.

packages/mobile-sdk-alpha/src/components/screens/NFCScannerScreen.tsx (2)

19-40: Fix stale mrzData capture in useCallback.

mrzData is used but not listed as a dependency; can lead to scanning with outdated values.

-  const onNFCScan = useCallback(
+  const onNFCScan = useCallback(
     async (_nfcData: any) => {
@@
-    [client, onSuccess, onFailure],
+    [client, onSuccess, onFailure, mrzData],
   );

23-33: Add a narrow check before casting ScanResult to NFC.

Guard against unexpected scan modes to avoid unsafe casts.

-        const scanResult = await client.scanDocument({
+        const scanResult = await client.scanDocument({
           mode: 'nfc',
           passportNumber: mrzData.documentNumber,
           dateOfBirth: mrzData.dateOfBirth,
           dateOfExpiry: mrzData.dateOfExpiry,
         });
+        if (scanResult.mode !== 'nfc') {
+          throw new Error(`Unexpected scan mode: ${String((scanResult as any).mode)}`);
+        }
@@
-        const _parsedPassportData = initPassportDataParsing((scanResult as ScanResultNFC).passportData, skiPem);
+        const _parsedPassportData = initPassportDataParsing((scanResult as ScanResultNFC).passportData, skiPem);
🧹 Nitpick comments (1)
app/package.json (1)

75-113: Consolidate hash/crypto libs to reduce bundle size and surface area.

You now ship @noble/hashes plus hash.js, js-sha1, js-sha256 (and js-sha512). This duplicates functionality, increases app size, and expands attack surface. Prefer a single modern lib (e.g., @noble/hashes) and remove legacy ones unless a hard dependency blocks it.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 28cd19b and eb6c3c4.

⛔ Files ignored due to path filters (2)
  • app/ios/Podfile.lock is excluded by !**/*.lock
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (44)
  • .github/workflows/mobile-e2e.yml (2 hunks)
  • .github/workflows/mobile-sdk-demo-ci.yml (1 hunks)
  • .yarnrc.yml (1 hunks)
  • app/declarations.d.ts (1 hunks)
  • app/ios/Podfile (1 hunks)
  • app/ios/Self.xcodeproj/project.pbxproj (2 hunks)
  • app/metro.config.cjs (1 hunks)
  • app/package.json (4 hunks)
  • app/scripts/bundle-analyze-ci.cjs (1 hunks)
  • app/src/types/globals.d.ts (1 hunks)
  • app/tsconfig.json (1 hunks)
  • babel.config.js (1 hunks)
  • common/src/types/globals.d.ts (1 hunks)
  • common/src/types/index.ts (1 hunks)
  • common/src/utils/bytes.ts (1 hunks)
  • common/src/utils/certificate_parsing/curves.ts (1 hunks)
  • common/src/utils/index.ts (1 hunks)
  • common/tsconfig.json (1 hunks)
  • docs/METRO_WORKSPACE_GUIDE.md (1 hunks)
  • package.json (2 hunks)
  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/jest.config.cjs (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/jest.setup.js (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/metro.config.cjs (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/package.json (2 hunks)
  • packages/mobile-sdk-alpha/demo-app/scripts/bundle-analyze-ci.cjs (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/tsconfig.json (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/types/react-native-picker__picker.d.ts (1 hunks)
  • packages/mobile-sdk-alpha/package.json (4 hunks)
  • packages/mobile-sdk-alpha/src/client.ts (1 hunks)
  • packages/mobile-sdk-alpha/src/components/screens/NFCScannerScreen.tsx (2 hunks)
  • packages/mobile-sdk-alpha/src/components/screens/PassportCameraScreen.tsx (2 hunks)
  • packages/mobile-sdk-alpha/src/components/screens/QRCodeScreen.tsx (1 hunks)
  • packages/mobile-sdk-alpha/src/documents/utils.ts (1 hunks)
  • packages/mobile-sdk-alpha/src/index.ts (1 hunks)
  • packages/mobile-sdk-alpha/src/types/ui.ts (1 hunks)
  • packages/mobile-sdk-alpha/src/validation/document.ts (1 hunks)
  • packages/mobile-sdk-alpha/tests/documents/utils.test.ts (1 hunks)
  • packages/mobile-sdk-alpha/tsconfig.json (1 hunks)
  • packages/mobile-sdk-alpha/tsup.config.ts (2 hunks)
  • packages/mobile-sdk-alpha/vitest.config.ts (1 hunks)
  • scripts/check-duplicate-headers.cjs (1 hunks)
  • scripts/check-license-headers.mjs (1 hunks)
  • scripts/lint-headers.cjs (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • packages/mobile-sdk-alpha/src/validation/document.ts
  • packages/mobile-sdk-alpha/src/index.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/mobile-sdk-demo-ci.yml
🧰 Additional context used
📓 Path-based instructions (14)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/technical-specification.mdc)

**/*.{ts,tsx}: Define IdentityCommitment with fields: commitment (Poseidon hash), nullifier (domain-separated), timestamp (UTC number), version (circuit version), documentType ('passport' | 'eu_id_card')
Define DSCKeyCommitment with fields: publicKeyHash (Poseidon hash), certificateChain (hashes), revocationStatus (boolean), issuer (country code)
Define VerificationConfig with fields: circuitVersion (semver), complianceRules array, timeWindow (seconds, 24h), clockDrift (±5 min), trustAnchors, revocationRoots, timeSource (NTP), nullifierScope (domain separation)

Files:

  • packages/mobile-sdk-alpha/demo-app/types/react-native-picker__picker.d.ts
  • common/src/types/index.ts
  • app/src/types/globals.d.ts
  • common/src/utils/certificate_parsing/curves.ts
  • app/declarations.d.ts
  • packages/mobile-sdk-alpha/src/client.ts
  • packages/mobile-sdk-alpha/tests/documents/utils.test.ts
  • packages/mobile-sdk-alpha/src/components/screens/QRCodeScreen.tsx
  • common/src/types/globals.d.ts
  • common/src/utils/bytes.ts
  • packages/mobile-sdk-alpha/tsup.config.ts
  • packages/mobile-sdk-alpha/src/documents/utils.ts
  • packages/mobile-sdk-alpha/src/components/screens/PassportCameraScreen.tsx
  • packages/mobile-sdk-alpha/src/types/ui.ts
  • packages/mobile-sdk-alpha/src/components/screens/NFCScannerScreen.tsx
  • common/src/utils/index.ts
  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
  • packages/mobile-sdk-alpha/vitest.config.ts
packages/mobile-sdk-alpha/**/*.{ts,tsx}

📄 CodeRabbit inference engine (packages/mobile-sdk-alpha/AGENTS.md)

packages/mobile-sdk-alpha/**/*.{ts,tsx}: Use strict TypeScript type checking across the codebase
Follow ESLint TypeScript-specific rules
Avoid introducing circular dependencies

Files:

  • packages/mobile-sdk-alpha/demo-app/types/react-native-picker__picker.d.ts
  • packages/mobile-sdk-alpha/src/client.ts
  • packages/mobile-sdk-alpha/tests/documents/utils.test.ts
  • packages/mobile-sdk-alpha/src/components/screens/QRCodeScreen.tsx
  • packages/mobile-sdk-alpha/tsup.config.ts
  • packages/mobile-sdk-alpha/src/documents/utils.ts
  • packages/mobile-sdk-alpha/src/components/screens/PassportCameraScreen.tsx
  • packages/mobile-sdk-alpha/src/types/ui.ts
  • packages/mobile-sdk-alpha/src/components/screens/NFCScannerScreen.tsx
  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
  • packages/mobile-sdk-alpha/vitest.config.ts
packages/mobile-sdk-alpha/**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

packages/mobile-sdk-alpha/**/*.{ts,tsx,js,jsx}: Review alpha mobile SDK code for:

  • API consistency with core SDK
  • Platform-neutral abstractions
  • Performance considerations
  • Clear experimental notes or TODOs

Files:

  • packages/mobile-sdk-alpha/demo-app/types/react-native-picker__picker.d.ts
  • packages/mobile-sdk-alpha/demo-app/jest.setup.js
  • packages/mobile-sdk-alpha/src/client.ts
  • packages/mobile-sdk-alpha/tests/documents/utils.test.ts
  • packages/mobile-sdk-alpha/src/components/screens/QRCodeScreen.tsx
  • packages/mobile-sdk-alpha/tsup.config.ts
  • packages/mobile-sdk-alpha/src/documents/utils.ts
  • packages/mobile-sdk-alpha/src/components/screens/PassportCameraScreen.tsx
  • packages/mobile-sdk-alpha/src/types/ui.ts
  • packages/mobile-sdk-alpha/src/components/screens/NFCScannerScreen.tsx
  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
  • packages/mobile-sdk-alpha/vitest.config.ts
common/src/**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

common/src/**/*.{ts,tsx,js,jsx}: Review shared utilities for:

  • Reusability and modular design
  • Type safety and error handling
  • Side-effect management
  • Documentation and naming clarity

Files:

  • common/src/types/index.ts
  • common/src/utils/certificate_parsing/curves.ts
  • common/src/types/globals.d.ts
  • common/src/utils/bytes.ts
  • common/src/utils/index.ts
app/ios/**/*

⚙️ CodeRabbit configuration file

app/ios/**/*: Review iOS-specific code for:

  • Platform-specific implementations
  • Performance considerations
  • Security best practices for mobile

Files:

  • app/ios/Podfile
  • app/ios/Self.xcodeproj/project.pbxproj
app/src/**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

app/src/**/*.{ts,tsx,js,jsx}: Review React Native TypeScript code for:

  • Component architecture and reusability
  • State management patterns
  • Performance optimizations
  • TypeScript type safety
  • React hooks usage and dependencies
  • Navigation patterns

Files:

  • app/src/types/globals.d.ts
.github/workflows/**/*.{yml,yaml}

📄 CodeRabbit inference engine (AGENTS.md)

.github/workflows/**/*.{yml,yaml}: In GitHub Actions workflows, use shared composite caching actions from .github/actions (cache-yarn, cache-bundler, cache-gradle, cache-pods)
Do not call actions/cache directly; rely on the shared composite caching actions
When using cache actions, optionally pass cache-version (often with GH_CACHE_VERSION and tool version) for stable keys

Files:

  • .github/workflows/mobile-e2e.yml
packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}}

📄 CodeRabbit inference engine (packages/mobile-sdk-alpha/AGENTS.md)

packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}}: Do NOT mock @selfxyz/mobile-sdk-alpha in tests (avoid jest.mock('@selfxyz/mobile-sdk-alpha') and replacing real functions with mocks)
Use actual imports from @selfxyz/mobile-sdk-alpha in tests
Write integration tests that exercise the real validation logic (not mocks)
Test isPassportDataValid() with realistic synthetic passport data (never real user data)
Verify extractMRZInfo() using published sample MRZ strings (e.g., ICAO examples)
Ensure parseNFCResponse() works with representative, synthetic NFC data
Never use real user PII in tests; use only synthetic, anonymized, or approved test vectors

Files:

  • packages/mobile-sdk-alpha/tests/documents/utils.test.ts
  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
**/*.{test,spec}.{ts,js,tsx,jsx}

⚙️ CodeRabbit configuration file

**/*.{test,spec}.{ts,js,tsx,jsx}: Review test files for:

  • Test coverage completeness
  • Test case quality and edge cases
  • Mock usage appropriateness
  • Test readability and maintainability

Files:

  • packages/mobile-sdk-alpha/tests/documents/utils.test.ts
  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
app/package.json

📄 CodeRabbit inference engine (.cursor/rules/mobile-sdk-migration.mdc)

Expose a 'test:build' script in the app's package.json that builds deps, types, performs bundle analysis, and runs tests

Files:

  • app/package.json
packages/mobile-sdk-alpha/vitest.config.ts

📄 CodeRabbit inference engine (.cursor/rules/mobile-sdk-migration.mdc)

Use Vitest in the SDK with a Node environment configured in packages/mobile-sdk-alpha/vitest.config.ts

Files:

  • packages/mobile-sdk-alpha/vitest.config.ts
packages/mobile-sdk-alpha/**/package.json

📄 CodeRabbit inference engine (packages/mobile-sdk-alpha/AGENTS.md)

packages/mobile-sdk-alpha/**/package.json: Ensure package exports are properly configured
Verify package conditions are valid (e.g., exports conditions)

Files:

  • packages/mobile-sdk-alpha/demo-app/package.json
  • packages/mobile-sdk-alpha/package.json
package.json

📄 CodeRabbit inference engine (.cursor/rules/technical-specification.mdc)

Distribute the SDK via npm/yarn with proper package metadata

Files:

  • package.json
packages/mobile-sdk-alpha/package.json

📄 CodeRabbit inference engine (.cursor/rules/mobile-sdk-migration.mdc)

packages/mobile-sdk-alpha/package.json: Expose a 'test:build' script in the SDK's package.json that runs build, test, types, and lint
Enable tree shaking for the SDK (e.g., ensure 'sideEffects' is correctly set in package.json and exports are ESM-friendly)

Files:

  • packages/mobile-sdk-alpha/package.json
🧠 Learnings (54)
📓 Common learnings
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/demo/** : Provide an in-SDK lightweight React Native demo under packages/mobile-sdk-alpha/demo/
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-08-24T18:52:25.796Z
Learning: Applies to src/navigation/**/*.{ts,tsx} : Set platform-specific initial routes: web → Home, mobile → Splash
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-08-24T18:52:25.796Z
Learning: Organize screens by feature modules (passport, home, settings, etc.)
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/samples/** : Create sample applications under packages/mobile-sdk-alpha/samples/ (RN demo and web demo)
Learnt from: transphorm
PR: selfxyz/self#942
File: app/vite.config.ts:170-0
Timestamp: 2025-08-23T02:02:02.556Z
Learning: In the selfxyz/self React Native app, devTools from '@/navigation/devTools' are intentionally shipped to production builds for testing purposes, not excluded as is typical in most applications.
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to app/jest.setup.js : Provide comprehensive Jest setup in app/jest.setup.js with required mocks
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/**/*.{ts,tsx} : Use strict TypeScript type checking across the codebase

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/types/react-native-picker__picker.d.ts
  • packages/mobile-sdk-alpha/src/client.ts
  • packages/mobile-sdk-alpha/tests/documents/utils.test.ts
  • packages/mobile-sdk-alpha/tsconfig.json
  • packages/mobile-sdk-alpha/tsup.config.ts
  • packages/mobile-sdk-alpha/demo-app/tsconfig.json
  • packages/mobile-sdk-alpha/src/documents/utils.ts
  • packages/mobile-sdk-alpha/src/types/ui.ts
  • app/tsconfig.json
  • packages/mobile-sdk-alpha/vitest.config.ts
  • packages/mobile-sdk-alpha/demo-app/package.json
  • package.json
  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/**/*.{ts,tsx} : Avoid introducing circular dependencies

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/types/react-native-picker__picker.d.ts
  • packages/mobile-sdk-alpha/src/client.ts
  • packages/mobile-sdk-alpha/tests/documents/utils.test.ts
  • packages/mobile-sdk-alpha/tsconfig.json
  • packages/mobile-sdk-alpha/tsup.config.ts
  • packages/mobile-sdk-alpha/demo-app/tsconfig.json
  • packages/mobile-sdk-alpha/src/documents/utils.ts
  • packages/mobile-sdk-alpha/src/types/ui.ts
  • app/package.json
  • app/tsconfig.json
  • packages/mobile-sdk-alpha/vitest.config.ts
  • packages/mobile-sdk-alpha/demo-app/package.json
  • packages/mobile-sdk-alpha/demo-app/metro.config.cjs
  • package.json
  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/src/index.ts : Re-export new SDK modules via packages/mobile-sdk-alpha/src/index.ts

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/types/react-native-picker__picker.d.ts
  • packages/mobile-sdk-alpha/src/client.ts
  • packages/mobile-sdk-alpha/tests/documents/utils.test.ts
  • packages/mobile-sdk-alpha/tsconfig.json
  • packages/mobile-sdk-alpha/tsup.config.ts
  • packages/mobile-sdk-alpha/demo-app/tsconfig.json
  • packages/mobile-sdk-alpha/src/documents/utils.ts
  • packages/mobile-sdk-alpha/src/types/ui.ts
  • app/tsconfig.json
  • common/src/utils/index.ts
  • packages/mobile-sdk-alpha/vitest.config.ts
  • packages/mobile-sdk-alpha/demo-app/metro.config.cjs
  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Use actual imports from selfxyz/mobile-sdk-alpha in tests

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/types/react-native-picker__picker.d.ts
  • packages/mobile-sdk-alpha/demo-app/jest.setup.js
  • packages/mobile-sdk-alpha/src/client.ts
  • packages/mobile-sdk-alpha/tests/documents/utils.test.ts
  • packages/mobile-sdk-alpha/tsconfig.json
  • packages/mobile-sdk-alpha/tsup.config.ts
  • packages/mobile-sdk-alpha/demo-app/tsconfig.json
  • packages/mobile-sdk-alpha/src/documents/utils.ts
  • packages/mobile-sdk-alpha/src/types/ui.ts
  • app/package.json
  • app/tsconfig.json
  • packages/mobile-sdk-alpha/demo-app/jest.config.cjs
  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
  • packages/mobile-sdk-alpha/vitest.config.ts
  • packages/mobile-sdk-alpha/demo-app/package.json
  • packages/mobile-sdk-alpha/demo-app/metro.config.cjs
  • package.json
  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-25T14:25:57.586Z
Learnt from: aaronmgdr
PR: selfxyz/self#951
File: app/src/providers/authProvider.web.tsx:17-18
Timestamp: 2025-08-25T14:25:57.586Z
Learning: The selfxyz/mobile-sdk-alpha/constants/analytics import path is properly configured with SDK exports, Metro aliases, and TypeScript resolution. Import changes from @/consts/analytics to this path are part of valid analytics migration, not TypeScript resolution issues.

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/types/react-native-picker__picker.d.ts
  • docs/METRO_WORKSPACE_GUIDE.md
  • packages/mobile-sdk-alpha/src/client.ts
  • packages/mobile-sdk-alpha/tests/documents/utils.test.ts
  • packages/mobile-sdk-alpha/tsconfig.json
  • packages/mobile-sdk-alpha/tsup.config.ts
  • packages/mobile-sdk-alpha/demo-app/tsconfig.json
  • packages/mobile-sdk-alpha/src/documents/utils.ts
  • packages/mobile-sdk-alpha/src/types/ui.ts
  • app/metro.config.cjs
  • app/tsconfig.json
  • common/src/utils/index.ts
  • packages/mobile-sdk-alpha/vitest.config.ts
  • packages/mobile-sdk-alpha/demo-app/package.json
  • packages/mobile-sdk-alpha/demo-app/metro.config.cjs
  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to app/jest.setup.js : Provide comprehensive Jest setup in app/jest.setup.js with required mocks

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/jest.setup.js
  • packages/mobile-sdk-alpha/demo-app/jest.config.cjs
  • packages/mobile-sdk-alpha/vitest.config.ts
📚 Learning: 2025-08-24T18:52:25.796Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-08-24T18:52:25.796Z
Learning: Applies to jest.setup.js : Maintain comprehensive mocks in jest.setup.js for all native modules

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/jest.setup.js
  • packages/mobile-sdk-alpha/demo-app/jest.config.cjs
  • packages/mobile-sdk-alpha/vitest.config.ts
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Do NOT mock selfxyz/mobile-sdk-alpha in tests (avoid jest.mock('selfxyz/mobile-sdk-alpha') and replacing real functions with mocks)

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/jest.setup.js
  • packages/mobile-sdk-alpha/src/client.ts
  • packages/mobile-sdk-alpha/tests/documents/utils.test.ts
  • packages/mobile-sdk-alpha/tsconfig.json
  • packages/mobile-sdk-alpha/tsup.config.ts
  • packages/mobile-sdk-alpha/demo-app/tsconfig.json
  • packages/mobile-sdk-alpha/src/types/ui.ts
  • app/tsconfig.json
  • packages/mobile-sdk-alpha/demo-app/jest.config.cjs
  • packages/mobile-sdk-alpha/vitest.config.ts
  • packages/mobile-sdk-alpha/demo-app/package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/tests/setup.ts : Provide Vitest setup file at packages/mobile-sdk-alpha/tests/setup.ts to suppress console noise

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/jest.setup.js
  • packages/mobile-sdk-alpha/tsconfig.json
  • packages/mobile-sdk-alpha/demo-app/tsconfig.json
  • packages/mobile-sdk-alpha/demo-app/jest.config.cjs
  • packages/mobile-sdk-alpha/vitest.config.ts
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/demo/** : Provide an in-SDK lightweight React Native demo under packages/mobile-sdk-alpha/demo/

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/jest.setup.js
  • packages/mobile-sdk-alpha/demo-app/scripts/bundle-analyze-ci.cjs
  • packages/mobile-sdk-alpha/demo-app/jest.config.cjs
  • packages/mobile-sdk-alpha/demo-app/package.json
  • packages/mobile-sdk-alpha/demo-app/metro.config.cjs
  • package.json
  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to app/jest.config.cjs : Use Jest in the app with a React Native preset configured in app/jest.config.cjs

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/jest.setup.js
  • babel.config.js
  • packages/mobile-sdk-alpha/demo-app/jest.config.cjs
  • packages/mobile-sdk-alpha/vitest.config.ts
  • packages/mobile-sdk-alpha/demo-app/package.json
  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Never use real user PII in tests; use only synthetic, anonymized, or approved test vectors

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/jest.setup.js
  • packages/mobile-sdk-alpha/tests/documents/utils.test.ts
  • packages/mobile-sdk-alpha/vitest.config.ts
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Ensure parseNFCResponse() works with representative, synthetic NFC data

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/jest.setup.js
  • packages/mobile-sdk-alpha/src/components/screens/NFCScannerScreen.tsx
  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
  • packages/mobile-sdk-alpha/demo-app/package.json
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Write integration tests that exercise the real validation logic (not mocks)

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/jest.setup.js
  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
  • packages/mobile-sdk-alpha/vitest.config.ts
📚 Learning: 2025-08-29T15:30:12.210Z
Learnt from: CR
PR: selfxyz/self#0
File: app/AGENTS.md:0-0
Timestamp: 2025-08-29T15:30:12.210Z
Learning: Document complex native module changes for AI review

Applied to files:

  • common/src/types/index.ts
  • docs/METRO_WORKSPACE_GUIDE.md
  • packages/mobile-sdk-alpha/src/client.ts
  • packages/mobile-sdk-alpha/tests/documents/utils.test.ts
📚 Learning: 2025-08-23T02:02:02.556Z
Learnt from: transphorm
PR: selfxyz/self#942
File: app/vite.config.ts:170-0
Timestamp: 2025-08-23T02:02:02.556Z
Learning: In the selfxyz/self React Native app, devTools from '@/navigation/devTools' are intentionally shipped to production builds for testing purposes, not excluded as is typical in most applications.

Applied to files:

  • app/src/types/globals.d.ts
📚 Learning: 2025-08-29T15:30:12.210Z
Learnt from: CR
PR: selfxyz/self#0
File: app/AGENTS.md:0-0
Timestamp: 2025-08-29T15:30:12.210Z
Learning: Bundle size remains within acceptable limits

Applied to files:

  • app/scripts/bundle-analyze-ci.cjs
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Confirm CI passes, build artifacts generate, and bundle size impact is acceptable after PR creation

Applied to files:

  • app/scripts/bundle-analyze-ci.cjs
📚 Learning: 2025-08-24T18:55:07.940Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/technical-specification.mdc:0-0
Timestamp: 2025-08-24T18:55:07.940Z
Learning: SDK bundle size must be under 2MB

Applied to files:

  • app/scripts/bundle-analyze-ci.cjs
📚 Learning: 2025-08-29T15:30:12.210Z
Learnt from: CR
PR: selfxyz/self#0
File: app/AGENTS.md:0-0
Timestamp: 2025-08-29T15:30:12.210Z
Learning: Verify Android build succeeds via yarn android

Applied to files:

  • .github/workflows/mobile-e2e.yml
📚 Learning: 2025-08-24T18:52:25.796Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-08-24T18:52:25.796Z
Learning: Use yarn scripts: yarn ios/android for builds, yarn test for unit tests, and Fastlane for deployments

Applied to files:

  • .github/workflows/mobile-e2e.yml
  • app/package.json
  • packages/mobile-sdk-alpha/demo-app/package.json
  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-29T15:30:12.210Z
Learnt from: CR
PR: selfxyz/self#0
File: app/AGENTS.md:0-0
Timestamp: 2025-08-29T15:30:12.210Z
Learning: Verify iOS build succeeds via yarn ios

Applied to files:

  • .github/workflows/mobile-e2e.yml
📚 Learning: 2025-08-29T15:30:12.210Z
Learnt from: CR
PR: selfxyz/self#0
File: app/AGENTS.md:0-0
Timestamp: 2025-08-29T15:30:12.210Z
Learning: From app/ios, run bundle install && bundle exec pod install (or from app run npx pod-install)

Applied to files:

  • .github/workflows/mobile-e2e.yml
📚 Learning: 2025-08-29T15:30:12.210Z
Learnt from: CR
PR: selfxyz/self#0
File: app/AGENTS.md:0-0
Timestamp: 2025-08-29T15:30:12.210Z
Learning: Run the app with yarn ios during development as needed

Applied to files:

  • .github/workflows/mobile-e2e.yml
📚 Learning: 2025-07-28T19:18:48.270Z
Learnt from: transphorm
PR: selfxyz/self#795
File: app/src/screens/prove/ProveScreen.tsx:5-5
Timestamp: 2025-07-28T19:18:48.270Z
Learning: The import path 'selfxyz/common/utils/scope' is valid when the common package has a "./utils/*" export mapping in package.json, even if ESLint shows resolution errors before the package is built. The package.json exports field properly maps "./utils/*" to the compiled files in dist/.

Applied to files:

  • docs/METRO_WORKSPACE_GUIDE.md
  • packages/mobile-sdk-alpha/tsconfig.json
  • app/tsconfig.json
  • package.json
📚 Learning: 2025-08-24T18:52:25.796Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-08-24T18:52:25.796Z
Learning: Applies to src/types/**/*.{ts,tsx} : Place type definitions in @/types

Applied to files:

  • common/tsconfig.json
  • packages/mobile-sdk-alpha/demo-app/tsconfig.json
📚 Learning: 2025-08-24T18:52:25.796Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-08-24T18:52:25.796Z
Learning: Applies to src/**/*.{ios.ts,ios.tsx,android.ts,android.tsx} : Use platform-specific files (.ios.tsx/.android.tsx etc.) for differing implementations

Applied to files:

  • common/tsconfig.json
  • packages/mobile-sdk-alpha/demo-app/tsconfig.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Update the app to consume the mobile-sdk-alpha package and replace local modules with SDK imports

Applied to files:

  • packages/mobile-sdk-alpha/src/client.ts
  • packages/mobile-sdk-alpha/demo-app/package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/README.md : Document new/updated SDK modules and usage in packages/mobile-sdk-alpha/README.md

Applied to files:

  • packages/mobile-sdk-alpha/src/client.ts
  • packages/mobile-sdk-alpha/demo-app/package.json
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Test isPassportDataValid() with realistic synthetic passport data (never real user data)

Applied to files:

  • packages/mobile-sdk-alpha/tests/documents/utils.test.ts
  • packages/mobile-sdk-alpha/src/documents/utils.ts
  • packages/mobile-sdk-alpha/src/components/screens/PassportCameraScreen.tsx
  • packages/mobile-sdk-alpha/src/types/ui.ts
  • common/src/utils/index.ts
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Verify extractMRZInfo() using published sample MRZ strings (e.g., ICAO examples)

Applied to files:

  • packages/mobile-sdk-alpha/tests/documents/utils.test.ts
  • packages/mobile-sdk-alpha/src/components/screens/PassportCameraScreen.tsx
  • packages/mobile-sdk-alpha/src/types/ui.ts
  • packages/mobile-sdk-alpha/src/components/screens/NFCScannerScreen.tsx
  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
  • packages/mobile-sdk-alpha/demo-app/package.json
📚 Learning: 2025-07-16T02:20:44.173Z
Learnt from: transphorm
PR: selfxyz/self#636
File: app/src/components/native/QRCodeScanner.tsx:135-142
Timestamp: 2025-07-16T02:20:44.173Z
Learning: In app/src/components/native/QRCodeScanner.tsx, the Android camera dimension multipliers (screenWidth * 3 and screenHeight * 2) are intentionally set to these values and should not be changed. These multipliers are correct and any visual issues with black areas in the camera preview are caused by other factors, not the dimension calculations.

Applied to files:

  • packages/mobile-sdk-alpha/src/components/screens/QRCodeScreen.tsx
  • packages/mobile-sdk-alpha/src/components/screens/PassportCameraScreen.tsx
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/package.json : Expose a 'test:build' script in the SDK's package.json that runs build, test, types, and lint

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/scripts/bundle-analyze-ci.cjs
  • packages/mobile-sdk-alpha/demo-app/package.json
  • package.json
  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/package.json : Enable tree shaking for the SDK (e.g., ensure 'sideEffects' is correctly set in package.json and exports are ESM-friendly)

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/scripts/bundle-analyze-ci.cjs
  • packages/mobile-sdk-alpha/tsconfig.json
  • packages/mobile-sdk-alpha/tsup.config.ts
  • packages/mobile-sdk-alpha/demo-app/tsconfig.json
  • app/tsconfig.json
  • packages/mobile-sdk-alpha/demo-app/jest.config.cjs
  • packages/mobile-sdk-alpha/demo-app/package.json
  • packages/mobile-sdk-alpha/demo-app/metro.config.cjs
  • package.json
  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/**/package.json : Verify package conditions are valid (e.g., exports conditions)

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/scripts/bundle-analyze-ci.cjs
  • packages/mobile-sdk-alpha/demo-app/package.json
  • package.json
  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to app/package.json : Expose a 'test:build' script in the app's package.json that builds deps, types, performs bundle analysis, and runs tests

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/scripts/bundle-analyze-ci.cjs
  • packages/mobile-sdk-alpha/vitest.config.ts
  • package.json
  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-24T18:55:07.940Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/technical-specification.mdc:0-0
Timestamp: 2025-08-24T18:55:07.940Z
Learning: Do bundle analysis to validate tree-shaking effectiveness

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/scripts/bundle-analyze-ci.cjs
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/**/package.json : Ensure package exports are properly configured

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/scripts/bundle-analyze-ci.cjs
  • packages/mobile-sdk-alpha/tsconfig.json
  • packages/mobile-sdk-alpha/tsup.config.ts
  • packages/mobile-sdk-alpha/demo-app/tsconfig.json
  • app/package.json
  • app/tsconfig.json
  • packages/mobile-sdk-alpha/demo-app/package.json
  • packages/mobile-sdk-alpha/demo-app/metro.config.cjs
  • package.json
  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/**/*.{ts,tsx} : Follow ESLint TypeScript-specific rules

Applied to files:

  • packages/mobile-sdk-alpha/tsconfig.json
  • packages/mobile-sdk-alpha/tsup.config.ts
  • packages/mobile-sdk-alpha/demo-app/tsconfig.json
📚 Learning: 2025-08-24T18:52:25.796Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-08-24T18:52:25.796Z
Learning: Applies to tests/src/**/*.{ts,tsx,js,jsx} : Use tests/ alias for test imports

Applied to files:

  • packages/mobile-sdk-alpha/tsconfig.json
  • packages/mobile-sdk-alpha/vitest.config.ts
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to app/jest.config.cjs : Configure moduleNameMapper in app/jest.config.cjs to map '@/'' to 'src/' and 'tests/' to 'tests/src/'

Applied to files:

  • packages/mobile-sdk-alpha/tsconfig.json
  • packages/mobile-sdk-alpha/demo-app/jest.config.cjs
  • packages/mobile-sdk-alpha/vitest.config.ts
  • packages/mobile-sdk-alpha/demo-app/metro.config.cjs
📚 Learning: 2025-08-02T23:53:45.928Z
Learnt from: transphorm
PR: selfxyz/self#823
File: app/ios/Self.xcodeproj/project.pbxproj:320-332
Timestamp: 2025-08-02T23:53:45.928Z
Learning: When reviewing autogenerated scripts in Xcode project files (like React Native Firebase's embedded shell scripts), avoid suggesting edits since these are regenerated during pod install and cannot be manually modified by users.

Applied to files:

  • app/ios/Self.xcodeproj/project.pbxproj
📚 Learning: 2025-08-01T17:55:02.423Z
Learnt from: transphorm
PR: selfxyz/self#823
File: app/ios/Podfile:108-116
Timestamp: 2025-08-01T17:55:02.423Z
Learning: In React Native iOS projects, the RNSentry target can exist and require warning suppressions (CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION, CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF, GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS) even when Sentry npm packages aren't directly visible in package.json. The target is created through React Native Sentry integration and the warning suppressions are necessary and functional.

Applied to files:

  • app/ios/Self.xcodeproj/project.pbxproj
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/src/processing/** : Place MRZ processing helpers in packages/mobile-sdk-alpha/src/processing/

Applied to files:

  • packages/mobile-sdk-alpha/src/types/ui.ts
📚 Learning: 2025-08-24T18:52:25.796Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-08-24T18:52:25.796Z
Learning: Applies to native/ios/**/*.{swift} : iOS NFC: implement custom PassportReader as a Swift module

Applied to files:

  • packages/mobile-sdk-alpha/src/components/screens/NFCScannerScreen.tsx
📚 Learning: 2025-08-24T18:52:25.796Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-08-24T18:52:25.796Z
Learning: Applies to native/android/**/*.{kt,kts} : Android NFC: implement RNPassportReaderModule in Kotlin

Applied to files:

  • packages/mobile-sdk-alpha/src/components/screens/NFCScannerScreen.tsx
📚 Learning: 2025-08-29T15:29:47.727Z
Learnt from: CR
PR: selfxyz/self#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:29:47.727Z
Learning: Use nvm and Corepack to set up the Yarn v4 monorepo before any other commands (nvm use; corepack enable; corepack prepare yarnstable --activate; yarn install)

Applied to files:

  • app/metro.config.cjs
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/vitest.config.ts : Use Vitest in the SDK with a Node environment configured in packages/mobile-sdk-alpha/vitest.config.ts

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/jest.config.cjs
  • packages/mobile-sdk-alpha/vitest.config.ts
📚 Learning: 2025-08-24T18:52:25.796Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-08-24T18:52:25.796Z
Learning: Applies to tests/src/**/*.{test,spec}.{ts,tsx,js,jsx} : Use renderHook for custom hook testing

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/samples/** : Create sample applications under packages/mobile-sdk-alpha/samples/ (RN demo and web demo)

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/package.json
📚 Learning: 2025-08-24T18:55:07.940Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/technical-specification.mdc:0-0
Timestamp: 2025-08-24T18:55:07.940Z
Learning: Applies to package.json : Distribute the SDK via npm/yarn with proper package metadata

Applied to files:

  • package.json
📚 Learning: 2025-08-29T15:29:47.727Z
Learnt from: CR
PR: selfxyz/self#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:29:47.727Z
Learning: Before PRs, ensure yarn build succeeds for all workspaces

Applied to files:

  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-01T17:11:39.232Z
Learnt from: transphorm
PR: selfxyz/self#823
File: common/package.json:21-60
Timestamp: 2025-08-01T17:11:39.232Z
Learning: Explicit export mappings in package.json exports field provide better tree shaking than wildcard patterns because they enable easier static analysis by bundlers, allowing for more precise dependency graph understanding and better dead code elimination.

Applied to files:

  • packages/mobile-sdk-alpha/package.json
🧬 Code graph analysis (10)
packages/mobile-sdk-alpha/demo-app/jest.setup.js (1)
app/android/react-native-passport-reader/index.android.js (1)
  • NativeModules (5-5)
packages/mobile-sdk-alpha/src/components/screens/QRCodeScreen.tsx (2)
packages/mobile-sdk-alpha/src/index.ts (2)
  • QRCodeScreen (70-70)
  • ScreenProps (44-44)
packages/mobile-sdk-alpha/src/types/ui.ts (1)
  • ScreenProps (30-33)
scripts/lint-headers.cjs (2)
scripts/check-duplicate-headers.cjs (1)
  • require (8-8)
scripts/check-license-headers.mjs (1)
  • isFix (182-182)
packages/mobile-sdk-alpha/demo-app/scripts/bundle-analyze-ci.cjs (1)
app/scripts/bundle-analyze-ci.cjs (7)
  • os (8-8)
  • platform (11-11)
  • BUNDLE_THRESHOLDS_MB (18-21)
  • i (26-26)
  • tmpDir (61-61)
  • bundleFile (62-62)
  • sourcemapFile (63-63)
common/src/utils/bytes.ts (1)
common/src/utils/utils.ts (1)
  • packBytes (264-278)
packages/mobile-sdk-alpha/src/components/screens/PassportCameraScreen.tsx (2)
packages/mobile-sdk-alpha/src/types/ui.ts (1)
  • PassportCameraProps (35-37)
packages/mobile-sdk-alpha/src/components/MRZScannerView.tsx (1)
  • MRZScannerView (54-140)
scripts/check-license-headers.mjs (2)
app/scripts/analyze-tree-shaking.cjs (5)
  • args (587-587)
  • files (30-30)
  • files (273-273)
  • files (287-287)
  • findFiles (272-285)
scripts/migrate-license-headers.mjs (6)
  • args (202-202)
  • files (29-29)
  • files (180-180)
  • files (254-254)
  • files (296-296)
  • projectRoot (206-207)
app/metro.config.cjs (1)
packages/mobile-sdk-alpha/demo-app/metro.config.cjs (7)
  • findYarnWorkspaceRoot (7-7)
  • require (5-5)
  • defaultConfig (9-9)
  • projectRoot (11-11)
  • workspaceRoot (12-12)
  • path (6-6)
  • config (18-40)
scripts/check-duplicate-headers.cjs (1)
scripts/check-license-headers.mjs (1)
  • args (181-181)
packages/mobile-sdk-alpha/demo-app/metro.config.cjs (1)
app/metro.config.cjs (8)
  • path (6-6)
  • require (5-5)
  • findYarnWorkspaceRoot (7-7)
  • defaultConfig (9-9)
  • defaultConfig (10-10)
  • projectRoot (12-12)
  • workspaceRoot (13-14)
  • config (25-95)
🪛 Biome (2.1.2)
packages/mobile-sdk-alpha/demo-app/jest.setup.js

[error] 64-64: This property is later overwritten by an object member with the same name.

Overwritten with this property.

If an object property with the same name is defined multiple times (except when combining a getter with a setter), only the last definition makes it into the object and previous definitions are ignored.
Unsafe fix: Remove this property.

(lint/suspicious/noDuplicateObjectKeys)


[error] 72-72: This property is later overwritten by an object member with the same name.

Overwritten with this property.

If an object property with the same name is defined multiple times (except when combining a getter with a setter), only the last definition makes it into the object and previous definitions are ignored.
Unsafe fix: Remove this property.

(lint/suspicious/noDuplicateObjectKeys)

🪛 markdownlint-cli2 (0.17.2)
docs/METRO_WORKSPACE_GUIDE.md

9-9: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🪛 GitHub Actions: Web CI
common/src/utils/bytes.ts

[warning] 10-10: Big integer literals are not available in the configured target environment ("es2018") and may crash at run-time.


[warning] 96-96: Big integer literals are not available in the configured target environment ("es2018") and may crash at run-time.


[warning] 102-102: Big integer literals are not available in the configured target environment ("es2018") and may crash at run-time.


[warning] 114-114: Big integer literals are not available in the configured target environment ("es2018") and may crash at run-time.


[warning] 117-117: Big integer literals are not available in the configured target environment ("es2018") and may crash at run-time.


[warning] 131-131: Big integer literals are not available in the configured target environment ("es2018") and may crash at run-time.

⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: analyze-android
  • GitHub Check: build-deps
  • GitHub Check: analyze-ios
  • GitHub Check: e2e-ios

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (6)
packages/mobile-sdk-alpha/src/components/screens/NFCScannerScreen.tsx (1)

19-40: Fix stale mrzData capture in useCallback.

mrzData is read inside onNFCScan but omitted from the dependency array, so updates to the MRZ payload won’t propagate to the NFC scan call and we’ll keep using the old document numbers/dates. Please add it to the dependency list.

-    [client, onSuccess, onFailure],
+    [client, onSuccess, onFailure, mrzData],
app/src/screens/recovery/AccountRecoveryChoiceScreen.tsx (2)

136-141: Fix inverted biometrics message condition.

You’re showing the “doesn’t support biometrics” message when biometrics are available. Flip the conditional.

-            {biometricsAvailable && (
+            {!biometricsAvailable && (
               <>
                 Your device doesn't support biometrics or is disabled for apps
                 and is required for cloud storage.
               </>
             )}

99-103: Don’t throw from UI handler catch; return gracefully.

Throwing here can result in an unhandled promise rejection and crash/redbox. Remove the throw and keep UX flow controlled.

   } catch (e: unknown) {
     console.error(e);
     trackEvent(BackupEvents.CLOUD_RESTORE_FAILED_UNKNOWN);
     setRestoring(false);
-    throw new Error('Something wrong happened during cloud recovery');
   }
app/src/screens/recovery/RecoverWithPhraseScreen.tsx (1)

85-93: Incorrect branch: calling reStorePassportDataWithRightCSCA on unregistered path.

You should store CSCA only when isRegistered is true. Currently it runs in the “not registered” branch.

-    if (!isRegistered) {
-      console.warn(
-        'Secret provided did not match a registered passport. Please try again.',
-      );
-      reStorePassportDataWithRightCSCA(passportData, csca as string);
-      navigation.navigate('Launch');
-      setRestoring(false);
-      return;
-    }
+    if (!isRegistered) {
+      console.warn(
+        'Secret provided did not match a registered passport. Please try again.',
+      );
+      navigation.navigate('Launch');
+      setRestoring(false);
+      return;
+    }
+    // Registered path: persist the matching CSCA
+    reStorePassportDataWithRightCSCA(passportData, csca as string);
app/src/utils/proving/provingMachine.ts (2)

870-876: Avoid using new MessageEvent in React Native.

RN doesn’t reliably expose the DOM MessageEvent constructor; this can throw at runtime in Hermes/JSC. Pass a plain event-like object instead.

-      get()._handleWebSocketMessage(
-        new MessageEvent('error', {
-          data: JSON.stringify({ error: 'WebSocket connection error' }),
-        }),
-        selfClient,
-      );
+      get()._handleWebSocketMessage(
+        { data: JSON.stringify({ error: 'WebSocket connection error' }) } as any,
+        selfClient,
+      );

901-905: Same: replace MessageEvent in close handler.

Use a plain object to avoid runtime crashes.

-      get()._handleWebSocketMessage(
-        new MessageEvent('error', {
-          data: JSON.stringify({ error: 'WebSocket closed unexpectedly' }),
-        }),
-        selfClient,
-      );
+      get()._handleWebSocketMessage(
+        { data: JSON.stringify({ error: 'WebSocket closed unexpectedly' }) } as any,
+        selfClient,
+      );
🧹 Nitpick comments (2)
packages/mobile-sdk-demo/tests/crypto-polyfill.test.js (1)

131-147: Relax brittle error message assertion

The implementation in common/src/polyfills/crypto.ts throws 'globalThis.crypto.getRandomValues is not available'. Your test expects 'crypto.getRandomValues not available'. Make the regex resilient.

-      }).toThrow(/crypto.getRandomValues not available/);
+      }).toThrow(/getRandomValues.*not available/i);
common/src/polyfills/crypto.ts (1)

19-19: Normalize algorithm names to accept sha-256/sha_256/SHA256 variants

Current matching requires exact 'sha256'/'sha512' etc. Normalize by stripping non-alphanumerics.

-  const alg = algorithm.toLowerCase();
+  const alg = algorithm.replace(/[\W_]/g, '').toLowerCase();
@@
-  const alg = algorithm.toLowerCase();
+  const alg = algorithm.replace(/[\W_]/g, '').toLowerCase();
@@
-  switch (digest.toLowerCase()) {
+  const dig = digest.replace(/[\W_]/g, '').toLowerCase();
+  switch (dig) {

Also applies to: 61-63, 124-136

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7063a33 and 259b5ac.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (32)
  • app/ios/Podfile (2 hunks)
  • app/src/screens/recovery/AccountRecoveryChoiceScreen.tsx (1 hunks)
  • app/src/screens/recovery/RecoverWithPhraseScreen.tsx (1 hunks)
  • app/src/utils/proving/provingMachine.ts (3 hunks)
  • app/tests/utils/proving/provingMachine.startFetchingData.test.ts (1 hunks)
  • app/tests/utils/proving/provingMachine.test.ts (1 hunks)
  • app/tsconfig.json (1 hunks)
  • app/vite.config.ts (3 hunks)
  • common/index.ts (3 hunks)
  • common/src/polyfills/crypto.ts (1 hunks)
  • common/src/utils/index.ts (3 hunks)
  • common/tests/crypto-hmac.test.ts (1 hunks)
  • packages/mobile-sdk-alpha/package.json (3 hunks)
  • packages/mobile-sdk-alpha/src/client.ts (1 hunks)
  • packages/mobile-sdk-alpha/src/components/screens/NFCScannerScreen.tsx (2 hunks)
  • packages/mobile-sdk-alpha/src/documents/utils.ts (1 hunks)
  • packages/mobile-sdk-alpha/src/index.ts (2 hunks)
  • packages/mobile-sdk-alpha/src/mock/generator.ts (1 hunks)
  • packages/mobile-sdk-alpha/src/processing/generateDisclosureInputs.ts (1 hunks)
  • packages/mobile-sdk-alpha/src/stores/protocolStore.ts (2 hunks)
  • packages/mobile-sdk-alpha/src/stores/selfAppStore.tsx (1 hunks)
  • packages/mobile-sdk-alpha/src/types/events.ts (1 hunks)
  • packages/mobile-sdk-alpha/src/types/public.ts (1 hunks)
  • packages/mobile-sdk-alpha/src/validation/document.ts (1 hunks)
  • packages/mobile-sdk-demo/.eslintrc.cjs (1 hunks)
  • packages/mobile-sdk-demo/android/app/build.gradle (1 hunks)
  • packages/mobile-sdk-demo/crypto-polyfill.js (1 hunks)
  • packages/mobile-sdk-demo/ios/SelfDemoApp/AppDelegate.swift (1 hunks)
  • packages/mobile-sdk-demo/jest.setup.js (1 hunks)
  • packages/mobile-sdk-demo/metro.config.cjs (1 hunks)
  • packages/mobile-sdk-demo/package.json (1 hunks)
  • packages/mobile-sdk-demo/tests/crypto-polyfill.test.js (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/mobile-sdk-alpha/src/types/public.ts
🚧 Files skipped from review as they are similar to previous changes (9)
  • packages/mobile-sdk-alpha/src/mock/generator.ts
  • app/vite.config.ts
  • packages/mobile-sdk-demo/metro.config.cjs
  • packages/mobile-sdk-demo/crypto-polyfill.js
  • packages/mobile-sdk-demo/android/app/build.gradle
  • packages/mobile-sdk-alpha/src/documents/utils.ts
  • packages/mobile-sdk-alpha/src/client.ts
  • packages/mobile-sdk-demo/jest.setup.js
  • app/tests/utils/proving/provingMachine.test.ts
🧰 Additional context used
📓 Path-based instructions (13)
**/*.{js,ts,tsx,jsx,sol,nr}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{js,ts,tsx,jsx,sol,nr}: NEVER log sensitive data including PII (names, DOB, passport numbers, addresses), credentials, tokens, API keys, private keys, or session identifiers.
ALWAYS redact/mask sensitive fields in logs using consistent patterns (e.g., ***-***-1234 for passport numbers, J*** D*** for names).

Files:

  • app/src/utils/proving/provingMachine.ts
  • common/tests/crypto-hmac.test.ts
  • packages/mobile-sdk-alpha/src/validation/document.ts
  • packages/mobile-sdk-demo/tests/crypto-polyfill.test.js
  • app/src/screens/recovery/AccountRecoveryChoiceScreen.tsx
  • app/tests/utils/proving/provingMachine.startFetchingData.test.ts
  • packages/mobile-sdk-alpha/src/index.ts
  • packages/mobile-sdk-alpha/src/types/events.ts
  • common/index.ts
  • packages/mobile-sdk-alpha/src/stores/selfAppStore.tsx
  • common/src/utils/index.ts
  • app/src/screens/recovery/RecoverWithPhraseScreen.tsx
  • packages/mobile-sdk-alpha/src/stores/protocolStore.ts
  • common/src/polyfills/crypto.ts
  • packages/mobile-sdk-alpha/src/processing/generateDisclosureInputs.ts
  • packages/mobile-sdk-alpha/src/components/screens/NFCScannerScreen.tsx
app/**/*.{ts,tsx}

📄 CodeRabbit inference engine (app/AGENTS.md)

Type checking must pass before PRs (yarn types)

Files:

  • app/src/utils/proving/provingMachine.ts
  • app/src/screens/recovery/AccountRecoveryChoiceScreen.tsx
  • app/tests/utils/proving/provingMachine.startFetchingData.test.ts
  • app/src/screens/recovery/RecoverWithPhraseScreen.tsx
app/src/**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

app/src/**/*.{ts,tsx,js,jsx}: Review React Native TypeScript code for:

  • Component architecture and reusability
  • State management patterns
  • Performance optimizations
  • TypeScript type safety
  • React hooks usage and dependencies
  • Navigation patterns

Files:

  • app/src/utils/proving/provingMachine.ts
  • app/src/screens/recovery/AccountRecoveryChoiceScreen.tsx
  • app/src/screens/recovery/RecoverWithPhraseScreen.tsx
**/*.{test,spec}.{ts,js,tsx,jsx}

⚙️ CodeRabbit configuration file

**/*.{test,spec}.{ts,js,tsx,jsx}: Review test files for:

  • Test coverage completeness
  • Test case quality and edge cases
  • Mock usage appropriateness
  • Test readability and maintainability

Files:

  • common/tests/crypto-hmac.test.ts
  • packages/mobile-sdk-demo/tests/crypto-polyfill.test.js
  • app/tests/utils/proving/provingMachine.startFetchingData.test.ts
packages/mobile-sdk-alpha/src/validation/**

📄 CodeRabbit inference engine (.cursor/rules/mobile-sdk-migration.mdc)

Place document validation logic in packages/mobile-sdk-alpha/src/validation/

Files:

  • packages/mobile-sdk-alpha/src/validation/document.ts
packages/mobile-sdk-alpha/**/*.{ts,tsx}

📄 CodeRabbit inference engine (packages/mobile-sdk-alpha/AGENTS.md)

packages/mobile-sdk-alpha/**/*.{ts,tsx}: Use strict TypeScript type checking across the codebase
Follow ESLint TypeScript-specific rules
Avoid introducing circular dependencies

Files:

  • packages/mobile-sdk-alpha/src/validation/document.ts
  • packages/mobile-sdk-alpha/src/index.ts
  • packages/mobile-sdk-alpha/src/types/events.ts
  • packages/mobile-sdk-alpha/src/stores/selfAppStore.tsx
  • packages/mobile-sdk-alpha/src/stores/protocolStore.ts
  • packages/mobile-sdk-alpha/src/processing/generateDisclosureInputs.ts
  • packages/mobile-sdk-alpha/src/components/screens/NFCScannerScreen.tsx
packages/mobile-sdk-alpha/**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

packages/mobile-sdk-alpha/**/*.{ts,tsx,js,jsx}: Review alpha mobile SDK code for:

  • API consistency with core SDK
  • Platform-neutral abstractions
  • Performance considerations
  • Clear experimental notes or TODOs

Files:

  • packages/mobile-sdk-alpha/src/validation/document.ts
  • packages/mobile-sdk-alpha/src/index.ts
  • packages/mobile-sdk-alpha/src/types/events.ts
  • packages/mobile-sdk-alpha/src/stores/selfAppStore.tsx
  • packages/mobile-sdk-alpha/src/stores/protocolStore.ts
  • packages/mobile-sdk-alpha/src/processing/generateDisclosureInputs.ts
  • packages/mobile-sdk-alpha/src/components/screens/NFCScannerScreen.tsx
packages/mobile-sdk-alpha/src/index.ts

📄 CodeRabbit inference engine (.cursor/rules/mobile-sdk-migration.mdc)

Re-export new SDK modules via packages/mobile-sdk-alpha/src/index.ts

Files:

  • packages/mobile-sdk-alpha/src/index.ts
app/ios/**/*

⚙️ CodeRabbit configuration file

app/ios/**/*: Review iOS-specific code for:

  • Platform-specific implementations
  • Performance considerations
  • Security best practices for mobile

Files:

  • app/ios/Podfile
common/src/**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

common/src/**/*.{ts,tsx,js,jsx}: Review shared utilities for:

  • Reusability and modular design
  • Type safety and error handling
  • Side-effect management
  • Documentation and naming clarity

Files:

  • common/src/utils/index.ts
  • common/src/polyfills/crypto.ts
packages/mobile-sdk-alpha/package.json

📄 CodeRabbit inference engine (.cursor/rules/mobile-sdk-migration.mdc)

packages/mobile-sdk-alpha/package.json: Expose a 'test:build' script in the SDK's package.json that runs build, test, types, and lint
Enable tree shaking for the SDK (e.g., ensure 'sideEffects' is correctly set in package.json and exports are ESM-friendly)

Files:

  • packages/mobile-sdk-alpha/package.json
packages/mobile-sdk-alpha/**/package.json

📄 CodeRabbit inference engine (packages/mobile-sdk-alpha/AGENTS.md)

packages/mobile-sdk-alpha/**/package.json: Ensure package exports are properly configured
Verify package conditions are valid (e.g., exports conditions)

Files:

  • packages/mobile-sdk-alpha/package.json
packages/mobile-sdk-alpha/src/processing/**

📄 CodeRabbit inference engine (.cursor/rules/mobile-sdk-migration.mdc)

Place MRZ processing helpers in packages/mobile-sdk-alpha/src/processing/

Files:

  • packages/mobile-sdk-alpha/src/processing/generateDisclosureInputs.ts
🧠 Learnings (43)
📓 Common learnings
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/demo/** : Provide an in-SDK lightweight React Native demo under packages/mobile-sdk-alpha/demo/
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/samples/** : Create sample applications under packages/mobile-sdk-alpha/samples/ (RN demo and web demo)
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/README.md : Document new/updated SDK modules and usage in packages/mobile-sdk-alpha/README.md
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/src/index.ts : Re-export new SDK modules via packages/mobile-sdk-alpha/src/index.ts
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Update the app to consume the mobile-sdk-alpha package and replace local modules with SDK imports
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Use actual imports from selfxyz/mobile-sdk-alpha in tests
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Use actual imports from selfxyz/mobile-sdk-alpha in tests

Applied to files:

  • app/tsconfig.json
  • packages/mobile-sdk-alpha/src/validation/document.ts
  • app/tests/utils/proving/provingMachine.startFetchingData.test.ts
  • packages/mobile-sdk-alpha/src/index.ts
  • packages/mobile-sdk-alpha/src/types/events.ts
  • packages/mobile-sdk-alpha/src/stores/selfAppStore.tsx
  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-demo/package.json
  • packages/mobile-sdk-demo/.eslintrc.cjs
  • packages/mobile-sdk-alpha/src/stores/protocolStore.ts
  • packages/mobile-sdk-alpha/src/processing/generateDisclosureInputs.ts
📚 Learning: 2025-08-25T14:25:57.586Z
Learnt from: aaronmgdr
PR: selfxyz/self#951
File: app/src/providers/authProvider.web.tsx:17-18
Timestamp: 2025-08-25T14:25:57.586Z
Learning: The selfxyz/mobile-sdk-alpha/constants/analytics import path is properly configured with SDK exports, Metro aliases, and TypeScript resolution. Import changes from @/consts/analytics to this path are part of valid analytics migration, not TypeScript resolution issues.

Applied to files:

  • app/tsconfig.json
  • packages/mobile-sdk-alpha/src/validation/document.ts
  • packages/mobile-sdk-alpha/src/index.ts
  • packages/mobile-sdk-alpha/src/types/events.ts
  • packages/mobile-sdk-alpha/src/stores/selfAppStore.tsx
  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-demo/package.json
  • packages/mobile-sdk-demo/.eslintrc.cjs
  • packages/mobile-sdk-alpha/src/stores/protocolStore.ts
  • packages/mobile-sdk-alpha/src/processing/generateDisclosureInputs.ts
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/**/*.{ts,tsx} : Avoid introducing circular dependencies

Applied to files:

  • app/tsconfig.json
  • packages/mobile-sdk-alpha/src/validation/document.ts
  • packages/mobile-sdk-alpha/src/index.ts
  • packages/mobile-sdk-alpha/src/types/events.ts
  • packages/mobile-sdk-alpha/src/stores/selfAppStore.tsx
  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-demo/package.json
  • packages/mobile-sdk-demo/.eslintrc.cjs
  • packages/mobile-sdk-alpha/src/stores/protocolStore.ts
  • packages/mobile-sdk-alpha/src/processing/generateDisclosureInputs.ts
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/**/*.{ts,tsx} : Use strict TypeScript type checking across the codebase

Applied to files:

  • app/tsconfig.json
  • packages/mobile-sdk-alpha/src/types/events.ts
  • packages/mobile-sdk-alpha/src/stores/selfAppStore.tsx
  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-demo/package.json
  • packages/mobile-sdk-demo/.eslintrc.cjs
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Do NOT mock selfxyz/mobile-sdk-alpha in tests (avoid jest.mock('selfxyz/mobile-sdk-alpha') and replacing real functions with mocks)

Applied to files:

  • app/tsconfig.json
  • packages/mobile-sdk-demo/tests/crypto-polyfill.test.js
  • app/tests/utils/proving/provingMachine.startFetchingData.test.ts
  • packages/mobile-sdk-alpha/src/types/events.ts
  • packages/mobile-sdk-alpha/src/stores/selfAppStore.tsx
  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-demo/package.json
  • packages/mobile-sdk-demo/.eslintrc.cjs
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/src/index.ts : Re-export new SDK modules via packages/mobile-sdk-alpha/src/index.ts

Applied to files:

  • app/tsconfig.json
  • packages/mobile-sdk-alpha/src/validation/document.ts
  • packages/mobile-sdk-alpha/src/index.ts
  • packages/mobile-sdk-alpha/src/types/events.ts
  • packages/mobile-sdk-alpha/src/stores/selfAppStore.tsx
  • common/src/utils/index.ts
  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-demo/package.json
  • packages/mobile-sdk-demo/.eslintrc.cjs
  • packages/mobile-sdk-alpha/src/stores/protocolStore.ts
  • packages/mobile-sdk-alpha/src/processing/generateDisclosureInputs.ts
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/package.json : Enable tree shaking for the SDK (e.g., ensure 'sideEffects' is correctly set in package.json and exports are ESM-friendly)

Applied to files:

  • app/tsconfig.json
  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-demo/package.json
  • packages/mobile-sdk-demo/.eslintrc.cjs
📚 Learning: 2025-07-28T19:18:48.270Z
Learnt from: transphorm
PR: selfxyz/self#795
File: app/src/screens/prove/ProveScreen.tsx:5-5
Timestamp: 2025-07-28T19:18:48.270Z
Learning: The import path 'selfxyz/common/utils/scope' is valid when the common package has a "./utils/*" export mapping in package.json, even if ESLint shows resolution errors before the package is built. The package.json exports field properly maps "./utils/*" to the compiled files in dist/.

Applied to files:

  • app/tsconfig.json
  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-demo/package.json
📚 Learning: 2025-09-22T11:10:22.019Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-09-22T11:10:22.019Z
Learning: Applies to **/*.{js,ts,tsx,jsx,sol,nr} : ALWAYS redact/mask sensitive fields in logs using consistent patterns (e.g., `***-***-1234` for passport numbers, `J*** D***` for names).

Applied to files:

  • app/tsconfig.json
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Verify extractMRZInfo() using published sample MRZ strings (e.g., ICAO examples)

Applied to files:

  • app/tsconfig.json
  • packages/mobile-sdk-alpha/src/validation/document.ts
  • app/tests/utils/proving/provingMachine.startFetchingData.test.ts
  • packages/mobile-sdk-alpha/src/index.ts
  • packages/mobile-sdk-alpha/src/components/screens/NFCScannerScreen.tsx
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Test isPassportDataValid() with realistic synthetic passport data (never real user data)

Applied to files:

  • app/tsconfig.json
  • packages/mobile-sdk-alpha/src/validation/document.ts
  • packages/mobile-sdk-demo/tests/crypto-polyfill.test.js
  • app/tests/utils/proving/provingMachine.startFetchingData.test.ts
  • common/src/utils/index.ts
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/**/package.json : Ensure package exports are properly configured

Applied to files:

  • app/tsconfig.json
  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-demo/package.json
  • packages/mobile-sdk-demo/.eslintrc.cjs
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/**/*.{ts,tsx} : Follow ESLint TypeScript-specific rules

Applied to files:

  • app/tsconfig.json
  • packages/mobile-sdk-demo/package.json
  • packages/mobile-sdk-demo/.eslintrc.cjs
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Update the app to consume the mobile-sdk-alpha package and replace local modules with SDK imports

Applied to files:

  • app/tsconfig.json
  • packages/mobile-sdk-alpha/src/stores/selfAppStore.tsx
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/src/validation/** : Place document validation logic in packages/mobile-sdk-alpha/src/validation/

Applied to files:

  • packages/mobile-sdk-alpha/src/validation/document.ts
📚 Learning: 2025-09-10T14:47:40.945Z
Learnt from: shazarre
PR: selfxyz/self#1041
File: app/src/providers/passportDataProvider.tsx:297-301
Timestamp: 2025-09-10T14:47:40.945Z
Learning: In app/src/providers/passportDataProvider.tsx: The deleteDocumentDirectlyFromKeychain function is a low-level utility used by the DocumentsAdapter and should not include error handling since callers like deleteDocument() already implement appropriate try/catch with logging for Keychain operations.

Applied to files:

  • packages/mobile-sdk-alpha/src/validation/document.ts
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Ensure parseNFCResponse() works with representative, synthetic NFC data

Applied to files:

  • packages/mobile-sdk-demo/tests/crypto-polyfill.test.js
  • app/tests/utils/proving/provingMachine.startFetchingData.test.ts
  • packages/mobile-sdk-alpha/src/index.ts
  • packages/mobile-sdk-alpha/src/components/screens/NFCScannerScreen.tsx
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Write integration tests that exercise the real validation logic (not mocks)

Applied to files:

  • packages/mobile-sdk-demo/tests/crypto-polyfill.test.js
  • app/tests/utils/proving/provingMachine.startFetchingData.test.ts
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to app/jest.setup.js : Provide comprehensive Jest setup in app/jest.setup.js with required mocks

Applied to files:

  • packages/mobile-sdk-demo/tests/crypto-polyfill.test.js
  • app/tests/utils/proving/provingMachine.startFetchingData.test.ts
📚 Learning: 2025-09-22T11:10:22.019Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-09-22T11:10:22.019Z
Learning: Applies to tests/**/*.test.{js,ts,tsx,jsx} : Test error boundaries and recovery mechanisms.

Applied to files:

  • packages/mobile-sdk-demo/tests/crypto-polyfill.test.js
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Never use real user PII in tests; use only synthetic, anonymized, or approved test vectors

Applied to files:

  • app/tests/utils/proving/provingMachine.startFetchingData.test.ts
📚 Learning: 2025-09-22T11:10:22.019Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-09-22T11:10:22.019Z
Learning: Applies to jest.setup.js : Comprehensive mocks for all native modules must be set up in `jest.setup.js`.

Applied to files:

  • app/tests/utils/proving/provingMachine.startFetchingData.test.ts
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/README.md : Document new/updated SDK modules and usage in packages/mobile-sdk-alpha/README.md

Applied to files:

  • packages/mobile-sdk-alpha/src/index.ts
  • packages/mobile-sdk-alpha/src/types/events.ts
  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-demo/package.json
📚 Learning: 2025-09-22T11:10:57.879Z
Learnt from: CR
PR: selfxyz/self#0
File: app/AGENTS.md:0-0
Timestamp: 2025-09-22T11:10:57.879Z
Learning: Applies to app/ios/**/*.{m,mm,swift} : Document complex native iOS module changes in the PR

Applied to files:

  • app/ios/Podfile
📚 Learning: 2025-08-02T23:53:45.928Z
Learnt from: transphorm
PR: selfxyz/self#823
File: app/ios/Self.xcodeproj/project.pbxproj:320-332
Timestamp: 2025-08-02T23:53:45.928Z
Learning: When reviewing autogenerated scripts in Xcode project files (like React Native Firebase's embedded shell scripts), avoid suggesting edits since these are regenerated during pod install and cannot be manually modified by users.

Applied to files:

  • app/ios/Podfile
📚 Learning: 2025-08-26T14:49:11.190Z
Learnt from: shazarre
PR: selfxyz/self#936
File: app/src/screens/passport/PassportNFCScanScreen.tsx:28-31
Timestamp: 2025-08-26T14:49:11.190Z
Learning: The main App.tsx file is located at app/App.tsx (not in app/src), and it properly wraps the entire app with SelfClientProvider at the top of the provider hierarchy, enabling useSelfClient() hook usage throughout all navigation screens.

Applied to files:

  • packages/mobile-sdk-alpha/src/stores/selfAppStore.tsx
📚 Learning: 2025-08-26T14:49:15.210Z
Learnt from: shazarre
PR: selfxyz/self#936
File: app/src/screens/passport/PassportNFCScanScreen.web.tsx:8-11
Timestamp: 2025-08-26T14:49:15.210Z
Learning: The main App.tsx file is located at app/App.tsx (at the app root), not at app/src/App.tsx, and contains the SelfClientProvider wrapping the entire application.

Applied to files:

  • packages/mobile-sdk-alpha/src/stores/selfAppStore.tsx
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/demo/** : Provide an in-SDK lightweight React Native demo under packages/mobile-sdk-alpha/demo/

Applied to files:

  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-demo/package.json
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/**/package.json : Verify package conditions are valid (e.g., exports conditions)

Applied to files:

  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-demo/package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/package.json : Expose a 'test:build' script in the SDK's package.json that runs build, test, types, and lint

Applied to files:

  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-demo/package.json
📚 Learning: 2025-09-22T11:10:22.019Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-09-22T11:10:22.019Z
Learning: Test, build, and deploy scripts (`yarn test`, `yarn ios`, `yarn test:e2e:ios`, Fastlane, etc.) must be used for automation.

Applied to files:

  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-demo/package.json
📚 Learning: 2025-08-29T15:29:47.727Z
Learnt from: CR
PR: selfxyz/self#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:29:47.727Z
Learning: Before PRs, ensure yarn build succeeds for all workspaces

Applied to files:

  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-demo/package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to app/package.json : Expose a 'test:build' script in the app's package.json that builds deps, types, performs bundle analysis, and runs tests

Applied to files:

  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-demo/package.json
📚 Learning: 2025-06-30T15:51:11.193Z
Learnt from: transphorm
PR: selfxyz/self#636
File: app/android/app/build.gradle:76-76
Timestamp: 2025-06-30T15:51:11.193Z
Learning: For React Native 0.80, the correct JSC version is `io.github.react-native-community:jsc-android:2026004.+`. This version was specifically built with Android NDK r23 to align with React Native 0.80's NDK requirements and prevent compatibility issues. The `2026004` version pattern is the official version for RN 0.80, not an outdated pin.

Applied to files:

  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/samples/** : Create sample applications under packages/mobile-sdk-alpha/samples/ (RN demo and web demo)

Applied to files:

  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-demo/package.json
📚 Learning: 2025-08-01T17:11:39.232Z
Learnt from: transphorm
PR: selfxyz/self#823
File: common/package.json:21-60
Timestamp: 2025-08-01T17:11:39.232Z
Learning: Explicit export mappings in package.json exports field provide better tree shaking than wildcard patterns because they enable easier static analysis by bundlers, allowing for more precise dependency graph understanding and better dead code elimination.

Applied to files:

  • packages/mobile-sdk-alpha/package.json
📚 Learning: 2025-09-22T11:10:57.879Z
Learnt from: CR
PR: selfxyz/self#0
File: app/AGENTS.md:0-0
Timestamp: 2025-09-22T11:10:57.879Z
Learning: Applies to app/**/*.{ios,android,web}.{ts,tsx,js,jsx} : Explain platform-specific code paths in the PR description (files with .ios, .android, or .web extensions)

Applied to files:

  • packages/mobile-sdk-demo/.eslintrc.cjs
📚 Learning: 2025-09-22T11:10:22.019Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-09-22T11:10:22.019Z
Learning: Applies to src/**/*.{js,ts,tsx,jsx} : Always handle platform differentiation with `Platform.OS` checks before platform-specific logic.

Applied to files:

  • packages/mobile-sdk-demo/.eslintrc.cjs
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Use the root Prettier and EditorConfig settings for formatting consistency

Applied to files:

  • packages/mobile-sdk-demo/.eslintrc.cjs
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/src/protocol/** : Place protocol synchronization (protocol tree handling) in packages/mobile-sdk-alpha/src/protocol/

Applied to files:

  • packages/mobile-sdk-alpha/src/stores/protocolStore.ts
📚 Learning: 2025-09-22T11:10:57.879Z
Learnt from: CR
PR: selfxyz/self#0
File: app/AGENTS.md:0-0
Timestamp: 2025-09-22T11:10:57.879Z
Learning: Keep bundle size within acceptable limits

Applied to files:

  • packages/mobile-sdk-alpha/src/stores/protocolStore.ts
📚 Learning: 2025-08-26T14:49:11.190Z
Learnt from: shazarre
PR: selfxyz/self#936
File: app/src/screens/passport/PassportNFCScanScreen.tsx:28-31
Timestamp: 2025-08-26T14:49:11.190Z
Learning: SelfClientProvider is wrapped in app/App.tsx, providing context for useSelfClient() hook usage throughout the React Native app navigation stacks.

Applied to files:

  • packages/mobile-sdk-alpha/src/components/screens/NFCScannerScreen.tsx
🔇 Additional comments (15)
packages/mobile-sdk-demo/package.json (1)

7-15: Prebuild must build all workspace deps, not just the SDK.

prebuild stops at @selfxyz/mobile-sdk-alpha, leaving other workspace deps (e.g., @selfxyz/common) potentially unbuilt. That risks stale/missing artifacts during Metro bundling. Please switch to a topological workspace build step (or call the repo-wide deps build script).

app/tsconfig.json (3)

6-6: LGTM: baseUrl set for local absolute imports

No concerns.


20-20: LGTM: include declarations file

Good to keep ambient types in scope.


13-16: Avoid mapping the same package to both src and dist (duplicate module risk)

Having both '../src' and '../dist' for the same package invites Metro/TS divergence, invalid hook call errors, and non-deterministic resolution. Prefer a single source of truth via the published package exports, or if consuming source, use only src and ensure Metro transpiles it.

Minimal safer change (prefer the published build):

-      "@selfxyz/mobile-sdk-alpha": [
-        "../packages/mobile-sdk-alpha/src",
-        "../packages/mobile-sdk-alpha/dist"
-      ],
+      "@selfxyz/mobile-sdk-alpha": ["../packages/mobile-sdk-alpha/dist"],

Recommended longer-term: remove this paths entry entirely and import from '@selfxyz/mobile-sdk-alpha' via the package’s exports.

Run to verify exports are properly configured for both packages and to locate any deep imports relying on old aliases:

Based on learnings

packages/mobile-sdk-demo/.eslintrc.cjs (1)

15-15: Good: no blanket ignore of .js/.cjs

Keeps lint coverage on critical config/runtime files.

app/src/screens/recovery/AccountRecoveryChoiceScreen.tsx (2)

69-76: Aadhaar CSCA mapping looks correct (string[] → Record<string,string>).

This aligns with the Aadhaar mapping used elsewhere in the PR. Ensure public_keys is always loaded before this call path.


9-9: Resolve lint error: cannot find module '@selfxyz/common/utils/passports/validate'.

Paths/alias likely drifted. Verify tsconfig “paths” and actual export location, or update the import to the current module path.

Run:

app/src/screens/recovery/RecoverWithPhraseScreen.tsx (2)

75-80: Aadhaar CSCA mapping LGTM.

Consistent with other call sites and expected AlternativeCSCA input.


12-12: Resolve import path for validate helpers (lint failure).

Same module resolution issue as other screen. Confirm alias and export source, then update import accordingly.

Run:

app/src/utils/proving/provingMachine.ts (3)

139-143: Good guard: block DSC for Aadhaar.

Prevents unsupported circuit path early with a clear error.


1122-1132: Aadhaar alt-CSCA mapping LGTM.

Transforming public_keys to a key→value map aligns with Aadhaar’s expected structure across the PR.


1022-1023: Verify Aadhaar fetch API signature.

Switching to protocolStore.aadhaar.fetch_all(env) (no AAKI) changes the contract. Ensure the store implements this signature and loads all required data before validation.

Run:

packages/mobile-sdk-demo/tests/crypto-polyfill.test.js (1)

99-106: Align randomBytes expectations with implementation (Buffer vs Uint8Array)

Tests assert Buffer, but polyfills commonly return Uint8Array in web/RN contexts. This creates brittle coupling and likely mismatches with common/src/polyfills/crypto.ts.

  • Option A (preferred): Generalize tests to accept Buffer or Uint8Array.
  • Option B: Standardize polyfill to return Buffer when available.

Apply this diff to make the assertions robust:

-        expect(result).toBeInstanceOf(Buffer);
+        expect(Buffer.isBuffer(result) || result instanceof Uint8Array).toBe(true);
@@
-      expect(result).toBeInstanceOf(Buffer);
+      expect(Buffer.isBuffer(result) || result instanceof Uint8Array).toBe(true);
@@
-      expect(randomResult).toBeInstanceOf(Buffer);
+      expect(Buffer.isBuffer(randomResult) || randomResult instanceof Uint8Array).toBe(true);

To confirm all randomBytes implementations and return types across the repo:

Also applies to: 124-129, 242-246

common/src/polyfills/crypto.ts (1)

11-11: Verify md5 import path; prefer '@noble/hashes/md5' over 'legacy'

Depending on @noble/hashes version, md5 is exposed at '@noble/hashes/md5' and supports .create(). The 'legacy' path may differ or be removed.

Run:

If available, switch to:

-import { md5 as nobleMd5 } from '@noble/hashes/legacy';
+import { md5 as nobleMd5 } from '@noble/hashes/md5';
common/src/utils/index.ts (1)

1-10: Fix unresolved import: re-export passports/validate from utils index

PR testing notes show lint failure: "Unable to resolve path to module '@selfxyz/common/utils/passports/validate'". This index doesn’t re-export it.

  • Add an explicit re-export from './passports/validate.js'.
  • Verify symbol names (e.g., isPassportDataValid) and adjust accordingly.

Example change:

+export { isPassportDataValid } from './passports/validate.js';

To locate the module/symbols precisely, run:

Also applies to: 21-21, 52-53, 66-69, 73-73

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
app/package.json (1)

137-140: react-native-reanimated must be a runtime dependency

Line 210 adds react-native-reanimated to devDependencies, but the app loads it at runtime. Any production install that prunes dev deps (e.g., yarn workspaces focus --production) will ship without Reanimated, leading to Metro build failures or runtime crashes. Please move it into dependencies.

   "react-native-gesture-handler": "2.19.0",
+  "react-native-reanimated": "3.16.4",
   "react-native-get-random-values": "^1.11.0",
-    "prop-types": "^15.8.1",
-    "react-native-reanimated": "3.16.4",
+    "prop-types": "^15.8.1",

Also applies to: 208-212

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 259b5ac and 3832304.

⛔ Files ignored due to path filters (2)
  • app/ios/Podfile.lock is excluded by !**/*.lock
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (3)
  • app/ios/Podfile (3 hunks)
  • app/package.json (7 hunks)
  • packages/mobile-sdk-alpha/tests/mock/generator.test.ts (3 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}}

📄 CodeRabbit inference engine (packages/mobile-sdk-alpha/AGENTS.md)

packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}}: Do NOT mock @selfxyz/mobile-sdk-alpha in tests (avoid jest.mock('@selfxyz/mobile-sdk-alpha') and replacing real functions with mocks)
Use actual imports from @selfxyz/mobile-sdk-alpha in tests
Write integration tests that exercise the real validation logic (not mocks)
Test isPassportDataValid() with realistic synthetic passport data (never real user data)
Verify extractMRZInfo() using published sample MRZ strings (e.g., ICAO examples)
Ensure parseNFCResponse() works with representative, synthetic NFC data
Never use real user PII in tests; use only synthetic, anonymized, or approved test vectors

Files:

  • packages/mobile-sdk-alpha/tests/mock/generator.test.ts
packages/mobile-sdk-alpha/**/*.{ts,tsx}

📄 CodeRabbit inference engine (packages/mobile-sdk-alpha/AGENTS.md)

packages/mobile-sdk-alpha/**/*.{ts,tsx}: Use strict TypeScript type checking across the codebase
Follow ESLint TypeScript-specific rules
Avoid introducing circular dependencies

Files:

  • packages/mobile-sdk-alpha/tests/mock/generator.test.ts
**/*.{js,ts,tsx,jsx,sol,nr}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{js,ts,tsx,jsx,sol,nr}: NEVER log sensitive data including PII (names, DOB, passport numbers, addresses), credentials, tokens, API keys, private keys, or session identifiers.
ALWAYS redact/mask sensitive fields in logs using consistent patterns (e.g., ***-***-1234 for passport numbers, J*** D*** for names).

Files:

  • packages/mobile-sdk-alpha/tests/mock/generator.test.ts
**/*.{test,spec}.{ts,js,tsx,jsx}

⚙️ CodeRabbit configuration file

**/*.{test,spec}.{ts,js,tsx,jsx}: Review test files for:

  • Test coverage completeness
  • Test case quality and edge cases
  • Mock usage appropriateness
  • Test readability and maintainability

Files:

  • packages/mobile-sdk-alpha/tests/mock/generator.test.ts
packages/mobile-sdk-alpha/**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

packages/mobile-sdk-alpha/**/*.{ts,tsx,js,jsx}: Review alpha mobile SDK code for:

  • API consistency with core SDK
  • Platform-neutral abstractions
  • Performance considerations
  • Clear experimental notes or TODOs

Files:

  • packages/mobile-sdk-alpha/tests/mock/generator.test.ts
app/package.json

📄 CodeRabbit inference engine (.cursor/rules/mobile-sdk-migration.mdc)

Expose a 'test:build' script in the app's package.json that builds deps, types, performs bundle analysis, and runs tests

Files:

  • app/package.json
app/ios/**/*

⚙️ CodeRabbit configuration file

app/ios/**/*: Review iOS-specific code for:

  • Platform-specific implementations
  • Performance considerations
  • Security best practices for mobile

Files:

  • app/ios/Podfile
🧠 Learnings (20)
📓 Common learnings
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/demo/** : Provide an in-SDK lightweight React Native demo under packages/mobile-sdk-alpha/demo/
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/samples/** : Create sample applications under packages/mobile-sdk-alpha/samples/ (RN demo and web demo)
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Use actual imports from selfxyz/mobile-sdk-alpha in tests
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Update the app to consume the mobile-sdk-alpha package and replace local modules with SDK imports
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/src/index.ts : Re-export new SDK modules via packages/mobile-sdk-alpha/src/index.ts
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/README.md : Document new/updated SDK modules and usage in packages/mobile-sdk-alpha/README.md
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/package.json : Enable tree shaking for the SDK (e.g., ensure 'sideEffects' is correctly set in package.json and exports are ESM-friendly)
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/**/*.{ts,tsx} : Avoid introducing circular dependencies
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/**/package.json : Ensure package exports are properly configured
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Do NOT mock selfxyz/mobile-sdk-alpha in tests (avoid jest.mock('selfxyz/mobile-sdk-alpha') and replacing real functions with mocks)
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Do NOT mock selfxyz/mobile-sdk-alpha in tests (avoid jest.mock('selfxyz/mobile-sdk-alpha') and replacing real functions with mocks)

Applied to files:

  • packages/mobile-sdk-alpha/tests/mock/generator.test.ts
  • app/package.json
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Use actual imports from selfxyz/mobile-sdk-alpha in tests

Applied to files:

  • packages/mobile-sdk-alpha/tests/mock/generator.test.ts
  • app/package.json
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Write integration tests that exercise the real validation logic (not mocks)

Applied to files:

  • packages/mobile-sdk-alpha/tests/mock/generator.test.ts
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Test isPassportDataValid() with realistic synthetic passport data (never real user data)

Applied to files:

  • packages/mobile-sdk-alpha/tests/mock/generator.test.ts
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/src/index.ts : Re-export new SDK modules via packages/mobile-sdk-alpha/src/index.ts

Applied to files:

  • packages/mobile-sdk-alpha/tests/mock/generator.test.ts
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Verify extractMRZInfo() using published sample MRZ strings (e.g., ICAO examples)

Applied to files:

  • packages/mobile-sdk-alpha/tests/mock/generator.test.ts
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Never use real user PII in tests; use only synthetic, anonymized, or approved test vectors

Applied to files:

  • packages/mobile-sdk-alpha/tests/mock/generator.test.ts
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Ensure parseNFCResponse() works with representative, synthetic NFC data

Applied to files:

  • packages/mobile-sdk-alpha/tests/mock/generator.test.ts
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/**/*.{ts,tsx} : Avoid introducing circular dependencies

Applied to files:

  • packages/mobile-sdk-alpha/tests/mock/generator.test.ts
  • app/package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to app/jest.setup.js : Provide comprehensive Jest setup in app/jest.setup.js with required mocks

Applied to files:

  • packages/mobile-sdk-alpha/tests/mock/generator.test.ts
📚 Learning: 2025-09-22T11:10:22.019Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-09-22T11:10:22.019Z
Learning: Applies to jest.setup.js : Comprehensive mocks for all native modules must be set up in `jest.setup.js`.

Applied to files:

  • packages/mobile-sdk-alpha/tests/mock/generator.test.ts
📚 Learning: 2025-09-22T11:10:22.019Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-09-22T11:10:22.019Z
Learning: Test, build, and deploy scripts (`yarn test`, `yarn ios`, `yarn test:e2e:ios`, Fastlane, etc.) must be used for automation.

Applied to files:

  • app/package.json
📚 Learning: 2025-09-22T11:10:57.879Z
Learnt from: CR
PR: selfxyz/self#0
File: app/AGENTS.md:0-0
Timestamp: 2025-09-22T11:10:57.879Z
Learning: Optionally use Watchman and run yarn install at repo root

Applied to files:

  • app/package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/package.json : Enable tree shaking for the SDK (e.g., ensure 'sideEffects' is correctly set in package.json and exports are ESM-friendly)

Applied to files:

  • app/package.json
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/**/package.json : Ensure package exports are properly configured

Applied to files:

  • app/package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/demo/** : Provide an in-SDK lightweight React Native demo under packages/mobile-sdk-alpha/demo/

Applied to files:

  • app/package.json
📚 Learning: 2025-08-23T02:02:02.556Z
Learnt from: transphorm
PR: selfxyz/self#942
File: app/vite.config.ts:170-0
Timestamp: 2025-08-23T02:02:02.556Z
Learning: In the selfxyz/self React Native app, devTools from '@/navigation/devTools' are intentionally shipped to production builds for testing purposes, not excluded as is typical in most applications.

Applied to files:

  • app/package.json
📚 Learning: 2025-08-02T23:53:45.928Z
Learnt from: transphorm
PR: selfxyz/self#823
File: app/ios/Self.xcodeproj/project.pbxproj:320-332
Timestamp: 2025-08-02T23:53:45.928Z
Learning: When reviewing autogenerated scripts in Xcode project files (like React Native Firebase's embedded shell scripts), avoid suggesting edits since these are regenerated during pod install and cannot be manually modified by users.

Applied to files:

  • app/ios/Podfile
📚 Learning: 2025-09-22T11:10:57.879Z
Learnt from: CR
PR: selfxyz/self#0
File: app/AGENTS.md:0-0
Timestamp: 2025-09-22T11:10:57.879Z
Learning: Applies to app/ios/**/*.{m,mm,swift} : Document complex native iOS module changes in the PR

Applied to files:

  • app/ios/Podfile
🪛 RuboCop (1.80.2)
app/ios/Podfile

[warning] 35-35: Useless assignment to variable - e.

(Lint/UselessAssignment)

⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: android-build-test
  • GitHub Check: build-deps
  • GitHub Check: e2e-ios
  • GitHub Check: analyze-android
  • GitHub Check: analyze-ios
🔇 Additional comments (2)
app/ios/Podfile (2)

75-75: Confirm autolinking picks up RNReactNativeHapticFeedback under hoisting

After removing the explicit pod, ensure RN autolinking still adds the RNReactNativeHapticFeedback target when Yarn hoists modules to the repo root, and that the post_install override (Lines 144-150) still applies. Run pod install and verify the target exists in Pods and links AudioToolbox.

Based on learnings


167-167: No-op change

Whitespace only; no action needed.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3832304 and 506fc03.

⛔ Files ignored due to path filters (3)
  • app/Gemfile.lock is excluded by !**/*.lock
  • app/ios/Podfile.lock is excluded by !**/*.lock
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (14)
  • app/metro.config.cjs (2 hunks)
  • app/package.json (5 hunks)
  • app/src/types/elliptic.d.ts (1 hunks)
  • app/src/types/globals.d.ts (1 hunks)
  • app/src/types/png.d.ts (1 hunks)
  • app/src/types/svg.d.ts (1 hunks)
  • app/tsconfig.json (1 hunks)
  • common/src/polyfills/crypto.ts (1 hunks)
  • common/tests/cryptoHash.test.ts (1 hunks)
  • common/tests/cryptoHmac.test.ts (1 hunks)
  • package.json (3 hunks)
  • packages/mobile-sdk-demo/package.json (1 hunks)
  • packages/mobile-sdk-demo/tests/cryptoPolyfill.test.js (1 hunks)
  • sdk/qrcode-angular/package.json (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • app/tsconfig.json
  • app/package.json
  • packages/mobile-sdk-demo/package.json
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{js,ts,tsx,jsx,sol,nr}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{js,ts,tsx,jsx,sol,nr}: NEVER log sensitive data including PII (names, DOB, passport numbers, addresses), credentials, tokens, API keys, private keys, or session identifiers.
ALWAYS redact/mask sensitive fields in logs using consistent patterns (e.g., ***-***-1234 for passport numbers, J*** D*** for names).

Files:

  • app/src/types/png.d.ts
  • app/src/types/svg.d.ts
  • common/tests/cryptoHmac.test.ts
  • common/tests/cryptoHash.test.ts
  • app/src/types/elliptic.d.ts
  • app/src/types/globals.d.ts
  • packages/mobile-sdk-demo/tests/cryptoPolyfill.test.js
  • common/src/polyfills/crypto.ts
app/**/*.{ts,tsx}

📄 CodeRabbit inference engine (app/AGENTS.md)

Type checking must pass before PRs (yarn types)

Files:

  • app/src/types/png.d.ts
  • app/src/types/svg.d.ts
  • app/src/types/elliptic.d.ts
  • app/src/types/globals.d.ts
app/src/**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

app/src/**/*.{ts,tsx,js,jsx}: Review React Native TypeScript code for:

  • Component architecture and reusability
  • State management patterns
  • Performance optimizations
  • TypeScript type safety
  • React hooks usage and dependencies
  • Navigation patterns

Files:

  • app/src/types/png.d.ts
  • app/src/types/svg.d.ts
  • app/src/types/elliptic.d.ts
  • app/src/types/globals.d.ts
**/*.{test,spec}.{ts,js,tsx,jsx}

⚙️ CodeRabbit configuration file

**/*.{test,spec}.{ts,js,tsx,jsx}: Review test files for:

  • Test coverage completeness
  • Test case quality and edge cases
  • Mock usage appropriateness
  • Test readability and maintainability

Files:

  • common/tests/cryptoHmac.test.ts
  • common/tests/cryptoHash.test.ts
  • packages/mobile-sdk-demo/tests/cryptoPolyfill.test.js
common/src/**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

common/src/**/*.{ts,tsx,js,jsx}: Review shared utilities for:

  • Reusability and modular design
  • Type safety and error handling
  • Side-effect management
  • Documentation and naming clarity

Files:

  • common/src/polyfills/crypto.ts
🧠 Learnings (26)
📓 Common learnings
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/demo/** : Provide an in-SDK lightweight React Native demo under packages/mobile-sdk-alpha/demo/
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/samples/** : Create sample applications under packages/mobile-sdk-alpha/samples/ (RN demo and web demo)
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Use actual imports from selfxyz/mobile-sdk-alpha in tests
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/src/crypto/** : Place crypto adapters and utilities in packages/mobile-sdk-alpha/src/crypto/
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/package.json : Enable tree shaking for the SDK (e.g., ensure 'sideEffects' is correctly set in package.json and exports are ESM-friendly)

Applied to files:

  • sdk/qrcode-angular/package.json
  • package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to app/package.json : Expose a 'test:build' script in the app's package.json that builds deps, types, performs bundle analysis, and runs tests

Applied to files:

  • sdk/qrcode-angular/package.json
  • package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/package.json : Expose a 'test:build' script in the SDK's package.json that runs build, test, types, and lint

Applied to files:

  • sdk/qrcode-angular/package.json
  • package.json
📚 Learning: 2025-09-22T11:10:22.019Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-09-22T11:10:22.019Z
Learning: Test, build, and deploy scripts (`yarn test`, `yarn ios`, `yarn test:e2e:ios`, Fastlane, etc.) must be used for automation.

Applied to files:

  • sdk/qrcode-angular/package.json
  • package.json
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Run yarn nice, yarn types, and yarn test before commits and PRs

Applied to files:

  • sdk/qrcode-angular/package.json
📚 Learning: 2025-08-25T14:25:57.586Z
Learnt from: aaronmgdr
PR: selfxyz/self#951
File: app/src/providers/authProvider.web.tsx:17-18
Timestamp: 2025-08-25T14:25:57.586Z
Learning: The selfxyz/mobile-sdk-alpha/constants/analytics import path is properly configured with SDK exports, Metro aliases, and TypeScript resolution. Import changes from @/consts/analytics to this path are part of valid analytics migration, not TypeScript resolution issues.

Applied to files:

  • app/metro.config.cjs
📚 Learning: 2025-09-22T11:10:57.879Z
Learnt from: CR
PR: selfxyz/self#0
File: app/AGENTS.md:0-0
Timestamp: 2025-09-22T11:10:57.879Z
Learning: Optionally use Watchman and run yarn install at repo root

Applied to files:

  • app/metro.config.cjs
📚 Learning: 2025-09-22T11:10:22.019Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-09-22T11:10:22.019Z
Learning: Applies to src/**/*.{js,ts,tsx,jsx} : Always handle platform differentiation with `Platform.OS` checks before platform-specific logic.

Applied to files:

  • app/metro.config.cjs
📚 Learning: 2025-09-22T11:10:57.879Z
Learnt from: CR
PR: selfxyz/self#0
File: app/AGENTS.md:0-0
Timestamp: 2025-09-22T11:10:57.879Z
Learning: Applies to app/**/*.{ios,android,web}.{ts,tsx,js,jsx} : Explain platform-specific code paths in the PR description (files with .ios, .android, or .web extensions)

Applied to files:

  • app/metro.config.cjs
📚 Learning: 2025-09-22T11:10:22.019Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-09-22T11:10:22.019Z
Learning: Always use `@/` for src imports and `tests/` for test imports; prefer platform-specific imports with conditional rendering.

Applied to files:

  • app/metro.config.cjs
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to app/jest.config.cjs : Configure moduleNameMapper in app/jest.config.cjs to map '@/'' to 'src/' and 'tests/' to 'tests/src/'

Applied to files:

  • app/metro.config.cjs
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Ensure parseNFCResponse() works with representative, synthetic NFC data

Applied to files:

  • packages/mobile-sdk-demo/tests/cryptoPolyfill.test.js
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Test isPassportDataValid() with realistic synthetic passport data (never real user data)

Applied to files:

  • packages/mobile-sdk-demo/tests/cryptoPolyfill.test.js
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Write integration tests that exercise the real validation logic (not mocks)

Applied to files:

  • packages/mobile-sdk-demo/tests/cryptoPolyfill.test.js
📚 Learning: 2025-09-22T11:10:22.019Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-09-22T11:10:22.019Z
Learning: Applies to tests/**/*.test.{js,ts,tsx,jsx} : Test error boundaries and recovery mechanisms.

Applied to files:

  • packages/mobile-sdk-demo/tests/cryptoPolyfill.test.js
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/**/package.json : Ensure package exports are properly configured

Applied to files:

  • package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/demo/** : Provide an in-SDK lightweight React Native demo under packages/mobile-sdk-alpha/demo/

Applied to files:

  • package.json
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/**/*.{ts,tsx} : Avoid introducing circular dependencies

Applied to files:

  • package.json
📚 Learning: 2025-08-23T02:02:02.556Z
Learnt from: transphorm
PR: selfxyz/self#942
File: app/vite.config.ts:170-0
Timestamp: 2025-08-23T02:02:02.556Z
Learning: In the selfxyz/self React Native app, devTools from '@/navigation/devTools' are intentionally shipped to production builds for testing purposes, not excluded as is typical in most applications.

Applied to files:

  • package.json
📚 Learning: 2025-06-30T15:51:11.193Z
Learnt from: transphorm
PR: selfxyz/self#636
File: app/android/app/build.gradle:76-76
Timestamp: 2025-06-30T15:51:11.193Z
Learning: For React Native 0.80, the correct JSC version is `io.github.react-native-community:jsc-android:2026004.+`. This version was specifically built with Android NDK r23 to align with React Native 0.80's NDK requirements and prevent compatibility issues. The `2026004` version pattern is the official version for RN 0.80, not an outdated pin.

Applied to files:

  • package.json
📚 Learning: 2025-09-22T11:10:22.019Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-09-22T11:10:22.019Z
Learning: Use Yarn workspaces for monorepo management.

Applied to files:

  • package.json
📚 Learning: 2025-08-29T15:29:47.727Z
Learnt from: CR
PR: selfxyz/self#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:29:47.727Z
Learning: Before PRs, ensure yarn build succeeds for all workspaces

Applied to files:

  • package.json
📚 Learning: 2025-08-29T15:29:47.727Z
Learnt from: CR
PR: selfxyz/self#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:29:47.727Z
Learning: Before committing, run repository checks (yarn nice, yarn lint, yarn build, contracts build, yarn types)

Applied to files:

  • package.json
📚 Learning: 2025-08-29T15:29:47.727Z
Learnt from: CR
PR: selfxyz/self#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:29:47.727Z
Learning: Use nvm and Corepack to set up the Yarn v4 monorepo before any other commands (nvm use; corepack enable; corepack prepare yarnstable --activate; yarn install)

Applied to files:

  • package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to app/jest.config.cjs : Use Jest in the app with a React Native preset configured in app/jest.config.cjs

Applied to files:

  • package.json
🧬 Code graph analysis (5)
common/tests/cryptoHmac.test.ts (1)
common/src/polyfills/crypto.ts (1)
  • createHmac (176-176)
common/tests/cryptoHash.test.ts (1)
common/src/polyfills/crypto.ts (1)
  • createHash (176-176)
app/metro.config.cjs (1)
packages/mobile-sdk-demo/metro.config.cjs (8)
  • findYarnWorkspaceRoot (7-7)
  • require (5-5)
  • defaultConfig (9-9)
  • projectRoot (11-11)
  • workspaceRoot (12-12)
  • path (6-6)
  • config (18-92)
  • nodeModuleRedirects (67-73)
packages/mobile-sdk-demo/tests/cryptoPolyfill.test.js (1)
packages/mobile-sdk-demo/crypto-polyfill.js (1)
  • array (47-47)
common/src/polyfills/crypto.ts (1)
common/index.ts (4)
  • createHash (99-99)
  • createHmac (100-100)
  • randomBytes (103-103)
  • pbkdf2Sync (102-102)
🪛 GitHub Check: workspace-lint
app/src/types/png.d.ts

[warning] 6-6:
Unexpected any. Specify a different type

app/src/types/elliptic.d.ts

[warning] 6-6:
Unexpected any. Specify a different type

⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: build-deps
  • GitHub Check: analyze-ios
  • GitHub Check: e2e-ios
  • GitHub Check: analyze-android
🔇 Additional comments (3)
app/metro.config.cjs (2)

45-73: Fix Metro blockList: pass a single exclusion RegExp

Metro expects resolver.blockList to be a RegExp (typically produced by exclusionList). Supplying an array of patterns causes Metro to treat the value as invalid (blockList.test is not a function), breaking the bundler start-up. Please wrap these patterns with exclusionList and import it explicitly.

-const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
+const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
+const exclusionList = require('metro-config/src/defaults/exclusionList');
...
-    blockList: [
+    blockList: exclusionList([
       // Ignore built package.json files to prevent Haste collisions
       /.*\/dist\/package\.json$/,
       /.*\/dist\/esm\/package\.json$/,
       /.*\/dist\/cjs\/package\.json$/,
       /.*\/build\/package\.json$/,
       // Prevent duplicate React/React Native - block workspace root versions and use app's versions
       // Use precise regex patterns to avoid blocking packages like react-native-get-random-values
       new RegExp(
         `^${workspaceRoot.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}/node_modules/react(/|$)`,
       ),
       new RegExp(
         `^${workspaceRoot.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}/node_modules/react-dom(/|$)`,
       ),
       new RegExp(
         `^${workspaceRoot.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}/node_modules/react-native(/|$)`,
       ),
       new RegExp(
         `^${workspaceRoot.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}/node_modules/scheduler(/|$)`,
       ),
       new RegExp('packages/mobile-sdk-alpha/node_modules/react(/|$)'),
       new RegExp('packages/mobile-sdk-alpha/node_modules/react-dom(/|$)'),
       new RegExp('packages/mobile-sdk-alpha/node_modules/react-native(/|$)'),
       new RegExp('packages/mobile-sdk-alpha/node_modules/scheduler(/|$)'),
       new RegExp('packages/mobile-sdk-demo/node_modules/react(/|$)'),
       new RegExp('packages/mobile-sdk-demo/node_modules/react-dom(/|$)'),
       new RegExp('packages/mobile-sdk-demo/node_modules/react-native(/|$)'),
       new RegExp('packages/mobile-sdk-demo/node_modules/scheduler(/|$)'),
-    ],
+    ]),

143-149: Make the .js→.ts resolver cross-platform and resilient

The current includes('/common/src/') check misses Windows paths (\ separators), so Metro never rewrites .js imports coming from common/src, breaking the bundle on Windows dev machines. It also unconditionally rewrites to .ts, which throws if the .ts file does not exist. Normalize the path and fall back to the original module when the TypeScript variant can’t be resolved.

-      if (
-        context.originModulePath?.includes('/common/src/') &&
-        moduleName.endsWith('.js')
-      ) {
-        const tsModuleName = moduleName.replace(/\.js$/, '.ts');
-        return context.resolveRequest(context, tsModuleName, platform);
-      }
+      const originPath = context.originModulePath || '';
+      const inCommonSrc = /(?:^|[\\/])common[\\/]src[\\/]/.test(originPath);
+      if (inCommonSrc && moduleName.endsWith('.js')) {
+        const tsModuleName = moduleName.replace(/\.js$/, '.ts');
+        try {
+          return context.resolveRequest(context, tsModuleName, platform);
+        } catch {
+          // Fall back when the TS variant is absent
+        }
+      }
package.json (1)

48-53: Remove hoisted React/React Native dependencies to avoid runtime conflicts.

Hoisting react and react-native at the root pulls extra copies into every workspace. That routinely explodes with “Invalid hook call” errors and ABI mismatches once Metro/native modules load. Keep these versions under resolutions and make each consumer workspace depend on them instead.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 506fc03 and 9662f35.

📒 Files selected for processing (4)
  • app/src/screens/document/DocumentNFCScanScreen.tsx (1 hunks)
  • app/src/screens/document/DocumentNFCScanScreen.web.tsx (1 hunks)
  • app/src/types/png.d.ts (1 hunks)
  • common/src/polyfills/crypto.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{js,ts,tsx,jsx,sol,nr}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{js,ts,tsx,jsx,sol,nr}: NEVER log sensitive data including PII (names, DOB, passport numbers, addresses), credentials, tokens, API keys, private keys, or session identifiers.
ALWAYS redact/mask sensitive fields in logs using consistent patterns (e.g., ***-***-1234 for passport numbers, J*** D*** for names).

Files:

  • app/src/screens/document/DocumentNFCScanScreen.tsx
  • app/src/types/png.d.ts
  • common/src/polyfills/crypto.ts
  • app/src/screens/document/DocumentNFCScanScreen.web.tsx
app/**/*.{ts,tsx}

📄 CodeRabbit inference engine (app/AGENTS.md)

Type checking must pass before PRs (yarn types)

Files:

  • app/src/screens/document/DocumentNFCScanScreen.tsx
  • app/src/types/png.d.ts
  • app/src/screens/document/DocumentNFCScanScreen.web.tsx
app/src/**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

app/src/**/*.{ts,tsx,js,jsx}: Review React Native TypeScript code for:

  • Component architecture and reusability
  • State management patterns
  • Performance optimizations
  • TypeScript type safety
  • React hooks usage and dependencies
  • Navigation patterns

Files:

  • app/src/screens/document/DocumentNFCScanScreen.tsx
  • app/src/types/png.d.ts
  • app/src/screens/document/DocumentNFCScanScreen.web.tsx
common/src/**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

common/src/**/*.{ts,tsx,js,jsx}: Review shared utilities for:

  • Reusability and modular design
  • Type safety and error handling
  • Side-effect management
  • Documentation and naming clarity

Files:

  • common/src/polyfills/crypto.ts
app/**/*.{ios,android,web}.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (app/AGENTS.md)

Explain platform-specific code paths in the PR description (files with .ios, .android, or .web extensions)

Files:

  • app/src/screens/document/DocumentNFCScanScreen.web.tsx
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/demo/** : Provide an in-SDK lightweight React Native demo under packages/mobile-sdk-alpha/demo/
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/samples/** : Create sample applications under packages/mobile-sdk-alpha/samples/ (RN demo and web demo)
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Use actual imports from selfxyz/mobile-sdk-alpha in tests
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Ensure parseNFCResponse() works with representative, synthetic NFC data

Applied to files:

  • app/src/screens/document/DocumentNFCScanScreen.tsx
🧬 Code graph analysis (1)
common/src/polyfills/crypto.ts (1)
common/index.ts (4)
  • createHash (99-99)
  • createHmac (100-100)
  • randomBytes (103-103)
  • pbkdf2Sync (102-102)
🪛 GitHub Check: workspace-lint
app/src/types/png.d.ts

[failure] 6-6:
Expected 1 empty line after import statement not followed by another import

🪛 GitHub Actions: Workspace CI
app/src/types/png.d.ts

[error] 6-6: import/no-newline-after-import: Expected 1 empty line after import statement not followed by another import

⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: build-deps
  • GitHub Check: e2e-ios
  • GitHub Check: analyze-ios
  • GitHub Check: analyze-android

Comment on lines +54 to +67
digest(encoding?: BufferEncoding) {
if (finalized) {
throw new Error('Digest already called. Hash instance has been finalized.');
}
finalized = true;
const result = hasher.digest();

if (encoding === 'hex') {
return Array.from(result)
.map((b: number) => b.toString(16).padStart(2, '0'))
.join('');
}
return typeof Buffer !== 'undefined' ? Buffer.from(result) : result;
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Ensure digest() respects all Node encodings

With encoding set to anything other than 'hex', this currently falls through and returns a Buffer/Uint8Array instead of the expected encoded string (Node returns strings for 'base64', 'latin1', etc.). That’s a behavioral break for any caller relying on standard crypto semantics. Please branch on encoding: keep the fast path for 'hex', but for any other encoding return Buffer.from(result).toString(encoding) (and surface a clear error if Buffer isn’t available in the environment).

Apply this diff to resolve the issue:

@@
-    digest(encoding?: BufferEncoding) {
+    digest(encoding?: BufferEncoding) {
@@
-      if (encoding === 'hex') {
-        return Array.from(result)
-          .map((b: number) => b.toString(16).padStart(2, '0'))
-          .join('');
-      }
-      return typeof Buffer !== 'undefined' ? Buffer.from(result) : result;
+      if (encoding === 'hex') {
+        return Array.from(result)
+          .map((b: number) => b.toString(16).padStart(2, '0'))
+          .join('');
+      }
+      if (encoding) {
+        if (typeof Buffer === 'undefined') {
+          throw new Error(`Digest encoding "${encoding}" requires Buffer support`);
+        }
+        return Buffer.from(result).toString(encoding);
+      }
+      return typeof Buffer !== 'undefined' ? Buffer.from(result) : result;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
digest(encoding?: BufferEncoding) {
if (finalized) {
throw new Error('Digest already called. Hash instance has been finalized.');
}
finalized = true;
const result = hasher.digest();
if (encoding === 'hex') {
return Array.from(result)
.map((b: number) => b.toString(16).padStart(2, '0'))
.join('');
}
return typeof Buffer !== 'undefined' ? Buffer.from(result) : result;
},
digest(encoding?: BufferEncoding) {
if (finalized) {
throw new Error('Digest already called. Hash instance has been finalized.');
}
finalized = true;
const result = hasher.digest();
if (encoding === 'hex') {
return Array.from(result)
.map((b: number) => b.toString(16).padStart(2, '0'))
.join('');
}
if (encoding) {
if (typeof Buffer === 'undefined') {
throw new Error(`Digest encoding "${encoding}" requires Buffer support`);
}
return Buffer.from(result).toString(encoding);
}
return typeof Buffer !== 'undefined' ? Buffer.from(result) : result;
},
🤖 Prompt for AI Agents
In common/src/polyfills/crypto.ts around lines 54 to 67, digest(encoding?)
currently only special-cases 'hex' and otherwise returns a Buffer/Uint8Array;
change it to respect Node semantics by: keep the fast path for encoding ===
'hex'; if encoding is provided and not 'hex', ensure Buffer exists (throw a
clear error if it doesn't) and return Buffer.from(result).toString(encoding); if
no encoding is provided keep returning Buffer.from(result) (or the Uint8Array
fallback as currently implemented).

Comment on lines +103 to +115
digest(encoding?: BufferEncoding) {
if (finalized) {
throw new Error('Digest already called. Hash instance has been finalized.');
}
finalized = true;
const result = hmacState.digest();

if (encoding === 'hex') {
return Array.from(result)
.map((b: number) => b.toString(16).padStart(2, '0'))
.join('');
}
return typeof Buffer !== 'undefined' ? Buffer.from(result) : result;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Fix HMAC digest encoding parity

Same issue as createHash: passing 'base64' (or any non-hex encoding) returns a Buffer/Uint8Array instead of the encoded string Node callers expect. Align the behavior by mapping non-hex encodings through Buffer.from(result).toString(encoding) and fail fast when Buffer is unavailable.

Apply the same encoding-handling adjustment here.

🤖 Prompt for AI Agents
In common/src/polyfills/crypto.ts around lines 103 to 115, the HMAC digest
currently only returns a hex string when encoding === 'hex' and otherwise
returns a Buffer/Uint8Array; update it to mirror createHash behavior by: keep
the existing hex branch, for any other non-undefined encoding ensure Buffer
exists (throw a clear error if not) and return
Buffer.from(result).toString(encoding), and if encoding is undefined return
Buffer.from(result) when Buffer is available or the raw result otherwise.

Comment on lines +149 to +166
case 'sha1':
hashFn = nobleSha1;
break;
case 'sha256':
hashFn = nobleSha256;
break;
case 'sha512':
hashFn = nobleSha512;
break;
default:
throw new Error(`Unsupported PBKDF2 digest: ${digest}`);
}

const derivedKey = noblePbkdf2(hashFn, passwordBytes, saltBytes, {
c: iterations,
dkLen: keylen,
});
return typeof Buffer !== 'undefined' ? Buffer.from(derivedKey) : derivedKey;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Restore Node-compatible pbkdf2Sync default digest

Node’s pbkdf2Sync defaults digest to 'sha1' when the argument is omitted. Here, calling with 4 parameters crashes (digest.toLowerCase() on undefined). That’s a breaking change for any existing usage. Please make the digest parameter optional with a default of 'sha1' before normalizing it.

Apply this diff to fix the regression:

-function pbkdf2Sync(
+function pbkdf2Sync(
   password: string | Uint8Array,
   salt: string | Uint8Array,
   iterations: number,
   keylen: number,
-  digest: string
+  digest: string = 'sha1'
 ): Uint8Array | Buffer {
@@
-  switch (digest.toLowerCase()) {
+  switch (digest.toLowerCase()) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
case 'sha1':
hashFn = nobleSha1;
break;
case 'sha256':
hashFn = nobleSha256;
break;
case 'sha512':
hashFn = nobleSha512;
break;
default:
throw new Error(`Unsupported PBKDF2 digest: ${digest}`);
}
const derivedKey = noblePbkdf2(hashFn, passwordBytes, saltBytes, {
c: iterations,
dkLen: keylen,
});
return typeof Buffer !== 'undefined' ? Buffer.from(derivedKey) : derivedKey;
function pbkdf2Sync(
password: string | Uint8Array,
salt: string | Uint8Array,
iterations: number,
keylen: number,
digest: string = 'sha1'
): Uint8Array | Buffer {
// normalize and pick the hash function
switch (digest.toLowerCase()) {
case 'sha1':
hashFn = nobleSha1;
break;
case 'sha256':
hashFn = nobleSha256;
break;
case 'sha512':
hashFn = nobleSha512;
break;
default:
throw new Error(`Unsupported PBKDF2 digest: ${digest}`);
}
const derivedKey = noblePbkdf2(hashFn, passwordBytes, saltBytes, {
c: iterations,
dkLen: keylen,
});
return typeof Buffer !== 'undefined'
? Buffer.from(derivedKey)
: derivedKey;
}
🤖 Prompt for AI Agents
In common/src/polyfills/crypto.ts around lines 149 to 166, the pbkdf2Sync
implementation crashes when called without a digest because digest is used
before being defaulted; make the digest parameter optional and default it to
'sha1' (or explicitly set digest = digest ?? 'sha1') before calling
digest.toLowerCase(), then proceed with the existing switch/selection of
nobleShaX and the rest of the function so calls with 4 args behave like Node's
pbkdf2Sync.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
app/vite.config.ts (1)

62-76: Harden Buffer import transform to also handle 'buffer/' form

Some packages import from 'buffer/' (trailing slash). Extend the regex so the global assignment is injected in both cases. This avoids sporadic “Buffer is not defined” at runtime. Based on learnings.

-        if (id.includes('mobile-sdk-alpha') && code.includes('from "buffer"')) {
-          // Keep the import so the polyfill is bundled, and set global assignment
-          const fixedCode = code.replace(
-            /import\s+\{\s*Buffer\s*\}\s+from\s+['"]buffer['"]/g,
-            "import { Buffer } from 'buffer';\nif (typeof globalThis.Buffer === 'undefined') { globalThis.Buffer = Buffer; }",
-          );
+        if (id.includes('mobile-sdk-alpha')) {
+          const bufferImportRe = /import\s+\{\s*Buffer\s*\}\s+from\s+['"]buffer\/?['"]/g;
+          if (bufferImportRe.test(code)) {
+            const fixedCode = code.replace(
+              bufferImportRe,
+              "import { Buffer } from 'buffer';\nif (typeof globalThis.Buffer === 'undefined') { globalThis.Buffer = Buffer; }",
+            );
+            return { code: fixedCode, map: null };
+          }
-          return { code: fixedCode, map: null };
         }
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ee0e0f9 and 1a90a75.

📒 Files selected for processing (3)
  • app/metro.config.cjs (2 hunks)
  • app/src/hooks/useMockDataForm.ts (1 hunks)
  • app/vite.config.ts (3 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{js,ts,tsx,jsx,sol,nr}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{js,ts,tsx,jsx,sol,nr}: NEVER log sensitive data including PII (names, DOB, passport numbers, addresses), credentials, tokens, API keys, private keys, or session identifiers.
ALWAYS redact/mask sensitive fields in logs using consistent patterns (e.g., ***-***-1234 for passport numbers, J*** D*** for names).

Files:

  • app/src/hooks/useMockDataForm.ts
  • app/vite.config.ts
app/**/*.{ts,tsx}

📄 CodeRabbit inference engine (app/AGENTS.md)

Type checking must pass before PRs (yarn types)

Files:

  • app/src/hooks/useMockDataForm.ts
  • app/vite.config.ts
app/src/**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

app/src/**/*.{ts,tsx,js,jsx}: Review React Native TypeScript code for:

  • Component architecture and reusability
  • State management patterns
  • Performance optimizations
  • TypeScript type safety
  • React hooks usage and dependencies
  • Navigation patterns

Files:

  • app/src/hooks/useMockDataForm.ts
🧠 Learnings (13)
📓 Common learnings
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/demo/** : Provide an in-SDK lightweight React Native demo under packages/mobile-sdk-alpha/demo/
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/samples/** : Create sample applications under packages/mobile-sdk-alpha/samples/ (RN demo and web demo)
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Use actual imports from selfxyz/mobile-sdk-alpha in tests
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/src/index.ts : Re-export new SDK modules via packages/mobile-sdk-alpha/src/index.ts
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/package.json : Enable tree shaking for the SDK (e.g., ensure 'sideEffects' is correctly set in package.json and exports are ESM-friendly)
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/README.md : Document new/updated SDK modules and usage in packages/mobile-sdk-alpha/README.md
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/**/package.json : Ensure package exports are properly configured
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/package.json : Expose a 'test:build' script in the SDK's package.json that runs build, test, types, and lint
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/**/*.{ts,tsx} : Avoid introducing circular dependencies
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Update the app to consume the mobile-sdk-alpha package and replace local modules with SDK imports
📚 Learning: 2025-08-25T14:25:57.586Z
Learnt from: aaronmgdr
PR: selfxyz/self#951
File: app/src/providers/authProvider.web.tsx:17-18
Timestamp: 2025-08-25T14:25:57.586Z
Learning: The selfxyz/mobile-sdk-alpha/constants/analytics import path is properly configured with SDK exports, Metro aliases, and TypeScript resolution. Import changes from @/consts/analytics to this path are part of valid analytics migration, not TypeScript resolution issues.

Applied to files:

  • app/metro.config.cjs
📚 Learning: 2025-09-22T11:10:57.879Z
Learnt from: CR
PR: selfxyz/self#0
File: app/AGENTS.md:0-0
Timestamp: 2025-09-22T11:10:57.879Z
Learning: Optionally use Watchman and run yarn install at repo root

Applied to files:

  • app/metro.config.cjs
📚 Learning: 2025-09-22T11:10:22.019Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-09-22T11:10:22.019Z
Learning: Applies to src/**/*.{js,ts,tsx,jsx} : Always handle platform differentiation with `Platform.OS` checks before platform-specific logic.

Applied to files:

  • app/metro.config.cjs
📚 Learning: 2025-09-22T11:10:57.879Z
Learnt from: CR
PR: selfxyz/self#0
File: app/AGENTS.md:0-0
Timestamp: 2025-09-22T11:10:57.879Z
Learning: Applies to app/**/*.{ios,android,web}.{ts,tsx,js,jsx} : Explain platform-specific code paths in the PR description (files with .ios, .android, or .web extensions)

Applied to files:

  • app/metro.config.cjs
📚 Learning: 2025-09-22T11:10:22.019Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-09-22T11:10:22.019Z
Learning: Always use `@/` for src imports and `tests/` for test imports; prefer platform-specific imports with conditional rendering.

Applied to files:

  • app/metro.config.cjs
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/package.json : Enable tree shaking for the SDK (e.g., ensure 'sideEffects' is correctly set in package.json and exports are ESM-friendly)

Applied to files:

  • app/vite.config.ts
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Use actual imports from selfxyz/mobile-sdk-alpha in tests

Applied to files:

  • app/vite.config.ts
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/**/*.{ts,tsx} : Avoid introducing circular dependencies

Applied to files:

  • app/vite.config.ts
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Do NOT mock selfxyz/mobile-sdk-alpha in tests (avoid jest.mock('selfxyz/mobile-sdk-alpha') and replacing real functions with mocks)

Applied to files:

  • app/vite.config.ts
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/src/index.ts : Re-export new SDK modules via packages/mobile-sdk-alpha/src/index.ts

Applied to files:

  • app/vite.config.ts
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/**/package.json : Ensure package exports are properly configured

Applied to files:

  • app/vite.config.ts
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Ensure parseNFCResponse() works with representative, synthetic NFC data

Applied to files:

  • app/vite.config.ts
🧬 Code graph analysis (2)
app/metro.config.cjs (2)
packages/mobile-sdk-demo/metro.config.cjs (8)
  • findYarnWorkspaceRoot (7-7)
  • require (5-5)
  • defaultConfig (9-9)
  • projectRoot (11-11)
  • workspaceRoot (12-12)
  • path (6-6)
  • config (18-92)
  • nodeModuleRedirects (67-73)
packages/mobile-sdk-demo/src/polyfills/cryptoPolyfill.js (1)
  • require (11-11)
app/vite.config.ts (1)
common/scripts/postBuild.mjs (1)
  • __dirname (7-7)
🪛 GitHub Check: workspace-lint
app/metro.config.cjs

[warning] 226-226:
Replace moduleName.includes('/ffjavascript')·&&·moduleName.endsWith('/ffjavascript') with ⏎··········moduleName.includes('/ffjavascript')·&&⏎··········moduleName.endsWith('/ffjavascript')⏎········


[warning] 203-203:
Replace moduleName.includes('/snarkjs')·&&·(moduleName.endsWith('/snarkjs')·||·moduleName.includes('/snarkjs/node_modules')) with ⏎··········moduleName.includes('/snarkjs')·&&⏎··········(moduleName.endsWith('/snarkjs')·||⏎············moduleName.includes('/snarkjs/node_modules'))⏎········


[warning] 185-185:
Replace path.dirname(basePath),·${subpath}.js`` with ⏎··············path.dirname(basePath),⏎··············${subpath}.js`,⏎············`

⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: e2e-ios
  • GitHub Check: build-deps
  • GitHub Check: analyze-android
  • GitHub Check: analyze-ios
🔇 Additional comments (6)
app/src/hooks/useMockDataForm.ts (1)

17-22: Default OFAC state now matches expected happy path

Starting and resetting isInOfacList to false keeps the demo in the unflagged flow by default, while still allowing toggling when needed. Looks good.

app/metro.config.cjs (4)

28-33: Reduce watch scope to avoid file-descriptor pressure and slow reloads

Watching the entire workspace root is heavy for large monorepos. Limit to folders Metro actually needs.

   watchFolders: [
-    workspaceRoot, // Watch entire workspace root for changes
     path.resolve(workspaceRoot, 'common'),
     path.resolve(workspaceRoot, 'packages/mobile-sdk-alpha'),
     path.resolve(projectRoot, 'node_modules'), // Watch app's node_modules for custom resolved modules
   ],

45-73: Fix resolver.blockList: must be a single RegExp via exclusionList()

Metro expects a single RegExp; an array is ignored. This can reintroduce duplicate-React crashes and Haste collisions.

-const findYarnWorkspaceRoot = require('find-yarn-workspace-root');
+const findYarnWorkspaceRoot = require('find-yarn-workspace-root');
+const exclusionList = require('metro-config/src/defaults/exclusionList');
...
-    // Prevent Haste module naming collisions from duplicate package.json files
-    blockList: [
+    // Prevent Haste module naming collisions from duplicate package.json files
+    blockList: exclusionList([
       // Ignore built package.json files to prevent Haste collisions
       /.*\/dist\/package\.json$/,
       /.*\/dist\/esm\/package\.json$/,
       /.*\/dist\/cjs\/package\.json$/,
       /.*\/build\/package\.json$/,
       // Prevent duplicate React/React Native - block workspace root versions and use app's versions
       // Use precise regex patterns to avoid blocking packages like react-native-get-random-values
       new RegExp(
         `^${workspaceRoot.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}/node_modules/react(/|$)`,
       ),
       new RegExp(
         `^${workspaceRoot.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}/node_modules/react-dom(/|$)`,
       ),
       new RegExp(
         `^${workspaceRoot.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}/node_modules/react-native(/|$)`,
       ),
       new RegExp(
         `^${workspaceRoot.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}/node_modules/scheduler(/|$)`,
       ),
       new RegExp('packages/mobile-sdk-alpha/node_modules/react(/|$)'),
       new RegExp('packages/mobile-sdk-alpha/node_modules/react-dom(/|$)'),
       new RegExp('packages/mobile-sdk-alpha/node_modules/react-native(/|$)'),
       new RegExp('packages/mobile-sdk-alpha/node_modules/scheduler(/|$)'),
       new RegExp('packages/mobile-sdk-demo/node_modules/react(/|$)'),
       new RegExp('packages/mobile-sdk-demo/node_modules/react-dom(/|$)'),
       new RegExp('packages/mobile-sdk-demo/node_modules/react-native(/|$)'),
       new RegExp('packages/mobile-sdk-demo/node_modules/scheduler(/|$)'),
-    ],
+    ]),

142-149: Make .js→.ts redirect cross‑platform and safe

Current check only matches POSIX paths and will throw if the TS variant doesn’t exist. Use a cross‑platform regex and fall back on failure.

-      if (
-        context.originModulePath?.includes('/common/src/') &&
-        moduleName.endsWith('.js')
-      ) {
-        const tsModuleName = moduleName.replace(/\.js$/, '.ts');
-        return context.resolveRequest(context, tsModuleName, platform);
-      }
+      {
+        const origin = context.originModulePath || '';
+        const inCommonSrc = /(?:^|[\\/])common[\\/]src[\\/]/.test(origin);
+        if (inCommonSrc && moduleName.endsWith('.js')) {
+          const tsModuleName = moduleName.replace(/\.js$/, '.ts');
+          try {
+            return context.resolveRequest(context, tsModuleName, platform);
+          } catch {
+            // fall back if TS variant doesn't exist
+          }
+        }
+      }

90-98: Pin React and React Native singletons to prevent duplicate-runtime crashes

Add explicit aliases to ensure a single copy is resolved across the workspace. This guards against subtle crashes even if blockList changes later.

     extraNodeModules: {
+      // Ensure singletons
+      react: path.resolve(workspaceRoot, 'node_modules/react'),
+      'react-native': path.resolve(workspaceRoot, 'node_modules/react-native'),
       stream: require.resolve('stream-browserify'),
       buffer: require.resolve('buffer'),
       util: require.resolve('util'),
       assert: require.resolve('assert'),
       events: require.resolve('events'),
       // App-specific alias
       '@': path.join(__dirname, 'src'),
     },
app/vite.config.ts (1)

126-126: Remove '@zk-email/helpers' from Vite externals
No source file imports this module, so externalizing it is unnecessary. After enabling Corepack, run yarn build && rg -n "@zk-email/helpers" web/dist to confirm no bare imports.
Apply:

-      external: ['fs', 'child_process', '@zk-email/helpers'],
+      external: ['fs', 'child_process'],

'mock_passport' | 'mock_id_card' | 'mock_aadhaar'
>('mock_passport');
const [isInOfacList, setIsInOfacList] = useState(true);
const [isInOfacList, setIsInOfacList] = useState(false);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mock passport ofac fix @seshanthS

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1a90a75 and 6797d47.

📒 Files selected for processing (1)
  • app/metro.config.cjs (2 hunks)
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/demo/** : Provide an in-SDK lightweight React Native demo under packages/mobile-sdk-alpha/demo/
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/samples/** : Create sample applications under packages/mobile-sdk-alpha/samples/ (RN demo and web demo)
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Use actual imports from selfxyz/mobile-sdk-alpha in tests
📚 Learning: 2025-08-25T14:25:57.586Z
Learnt from: aaronmgdr
PR: selfxyz/self#951
File: app/src/providers/authProvider.web.tsx:17-18
Timestamp: 2025-08-25T14:25:57.586Z
Learning: The selfxyz/mobile-sdk-alpha/constants/analytics import path is properly configured with SDK exports, Metro aliases, and TypeScript resolution. Import changes from @/consts/analytics to this path are part of valid analytics migration, not TypeScript resolution issues.

Applied to files:

  • app/metro.config.cjs
📚 Learning: 2025-09-22T11:10:57.879Z
Learnt from: CR
PR: selfxyz/self#0
File: app/AGENTS.md:0-0
Timestamp: 2025-09-22T11:10:57.879Z
Learning: Optionally use Watchman and run yarn install at repo root

Applied to files:

  • app/metro.config.cjs
📚 Learning: 2025-09-22T11:10:22.019Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-09-22T11:10:22.019Z
Learning: Applies to src/**/*.{js,ts,tsx,jsx} : Always handle platform differentiation with `Platform.OS` checks before platform-specific logic.

Applied to files:

  • app/metro.config.cjs
📚 Learning: 2025-09-22T11:10:57.879Z
Learnt from: CR
PR: selfxyz/self#0
File: app/AGENTS.md:0-0
Timestamp: 2025-09-22T11:10:57.879Z
Learning: Applies to app/**/*.{ios,android,web}.{ts,tsx,js,jsx} : Explain platform-specific code paths in the PR description (files with .ios, .android, or .web extensions)

Applied to files:

  • app/metro.config.cjs
📚 Learning: 2025-09-22T11:10:22.019Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-09-22T11:10:22.019Z
Learning: Always use `@/` for src imports and `tests/` for test imports; prefer platform-specific imports with conditional rendering.

Applied to files:

  • app/metro.config.cjs
🧬 Code graph analysis (1)
app/metro.config.cjs (2)
packages/mobile-sdk-demo/metro.config.cjs (6)
  • require (5-5)
  • projectRoot (11-11)
  • workspaceRoot (12-12)
  • path (6-6)
  • config (18-92)
  • nodeModuleRedirects (67-73)
packages/mobile-sdk-demo/src/polyfills/cryptoPolyfill.js (1)
  • require (11-11)
⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: analyze-android
  • GitHub Check: analyze-ios
  • GitHub Check: build-deps
  • GitHub Check: e2e-ios
🔇 Additional comments (2)
app/metro.config.cjs (2)

45-73: Metro blockList must use exclusionList to avoid runtime crash

Metro expects resolver.blockList to be a single RegExp. Supplying an array causes Metro to throw (TypeError: blockList must be a RegExp) before the packager even boots, so the demo app can’t start. Swap to exclusionList([...]) from Metro defaults.

+const exclusionList = require('metro-config/src/defaults/exclusionList');
...
-    blockList: [
+    blockList: exclusionList([
       // Ignore built package.json files to prevent Haste collisions
       /.*\/dist\/package\.json$/,
       /.*\/dist\/esm\/package\.json$/,
       /.*\/dist\/cjs\/package\.json$/,
       /.*\/build\/package\.json$/,
...
-      new RegExp('packages/mobile-sdk-demo/node_modules/scheduler(/|$)'),
-    ],
+      new RegExp('packages/mobile-sdk-demo/node_modules/scheduler(/|$)'),
+    ]),

144-149: Restore cross-platform .js→.ts resolution with fallback

originModulePath.includes('/common/src/') never matches on Windows (“\” paths), so Metro tries to load the .js file that doesn’t exist and the bundle explodes. Even on POSIX we’re missing a fallback if the .ts variant is absent. Reintroduce the platform-neutral regex and wrap resolution in a try/catch.

-      if (
-        context.originModulePath?.includes('/common/src/') &&
-        moduleName.endsWith('.js')
-      ) {
-        const tsModuleName = moduleName.replace(/\.js$/, '.ts');
-        return context.resolveRequest(context, tsModuleName, platform);
-      }
+      const originPath = context.originModulePath ?? '';
+      const inCommonSrc = /(?:^|[\\/])common[\\/]src[\\/]/.test(originPath);
+      if (inCommonSrc && moduleName.endsWith('.js')) {
+        const tsModuleName = moduleName.replace(/\.js$/, '.ts');
+        try {
+          return context.resolveRequest(context, tsModuleName, platform);
+        } catch {
+          // fall through to default resolver when TS entry is missing
+        }
+      }

Comment on lines +133 to +140
if (moduleName === '@selfxyz/mobile-sdk-alpha') {
return {
type: 'sourceFile',
filePath: path.resolve(
workspaceRoot,
'packages/mobile-sdk-alpha/dist/esm/index.js',
),
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Don’t hardwire the SDK to dist artifacts that may not exist

Forcing @selfxyz/mobile-sdk-alpha to dist/esm/index.js fails on a fresh checkout because that build output isn’t committed yet—Metro will immediately crash with ENOENT before anyone can run the demo. Provide a runtime check and fall back to the source entry.

+const fs = require('node:fs');
...
       if (moduleName === '@selfxyz/mobile-sdk-alpha') {
-        return {
-          type: 'sourceFile',
-          filePath: path.resolve(
-            workspaceRoot,
-            'packages/mobile-sdk-alpha/dist/esm/index.js',
-          ),
-        };
+        const esmEntry = path.resolve(
+          workspaceRoot,
+          'packages/mobile-sdk-alpha/dist/esm/index.js',
+        );
+        if (fs.existsSync(esmEntry)) {
+          return { type: 'sourceFile', filePath: esmEntry };
+        }
+        return {
+          type: 'sourceFile',
+          filePath: path.resolve(
+            workspaceRoot,
+            'packages/mobile-sdk-alpha/src/index.ts',
+          ),
+        };
       }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (moduleName === '@selfxyz/mobile-sdk-alpha') {
return {
type: 'sourceFile',
filePath: path.resolve(
workspaceRoot,
'packages/mobile-sdk-alpha/dist/esm/index.js',
),
};
// At the top of app/metro.config.cjs, add:
const fs = require('node:fs');
// …later in your resolveRequest function…
if (moduleName === '@selfxyz/mobile-sdk-alpha') {
const esmEntry = path.resolve(
workspaceRoot,
'packages/mobile-sdk-alpha/dist/esm/index.js',
);
if (fs.existsSync(esmEntry)) {
return { type: 'sourceFile', filePath: esmEntry };
}
return {
type: 'sourceFile',
filePath: path.resolve(
workspaceRoot,
'packages/mobile-sdk-alpha/src/index.ts',
),
};
}
🤖 Prompt for AI Agents
In app/metro.config.cjs around lines 133 to 140, the resolver forcibly points
@selfxyz/mobile-sdk-alpha to packages/mobile-sdk-alpha/dist/esm/index.js which
breaks on fresh checkouts when dist artifacts are absent; update the logic to
check at runtime whether that dist file exists (e.g., using fs.existsSync or
equivalent) and only return the dist-based sourceFile mapping if present,
otherwise return a fallback mapping to the package source entry (the repo source
file path) so Metro can resolve the package without requiring a prebuilt dist.

@transphorm transphorm changed the title feat: add mock document generator demo [SELF-700] feat: add mock document generator demo Sep 27, 2025
@transphorm transphorm merged commit 20fa5c5 into dev Sep 27, 2025
38 of 39 checks passed
@transphorm transphorm deleted the codex/ideate-mock-document-screen-for-demo-app branch September 27, 2025 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants