-
Notifications
You must be signed in to change notification settings - Fork 180
Move self app store to mobile sdk #1040
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThreaded SelfClient through proving-machine APIs and handlers; moved useSelfAppStore imports to the mobile SDK and re-exported it; deleted local provingInputs in favor of SDK implementation; added SDK disclosure-inputs and tests; updated tests, Vite chunking, and formatting scripts. (≈36 words) Changes
Sequence Diagram(s)%%{init: {"themeVariables":{"sequenceActorBackground":"#f6f8fa","actorBorder":"#0b5fff","noteBackground":"#fff8e1"}}}%%
sequenceDiagram
autonumber
actor User
participant UI as App UI
participant PM as ProvingMachine
participant SDK as Mobile SDK
participant SC as SelfClient
participant TEE as TEE/backend
participant WS as WebSocket/Socket.IO
User->>UI: start proof flow
UI->>PM: startFetchingData(selfClient)
PM->>SC: trackEvent("FETCH_START")
PM->>SDK: load context / generate inputs (stateless)
PM-->>UI: data ready
UI->>PM: startProving(selfClient)
PM->>SC: trackEvent("PAYLOAD_GEN_STARTED")
PM->>SDK: generateTEEInputs...(stateless/resolver)
PM->>PM: _generatePayload(selfClient)
PM->>SC: trackEvent("PAYLOAD_GEN_COMPLETED")
PM->>TEE: submit payload
TEE-->>PM: uuid / ack
PM->>WS: open status channel
WS-->>PM: status updates
PM->>SC: trackEvent("STATUS")
PM-->>UI: proof result / navigate
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks (2 passed, 1 warning)❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (8)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (3)
🧰 Additional context used📓 Path-based instructions (3)**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/technical-specification.mdc)
Files:
common/src/**/*.{ts,tsx,js,jsx}⚙️ CodeRabbit configuration file
Files:
app/src/**/*.{ts,tsx,js,jsx}⚙️ CodeRabbit configuration file
Files:
🧠 Learnings (8)📓 Common learnings📚 Learning: 2025-08-24T18:55:07.940ZApplied to files:
📚 Learning: 2025-08-29T15:31:15.924ZApplied to files:
📚 Learning: 2025-08-29T15:30:12.210ZApplied to files:
📚 Learning: 2025-08-29T15:31:15.924ZApplied to files:
📚 Learning: 2025-08-29T15:31:15.924ZApplied to files:
📚 Learning: 2025-08-24T18:55:07.940ZApplied to files:
📚 Learning: 2025-08-25T14:25:57.586ZApplied to files:
🧬 Code graph analysis (4)common/src/utils/trees.ts (1)
common/src/utils/aadhaar/utils.ts (1)
common/src/utils/aadhaar/mockData.ts (5)
app/src/utils/proving/provingMachine.ts (4)
⏰ 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). (3)
🔇 Additional comments (2)
✨ Finishing touches
🧪 Generate unit tests
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. Comment |
0437c6d to
7d31387
Compare
There was a problem hiding this 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
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (4)
packages/mobile-sdk-alpha/src/stores/selfAppStore.tsx (1)
28-33: Convert http→ws as well (not just https→wss) to avoid connection failures.If WS_DB_RELAYER is http://..., the client may still try an HTTP URL for a websocket-only endpoint. Convert http→ws explicitly to harden environment parity.
- const connectionUrl = WS_DB_RELAYER.startsWith('https') ? WS_DB_RELAYER.replace(/^https/, 'wss') : WS_DB_RELAYER; + const connectionUrl = + WS_DB_RELAYER.startsWith('https') + ? WS_DB_RELAYER.replace(/^https/, 'wss') + : WS_DB_RELAYER.replace(/^http/, 'ws');app/src/screens/prove/ProofRequestStatusScreen.tsx (1)
149-154: Harden deep-link opening with an allowlist of URL schemesselfApp.deeplinkCallback is untrusted input. Opening arbitrary schemes can trigger unexpected app launches. Enforce https (and your app’s custom scheme) before calling Linking.openURL.
Apply:
- if (selfApp?.deeplinkCallback) { - Linking.openURL(selfApp.deeplinkCallback).catch(err => { - console.error('Failed to open deep link:', err); - onOkPress(); - }); - } + if (selfApp?.deeplinkCallback) { + try { + const url = new URL(selfApp.deeplinkCallback); + const allowed = new Set(['https:', 'self:']); // adjust to your app scheme(s) + if (!allowed.has(url.protocol)) { + console.warn('Blocked deep link with disallowed scheme:', url.protocol); + onOkPress(); + return; + } + Linking.openURL(url.toString()).catch(err => { + console.error('Failed to open deep link:', err); + onOkPress(); + }); + } catch (e) { + console.warn('Invalid deep link URL provided:', selfApp.deeplinkCallback); + onOkPress(); + } + }app/src/utils/proving/provingMachine.ts (2)
1081-1087: Guard disclose path: crash if SelfApp is unset.
generateTEEInputsDiscloserequires a valid SelfApp;useSelfAppStore.getState().selfAppcan be null. Add a hard guard to avoid runtime failure and emit telemetry.case 'disclose': - ({ inputs, circuitName, endpointType, endpoint } = - generateTEEInputsDisclose( - secret as string, - passportData, - selfApp as SelfApp, - )); + if (!selfApp) { + selfClient.trackEvent(ProofEvents.PROVING_PROCESS_ERROR, { + message: 'SelfApp context missing for disclose', + }); + throw new Error('SelfApp context is required for disclose circuits'); + } + ({ inputs, circuitName, endpointType, endpoint } = + generateTEEInputsDisclose( + secret as string, + passportData, + selfApp as SelfApp, + ));
336-346: Type mismatch:selfAppexists in store state but not inProvingState.This won’t type-check with
create<ProvingState>(...). Either addselfAppto the interface (not used elsewhere here) or remove it. Since you already read SelfApp from the SDK store, remove this property.- selfApp: null,
🧹 Nitpick comments (6)
packages/mobile-sdk-alpha/src/stores/selfAppStore.tsx (3)
33-41: Avoid leaking sessionId in URL query; send it via auth payload.Passing identifiers in the query ends up in proxy/server logs. socket.io supports an auth payload that does not appear in the URL. Keep clientType too.
- const socket = socketIo(socketUrl, { - path: '/', - transports: ['websocket'], - forceNew: true, // Ensure a new connection is established - query: { - sessionId, - clientType: 'mobile', - }, - }); + const socket = socketIo(socketUrl, { + path: '/', + transports: ['websocket'], + forceNew: true, + auth: { + sessionId, + clientType: 'mobile', + }, + });
117-124: Ensure listener cleanup to prevent handler leaks across sessions.Disconnect doesn’t necessarily remove all listeners on reused instances. Clear them to avoid duplicate handlers after reconnects.
cleanSelfApp: () => { const socket = get().socket; if (socket) { + try { + socket.removeAllListeners(); + } catch {} socket.disconnect(); } // Reset state set({ selfApp: null, sessionId: null, socket: null }); },
126-146: Add emit timeouts/acks for delivery guarantees.If the server is down or not listening, these emits silently drop. Using timeout+ack gives an explicit failure path for telemetry/UX.
if (proof_verified) { - socket.emit('proof_verified', { - session_id: sessionId, - }); + socket.timeout(3000).emit( + 'proof_verified', + { session_id: sessionId }, + (err: unknown) => { + if (err) console.warn('[SelfAppStore] proof_verified ack timeout'); + }, + ); } else { - socket.emit('proof_generation_failed', { - session_id: sessionId, - error_code, - reason, - }); + socket.timeout(3000).emit( + 'proof_generation_failed', + { session_id: sessionId, error_code, reason }, + (err: unknown) => { + if (err) console.warn('[SelfAppStore] proof_generation_failed ack timeout'); + }, + ); }app/src/screens/prove/ProofRequestStatusScreen.tsx (1)
68-74: Reset countdownStarted when canceling to avoid stale state on refocusIf the user navigates away and returns, the countdown won’t restart because countdownStarted remains true. Reset it on cancel.
function cancelCountdown() { if (timerRef.current) { clearTimeout(timerRef.current); timerRef.current = null; } - setCountdown(null); + setCountdown(null); + setCountdownStarted(false); }app/tests/utils/proving/provingMachine.startFetchingData.test.ts (1)
95-102: Also assert analytics emission on failureThe new dependency-injected SelfClient enables telemetry. Strengthen this test by asserting FETCH_DATA_FAILED is tracked when dsc_parsed is missing.
await useProvingStore.getState().startFetchingData(mockSelfClient); expect(useProtocolStore.getState().passport.fetch_all).not.toHaveBeenCalled(); expect(actorMock.send).toHaveBeenCalledWith({ type: 'FETCH_ERROR' }); + expect(mockSelfClient.trackEvent).toHaveBeenCalledWith( + expect.stringContaining('Fetch Data Failed'), + expect.objectContaining({ message: expect.any(String) }) + );Add the import if needed:
import { ProofEvents } from '@selfxyz/mobile-sdk-alpha/constants/analytics';app/tests/utils/proving/provingMachine.generatePayload.test.ts (1)
231-246: Validate analytics hook is exercised during payload generationSince _generatePayload(selfClient) now accepts SelfClient for telemetry, assert that trackEvent was called at least once to guard against regressions.
const payload = await useProvingStore .getState() ._generatePayload(selfClient); expect(generateTEEInputsRegister).toHaveBeenCalled(); expect(getPayload).toHaveBeenCalled(); expect(encryptAES256GCM).toHaveBeenCalled(); expect(useProvingStore.getState().endpointType).toBe('celo'); expect(payload.params).toEqual({ uuid: '123', nonce: [0], cipher_text: [1], auth_tag: [2], }); + expect(selfClient.trackEvent).toHaveBeenCalled();
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (18)
app/src/components/NavBar/HomeNavBar.tsx(1 hunks)app/src/screens/prove/ConfirmBelongingScreen.tsx(1 hunks)app/src/screens/prove/ProofRequestStatusScreen.tsx(1 hunks)app/src/screens/prove/ProveScreen.tsx(2 hunks)app/src/screens/prove/QRCodeViewFinderScreen.tsx(1 hunks)app/src/utils/deeplinks.ts(1 hunks)app/src/utils/proving/provingInputs.ts(0 hunks)app/src/utils/proving/provingMachine.ts(35 hunks)app/tests/utils/deeplinks.test.ts(1 hunks)app/tests/utils/proving/provingMachine.generatePayload.test.ts(5 hunks)app/tests/utils/proving/provingMachine.startFetchingData.test.ts(3 hunks)app/tests/utils/proving/provingMachine.test.ts(1 hunks)app/vite.config.ts(0 hunks)packages/mobile-sdk-alpha/src/browser.ts(1 hunks)packages/mobile-sdk-alpha/src/index.ts(1 hunks)packages/mobile-sdk-alpha/src/processing/generate-disclosure-inputs.ts(1 hunks)packages/mobile-sdk-alpha/src/stores/index.ts(1 hunks)packages/mobile-sdk-alpha/src/stores/selfAppStore.tsx(4 hunks)
💤 Files with no reviewable changes (2)
- app/src/utils/proving/provingInputs.ts
- app/vite.config.ts
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{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/src/browser.tspackages/mobile-sdk-alpha/src/stores/index.tsapp/src/components/NavBar/HomeNavBar.tsxapp/tests/utils/deeplinks.test.tsapp/src/screens/prove/ConfirmBelongingScreen.tsxapp/src/utils/deeplinks.tsapp/tests/utils/proving/provingMachine.test.tspackages/mobile-sdk-alpha/src/processing/generate-disclosure-inputs.tsapp/src/screens/prove/ProofRequestStatusScreen.tsxpackages/mobile-sdk-alpha/src/index.tspackages/mobile-sdk-alpha/src/stores/selfAppStore.tsxapp/src/screens/prove/QRCodeViewFinderScreen.tsxapp/tests/utils/proving/provingMachine.startFetchingData.test.tsapp/src/screens/prove/ProveScreen.tsxapp/src/utils/proving/provingMachine.tsapp/tests/utils/proving/provingMachine.generatePayload.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/src/browser.tspackages/mobile-sdk-alpha/src/stores/index.tspackages/mobile-sdk-alpha/src/processing/generate-disclosure-inputs.tspackages/mobile-sdk-alpha/src/index.tspackages/mobile-sdk-alpha/src/stores/selfAppStore.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/browser.tspackages/mobile-sdk-alpha/src/stores/index.tspackages/mobile-sdk-alpha/src/processing/generate-disclosure-inputs.tspackages/mobile-sdk-alpha/src/index.tspackages/mobile-sdk-alpha/src/stores/selfAppStore.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/components/NavBar/HomeNavBar.tsxapp/src/screens/prove/ConfirmBelongingScreen.tsxapp/src/utils/deeplinks.tsapp/src/screens/prove/ProofRequestStatusScreen.tsxapp/src/screens/prove/QRCodeViewFinderScreen.tsxapp/src/screens/prove/ProveScreen.tsxapp/src/utils/proving/provingMachine.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:
app/tests/utils/deeplinks.test.tsapp/tests/utils/proving/provingMachine.test.tsapp/tests/utils/proving/provingMachine.startFetchingData.test.tsapp/tests/utils/proving/provingMachine.generatePayload.test.ts
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/generate-disclosure-inputs.ts
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
🧠 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/src/proving/** : Place proof input generation in packages/mobile-sdk-alpha/src/proving/
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-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/src/browser.tspackages/mobile-sdk-alpha/src/stores/index.tsapp/src/components/NavBar/HomeNavBar.tsxapp/src/utils/deeplinks.tspackages/mobile-sdk-alpha/src/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/**/*.{ts,tsx} : Avoid introducing circular dependencies
Applied to files:
packages/mobile-sdk-alpha/src/browser.tspackages/mobile-sdk-alpha/src/stores/index.tsapp/src/components/NavBar/HomeNavBar.tsxapp/tests/utils/deeplinks.test.tsapp/src/utils/deeplinks.tspackages/mobile-sdk-alpha/src/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/src/browser.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:
packages/mobile-sdk-alpha/src/browser.tspackages/mobile-sdk-alpha/src/stores/index.tsapp/src/components/NavBar/HomeNavBar.tsxapp/tests/utils/deeplinks.test.tsapp/src/utils/deeplinks.tsapp/src/screens/prove/ProofRequestStatusScreen.tsxpackages/mobile-sdk-alpha/src/index.tsapp/src/screens/prove/QRCodeViewFinderScreen.tsxapp/src/screens/prove/ProveScreen.tsxapp/tests/utils/proving/provingMachine.generatePayload.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/tee/** : Place TEE session management (e.g., WebSocket handling) in packages/mobile-sdk-alpha/src/tee/
Applied to files:
packages/mobile-sdk-alpha/src/browser.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:
packages/mobile-sdk-alpha/src/stores/index.tsapp/src/components/NavBar/HomeNavBar.tsxapp/tests/utils/deeplinks.test.tsapp/src/utils/deeplinks.tsapp/src/screens/prove/ProofRequestStatusScreen.tsxapp/src/screens/prove/QRCodeViewFinderScreen.tsxapp/src/utils/proving/provingMachine.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/src/stores/index.tsapp/tests/utils/deeplinks.test.tsapp/src/utils/deeplinks.tsapp/tests/utils/proving/provingMachine.generatePayload.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/**/package.json : Ensure package exports are properly configured
Applied to files:
packages/mobile-sdk-alpha/src/stores/index.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: 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:
app/src/components/NavBar/HomeNavBar.tsxapp/src/screens/prove/ProofRequestStatusScreen.tsxapp/src/screens/prove/QRCodeViewFinderScreen.tsxapp/src/screens/prove/ProveScreen.tsxapp/tests/utils/proving/provingMachine.generatePayload.test.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:
app/src/components/NavBar/HomeNavBar.tsxapp/src/screens/prove/ProofRequestStatusScreen.tsxapp/src/screens/prove/QRCodeViewFinderScreen.tsxapp/src/screens/prove/ProveScreen.tsxapp/tests/utils/proving/provingMachine.generatePayload.test.ts
📚 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:
app/src/components/NavBar/HomeNavBar.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: Update the app to consume the mobile-sdk-alpha package and replace local modules with SDK imports
Applied to files:
app/src/components/NavBar/HomeNavBar.tsxapp/src/utils/deeplinks.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/components/NavBar/HomeNavBar.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:
app/tests/utils/deeplinks.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:
app/tests/utils/deeplinks.test.tsapp/tests/utils/proving/provingMachine.generatePayload.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:
app/tests/utils/deeplinks.test.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:
app/tests/utils/deeplinks.test.tsapp/tests/utils/proving/provingMachine.generatePayload.test.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/__setup__/databaseMocks.ts : Provide SQLite testing utilities in tests/__setup__/databaseMocks.ts and use a mock database instance
Applied to files:
app/tests/utils/deeplinks.test.tsapp/tests/utils/proving/provingMachine.startFetchingData.test.tsapp/tests/utils/proving/provingMachine.generatePayload.test.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/**/*.{ts,tsx,js,jsx} : Use tests/ alias for test imports
Applied to files:
app/tests/utils/deeplinks.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/src/processing/generate-disclosure-inputs.tsapp/src/utils/proving/provingMachine.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: Use custom hooks for complex state (useModal, useHapticNavigation)
Applied to files:
app/src/screens/prove/QRCodeViewFinderScreen.tsx
📚 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: Passport verification workflow: NFC data extraction → MRZ validation → DSC verification → Register proof → compliance via ZK → attestation
Applied to files:
app/src/utils/proving/provingMachine.ts
🧬 Code graph analysis (7)
packages/mobile-sdk-alpha/src/browser.ts (1)
common/src/utils/generateInputs.ts (2)
generateCircuitInputsOfac(183-221)generateCircuitInputsDisclose(135-181)
app/src/screens/prove/ConfirmBelongingScreen.tsx (1)
packages/mobile-sdk-alpha/src/constants/analytics.ts (1)
ProofEvents(105-165)
packages/mobile-sdk-alpha/src/processing/generate-disclosure-inputs.ts (1)
common/src/utils/circuits/registerInputs.ts (1)
generateTEEInputsDiscloseStateless(39-108)
packages/mobile-sdk-alpha/src/index.ts (1)
common/src/utils/generateInputs.ts (2)
generateCircuitInputsDisclose(135-181)generateCircuitInputsOfac(183-221)
app/tests/utils/proving/provingMachine.startFetchingData.test.ts (1)
packages/mobile-sdk-alpha/src/types/public.ts (1)
SelfClient(183-206)
app/src/utils/proving/provingMachine.ts (3)
packages/mobile-sdk-alpha/src/types/public.ts (1)
SelfClient(183-206)packages/mobile-sdk-alpha/src/constants/analytics.ts (2)
ProofEvents(105-165)PassportEvents(83-103)packages/mobile-sdk-alpha/src/documents/utils.ts (1)
loadSelectedDocument(54-90)
app/tests/utils/proving/provingMachine.generatePayload.test.ts (1)
app/src/utils/proving/provingMachine.ts (1)
useProvingStore(229-1158)
⏰ 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). (3)
- GitHub Check: build-android
- GitHub Check: build-ios
- GitHub Check: test
🔇 Additional comments (12)
app/src/screens/prove/QRCodeViewFinderScreen.tsx (1)
17-18: LGTM: migrated store import to SDK.Centralizing useSelfAppStore under the SDK keeps a single source of truth. No logic changes introduced here.
app/tests/utils/proving/provingMachine.test.ts (1)
39-42: LGTM: include trackEvent on SelfClient stub.Matches the PR objective to route analytics via selfClient.
app/src/utils/deeplinks.ts (1)
8-11: LGTM: consume store from SDK path.Keeps deeplink handling aligned with the SDK store and avoids app-level duplication.
packages/mobile-sdk-alpha/src/stores/index.ts (1)
6-6: Verified stores subpath export is correctly configured. package.json in packages/mobile-sdk-alpha includes a “./stores” export mapping to both ESM and CJS builds.app/src/components/NavBar/HomeNavBar.tsx (1)
12-14: LGTM: import migrated to SDK.No behavioral change; aligns with the new centralized store.
app/tests/utils/deeplinks.test.ts (1)
15-17: LGTM: mock redirected to SDK subpath.Focused mocking of the store submodule minimizes surface area and avoids heavy SDK mocks.
packages/mobile-sdk-alpha/src/index.ts (1)
91-92: Exports parity and no circular imports detected –generateTEEInputsDisloseandscanQRProofare exported identically in bothsrc/index.tsandsrc/browser.ts, and there are no imports fromindexorbrowserwithinsrc/processingorsrc/stores.packages/mobile-sdk-alpha/src/browser.ts (1)
57-58: Break circular dependency betweentypes/public.tsandtypes/events.ts
src/index.tscorrectly re-exportsgenerateTEEInputsDisclose.madgescan flagged a cycle:packages/mobile-sdk-alpha/src/types/public.ts → types/events.ts. Refactor by extracting shared types or inverting imports to remove this circular dependency.⛔ Skipped due to learnings
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 dependenciesLearnt 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.tsLearnt 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 testsLearnt 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 codebaseapp/src/screens/prove/ProveScreen.tsx (1)
151-153: setUserConfirmed doesn’t persist the SelfClient object
Verified thatsetUserConfirmed(selfClient)only flips the internaluserConfirmedflag and noselfClientreference is ever stored in the proving store or its persisted state—SelfClient remains ephemeral.app/src/screens/prove/ConfirmBelongingScreen.tsx (1)
63-70: LGTM: pass SelfClient through proving actionsPassing selfClient into setFcmToken and setUserConfirmed aligns with the new API and avoids storing clients in state.
app/src/utils/proving/provingMachine.ts (2)
386-417: Analytics event may be mislabeled (hello vs submit ack).You track
WS_HELLO_ACKwhen handling a response withid === 2, which corresponds toopenpassport_submit_request(your hello usesid: 1). This can skew analytics funnels. Confirm intended mapping and rename if needed (e.g., a dedicated “submit ack/status uuid received” event).
475-479: Confirm Socket.IO path.You force
path: '/'. Many Socket.IO servers expect the default'/socket.io'. If your relayer truly serves at root, keep it; otherwise connections will fail intermittently behind proxies/CDNs.
There was a problem hiding this 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 (2)
app/src/utils/proving/provingMachine.ts (2)
346-352: Remove strayselfAppfrom initial state (breaks typing).
selfAppis not part ofProvingState; the literal passed tocreate<ProvingState>must not include unknown keys. This will fail TS checks and can break CI.env: null, - selfApp: null, error_code: null, reason: null,
526-559: GuardJSON.parsein Socket.IO status handler to avoid crashes on bad payloads.A malformed
statusmessage will throw and abort the proving flow without cleanup/telemetry. Add try/catch and fail gracefully.- socket.on('status', (message: unknown) => { - const data = - typeof message === 'string' ? JSON.parse(message) : message; + socket.on('status', (message: unknown) => { + let data: any; + try { + data = typeof message === 'string' ? JSON.parse(message) : message; + } catch (err) { + console.error('Invalid Socket.IO status payload:', err); + selfClient.trackEvent(ProofEvents.SOCKETIO_PROOF_FAILURE, { + error_code: 'invalid_status_payload', + reason: err instanceof Error ? err.message : String(err), + }); + selfClient.trackEvent(ProofEvents.PROOF_FAILED, { + circuitType: get().circuitType, + error: 'invalid_status_payload', + }); + actor!.send({ type: 'PROVE_ERROR' }); + socket?.disconnect(); + set({ socketConnection: null }); + return; + } selfClient.trackEvent(ProofEvents.SOCKETIO_STATUS_RECEIVED, { status: data.status, });
♻️ Duplicate comments (1)
app/src/utils/proving/provingMachine.ts (1)
168-174: Nice fix: stable WS listener refs + symmetric cleanup.This resolves prior leaks/duplicate handling from anonymous listeners and aligns with the store-held handler refs approach. Good job.
Also applies to: 899-906, 909-913
🧹 Nitpick comments (7)
packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.test.ts (4)
5-7: Import under test via public entry to match SDK usage.Tests should exercise the public API surface.
-import { generateTEEInputsDisclose } from '../../src/processing/generate-disclosure-inputs'; +import { generateTEEInputsDisclose } from '../../src';If path aliases are configured, prefer:
- import { generateTEEInputsDisclose } from '../../src'; + import { generateTEEInputsDisclose } from '@selfxyz/mobile-sdk-alpha';
25-30: Assert on meaningful outputs from your stub to prove selection is correct.Right now you only check
defined. Verify the wrapper returns the trees pulled from the correct document bucket.- it('returns correct ofac tree data', () => { - const result = generateTEEInputsDisclose(mockSecret, mockPassportData, mockSelfApp); - expect(result).toBeDefined(); - }); + it('returns correct ofac/commitment trees for passport', () => { + const result = generateTEEInputsDisclose(mockSecret, mockPassportData, mockSelfApp) as any; + expect(result.inputs.ofac).toEqual({ + nameAndDob: {}, + nameAndYob: {}, + passportNoAndNationality: {}, + }); + expect(result.inputs.commitment).toEqual({ root: '0x00' }); + });
41-45: Remove untestable “unknown tree type” case.The tree type is internal to
generateTEEInputsDiscloseStateless; you can’t trigger this path from the public API without refactoring.- it('throws error for unknown tree type', () => { - // This case is already covered by the default switch, but to simulate, we can call with an invalid tree type if possible - // Since the tree type is determined inside the function, this is not directly testable unless we refactor - expect(() => generateTEEInputsDisclose(mockSecret, mockPassportData, mockSelfApp)).toThrow(); - });
5-5: Clean up after tests to avoid cross-test bleed.Reset vitest mocks and restore default store after each spec.
-import { describe, expect, it, vi } from 'vitest'; +import { describe, expect, it, vi, afterEach } from 'vitest'; +afterEach(() => { + vi.clearAllMocks(); + // Restore default happy-path store state + useProtocolStore.setState({ + passport: { + ofac_trees: { nameAndDob: {}, nameAndYob: {}, passportNoAndNationality: {} }, + commitment_tree: { root: '0x00' }, + }, + }); +});packages/mobile-sdk-alpha/src/processing/generate-disclosure-inputs.ts (3)
11-11: Add explicit return type to lock API surface.Helps prevent accidental breaking changes and improves DX.
-export function generateTEEInputsDisclose(secret: string, passportData: PassportData, selfApp: SelfApp) { +export function generateTEEInputsDisclose( + secret: string, + passportData: PassportData, + selfApp: SelfApp +): ReturnType<typeof generateTEEInputsDiscloseStateless> {
14-17: Avoidanyby typing the protocol store, and enrich the error with available keys.Removes unsafe casts and aids debugging when a category is missing.
- const protocolStore = useProtocolStore.getState(); - const docStore = (protocolStore as any)[document]; - if (!docStore) { - throw new Error(`Unknown or unloaded document category in protocol store: ${document}`); - } + const protocolStore = useProtocolStore.getState() as Partial< + Record<DocumentCategory, { ofac_trees?: unknown; commitment_tree?: unknown }> + >; + const docStore = protocolStore[document]; + if (!docStore) { + const available = Object.keys(protocolStore || {}).join(', ') || '(none)'; + throw new Error( + `Unknown or unloaded document category in protocol store: ${document}. Available: ${available}` + ); + }
19-27: Optional: pre-validate OFAC trees to fail closer to source.Stateless generator will throw later; early check yields clearer errors.
case 'ofac': - return docStore.ofac_trees; + if (!docStore.ofac_trees) { + throw new Error('OFAC trees not loaded'); + } + return docStore.ofac_trees;
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
app/src/utils/proving/provingMachine.ts(37 hunks)packages/mobile-sdk-alpha/src/processing/generate-disclosure-inputs.ts(1 hunks)packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.test.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{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/tests/processing/generate-disclosure-inputs.test.tsapp/src/utils/proving/provingMachine.tspackages/mobile-sdk-alpha/src/processing/generate-disclosure-inputs.ts
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/processing/generate-disclosure-inputs.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/processing/generate-disclosure-inputs.test.tspackages/mobile-sdk-alpha/src/processing/generate-disclosure-inputs.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/processing/generate-disclosure-inputs.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/processing/generate-disclosure-inputs.test.tspackages/mobile-sdk-alpha/src/processing/generate-disclosure-inputs.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/utils/proving/provingMachine.ts
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/generate-disclosure-inputs.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/src/proving/** : Place proof input generation in packages/mobile-sdk-alpha/src/proving/
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
📚 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/processing/generate-disclosure-inputs.test.tsapp/src/utils/proving/provingMachine.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/processing/generate-disclosure-inputs.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/processing/generate-disclosure-inputs.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}} : Write integration tests that exercise the real validation logic (not mocks)
Applied to files:
packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.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/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/tests/processing/generate-disclosure-inputs.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/processing/generate-disclosure-inputs.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}} : Use actual imports from selfxyz/mobile-sdk-alpha in tests
Applied to files:
packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.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}} : 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/processing/generate-disclosure-inputs.test.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/__setup__/databaseMocks.ts : Provide SQLite testing utilities in tests/__setup__/databaseMocks.ts and use a mock database instance
Applied to files:
packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.test.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/src/utils/proving/provingMachine.ts
📚 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: Passport verification workflow: NFC data extraction → MRZ validation → DSC verification → Register proof → compliance via ZK → attestation
Applied to files:
app/src/utils/proving/provingMachine.ts
📚 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 **/*.{ts,tsx} : Define IdentityCommitment with fields: commitment (Poseidon hash), nullifier (domain-separated), timestamp (UTC number), version (circuit version), documentType ('passport' | 'eu_id_card')
Applied to files:
packages/mobile-sdk-alpha/src/processing/generate-disclosure-inputs.ts
🧬 Code graph analysis (3)
packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.test.ts (1)
packages/mobile-sdk-alpha/src/processing/generate-disclosure-inputs.ts (1)
generateTEEInputsDisclose(11-30)
app/src/utils/proving/provingMachine.ts (5)
packages/mobile-sdk-alpha/src/types/public.ts (1)
SelfClient(183-206)common/src/utils/appType.ts (1)
EndpointType(14-14)packages/mobile-sdk-alpha/src/constants/analytics.ts (1)
ProofEvents(105-165)packages/mobile-sdk-alpha/src/documents/utils.ts (1)
loadSelectedDocument(54-90)app/src/utils/notifications/notificationService.ts (1)
registerDeviceToken(42-93)
packages/mobile-sdk-alpha/src/processing/generate-disclosure-inputs.ts (1)
common/src/utils/circuits/registerInputs.ts (1)
generateTEEInputsDiscloseStateless(39-108)
🪛 GitHub Actions: Mobile SDK CI
packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.test.ts
[error] 27-27: TypeError: Cannot read properties of undefined (reading 'replace') during test 'returns correct ofac tree data' in generateTEEInputsDisclose (line 27).
packages/mobile-sdk-alpha/src/processing/generate-disclosure-inputs.ts
[error] 12-12: generateTEEInputsDisclose invoked; downstream error originates from undefined input (see stack trace).
🪛 GitHub Actions: Mobile CI
app/src/utils/proving/provingMachine.ts
[warning] 1-1: Prettier formatting issues detected in src/utils/proving/provingMachine.ts. Run 'prettier --write' to fix.
🪛 GitHub Check: test
packages/mobile-sdk-alpha/src/processing/generate-disclosure-inputs.ts
[failure] 12-12: tests/processing/generate-disclosure-inputs.test.ts > generateTEEInputsDisclose > returns correct ofac tree data
TypeError: Cannot read properties of undefined (reading 'replace')
❯ getSolidityPackedUserContextData ../../common/src/utils/hash.ts:131:28
❯ calculateUserIdentifierHash ../../common/src/utils/hash.ts:33:41
❯ Module.generateTEEInputsDiscloseStateless ../../common/src/utils/circuits/registerInputs.ts:49:30
❯ Module.generateTEEInputsDisclose src/processing/generate-disclosure-inputs.ts:12:10
❯ tests/processing/generate-disclosure-inputs.test.ts:27:20
🔇 Additional comments (5)
packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.test.ts (1)
1-3: License header conversion date is correct.Header’s “2029-06-11” matches the Change Date in app/LICENSE.
packages/mobile-sdk-alpha/src/processing/generate-disclosure-inputs.ts (2)
11-29: Guarded resolver looks good; clear errors for missing doc store and commitment tree.The wrapper cleanly delegates to the stateless generator and fails fast with actionable messages.
5-10: Cycle check passed — no import cycle detected
Verified thatprocessing/generate-disclosure-inputs.tsimports from the store, and no files inpackages/mobile-sdk-alpha/src/storesimport from anyprocessingmodules.app/src/utils/proving/provingMachine.ts (2)
193-206: No breaking API issues detected
Search confirmed no application code invoking the updateduseProvingStoremethods without the newselfClientparameter, and tests already pass a mockselfClient. All call sites are correct.
1-1: Fix CI-prettier errors
Enable Corepack to match the project’s Yarn version (corepack enable), then run:yarn prettier --write app/src/utils/proving/provingMachine.tsOr bypass Yarn entirely:
npx prettier --write app/src/utils/proving/provingMachine.ts
packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.test.ts
Show resolved
Hide resolved
packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.test.ts
Show resolved
Hide resolved
packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.test.ts
Outdated
Show resolved
Hide resolved
packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.test.ts
Show resolved
Hide resolved
packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.test.ts
Show resolved
Hide resolved
|
@coderabbitai please review and close all finished items |
|
@aaronmgdr I'll review the changes and resolve all completed items. This PR represents a significant architectural improvement by moving the self app store to the mobile SDK and properly threading the SelfClient through the proving machine. The changes look well-structured, removing state coupling and improving type safety. I'll trigger the review and resolve existing comments that have been addressed. 🧠 Learnings used✅ Actions performedComments resolved. Review triggered.
|
|
fyi merged with dev to fix pipelines |
There was a problem hiding this 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
📒 Files selected for processing (1)
app/vite.config.ts(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{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:
app/vite.config.ts
🧠 Learnings (5)
📓 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/src/proving/** : Place proof input generation in packages/mobile-sdk-alpha/src/proving/
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
📚 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: Optimize bundle size with tree shaking
Applied to files:
app/vite.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 src/utils/**/*.{ts,tsx} : Place shared utilities in @/utils
Applied to files:
app/vite.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 src/**/screens/**/*.{ts,tsx} : Lazy load screens and components to improve performance
Applied to files:
app/vite.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 src/**/screens/**/*.{ts,tsx} : Lazy load screens using React.lazy()
Applied to files:
app/vite.config.ts
⏰ 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). (3)
- GitHub Check: analyze-android
- GitHub Check: analyze-ios
- GitHub Check: e2e-ios
🔇 Additional comments (1)
app/vite.config.ts (1)
86-94: Action: locally verify excluding '@zk-email/helpers' from optimizeDepsSandbox search returned no files — cannot verify here. Run these checks locally and act on any hits:
- Search direct imports/usages in app and SDK:
rg -nP "(from\s+['"]@zk-email/helpers['"]|require(['"]@zk-email/helpers['"])|import(\s*['"]@zk-email/helpers['"]\s*))" app/src packages/mobile-sdk-alpha || true- Search package.json / lockfiles for the package:
rg -n "@zk-email/helpers" **/package.json package-lock.json yarn.lock pnpm-lock.yaml || true- Search for Node core imports in browser paths (path, fs, child_process):
rg -nP "(from\s+'"['"]|require('"['"]))" app/src packages/mobile-sdk-alpha || true- Inspect dependency graph if needed:
npm ls @zk-email/helpers || pnpm why @zk-email/helpers || trueIf any browser-facing import exists: do not exclude the package — either remove/guard the import, add it to optimizeDeps.include to force pre-bundling, or provide proper polyfills/aliases for Node cores (Vite 5 no longer polyfills 'path').
| rollupOptions: { | ||
| external: ['fs', 'path', 'child_process'], | ||
| external: ['fs', 'child_process', '@zk-email/helpers'], | ||
| output: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Avoid externalizing '@zk-email/helpers' in a web app build—likely to break at runtime.
Marking a dependency as external in a Vite app build leaves a bare import in the browser bundle. If any browser-executed path imports '@zk-email/helpers', you'll ship an unresolved import and hit a runtime error unless you inject that module separately (CDN/UMD), which you’re not doing here.
Recommend removing it from Rollup externals. If the goal is to keep Node-only code out of the web bundle, guard imports with platform checks or alias the module to a small web shim that throws a clear error when invoked.
Apply this minimal fix:
- external: ['fs', 'child_process', '@zk-email/helpers'],
+ external: ['fs', 'child_process'],Optional: add a web-only shim (create at app/src/shims/zk-email-helpers.web.ts) and alias it in resolve.alias if you must keep imports in shared code:
// app/src/shims/zk-email-helpers.web.ts
export default new Proxy(
{},
{
get() {
throw new Error('@zk-email/helpers is not available on web');
},
},
);🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Searching repo for imports of '@zk-email/helpers'..."
rg -n --hidden --no-ignore -S "'@zk-email/helpers'|\"@zk-email/helpers\"" -g '!*node_modules*' -C 3 || true
echo
echo "Showing app/vite.config.ts (up to 300 lines) if present..."
if [ -f app/vite.config.ts ]; then
sed -n '1,300p' app/vite.config.ts || true
else
echo "app/vite.config.ts not found"
fi
echo
echo "Showing package.json (top 300 lines) if present..."
if [ -f package.json ]; then
sed -n '1,300p' package.json || true
else
echo "package.json not found"
fi
echo
echo "Searching for any resolve.alias or shims ('.web.' files)..."
rg -n "resolve\.alias" -g '!*node_modules*' -S || true
rg -n --hidden --no-ignore -S "\.web\.(ts|tsx|js|jsx)" -g '!*node_modules*' || trueLength of output: 9084
Remove '@zk-email/helpers' from Rollup externals and optimizeDeps.exclude in app/vite.config.ts — it will break the web bundle.
Externalizing '@zk-email/helpers' leaves a bare import in the browser bundle; app/vite.config.ts currently lists it in both rollupOptions.external and optimizeDeps.exclude and there is no web alias/shim, so any client-side import will cause an unresolved-import runtime error. Update app/vite.config.ts to stop externalizing it or provide a web shim/alias that throws a clear error.
Apply this minimal fix (rollup external):
- external: ['fs', 'child_process', '@zk-email/helpers'],
+ external: ['fs', 'child_process'],Also remove '@zk-email/helpers' from optimizeDeps.exclude (near the top of the same file) or add a web-only shim and resolve.alias mapping that surfaces a clear error when used on web.
📝 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.
| rollupOptions: { | |
| external: ['fs', 'path', 'child_process'], | |
| external: ['fs', 'child_process', '@zk-email/helpers'], | |
| output: { | |
| rollupOptions: { | |
| external: ['fs', 'child_process'], | |
| output: { |
🤖 Prompt for AI Agents
In app/vite.config.ts around lines 104-106, '@zk-email/helpers' is incorrectly
listed in rollupOptions.external (and also in optimizeDeps.exclude near the
top), which leaves a bare import in the browser bundle and will cause an
unresolved-import runtime error; remove '@zk-email/helpers' from
rollupOptions.external and from optimizeDeps.exclude so it is bundled for web,
or alternatively add a web-only resolve.alias/shim that exports a clear runtime
error message when imported in the browser — update the config accordingly
(remove from both external and exclude, or add alias mapping to a small shim
module that throws a descriptive error).
There was a problem hiding this 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
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
app/README.md (1)
203-208: Replace brittle ChatGPT-share link with official Apple/Xcode instructionsThird-party share links can break or be blocked. Point users to stable Apple flows.
-Find your [development team id](https://chat.openai.com/share/9d52c37f-d9da-4a62-acb9-9e4ee8179f95) and run: +Find your Apple Developer Team ID (Xcode: Settings/Preferences → Accounts → select your team → Team ID; or on developer.apple.com/account under Membership) and run:app/src/utils/proving/provingMachine.ts (2)
592-603: Don’t instantiate MessageEvent in React Native
new MessageEvent(...)isn’t available in RN; this will throw and mask the original WS error. Pass a plain object withdatainstead.- get()._handleWebSocketMessage( - new MessageEvent('error', { - data: JSON.stringify({ error: 'WebSocket connection error' }), - }), - selfClient, - ); + const fakeEvent = { + data: JSON.stringify({ error: 'WebSocket connection error' }), + } as unknown as MessageEvent; + get()._handleWebSocketMessage(fakeEvent, selfClient);
605-627: RN compatibility: avoid MessageEvent constructor on close pathSame issue on close handler; use a lightweight
{ data }object.- get()._handleWebSocketMessage( - new MessageEvent('error', { - data: JSON.stringify({ error: 'WebSocket closed unexpectedly' }), - }), - selfClient, - ); + const fakeEvent = { + data: JSON.stringify({ error: 'WebSocket closed unexpectedly' }), + } as unknown as MessageEvent; + get()._handleWebSocketMessage(fakeEvent, selfClient);
♻️ Duplicate comments (2)
app/src/utils/proving/provingMachine.ts (2)
884-913: Add a connect timeout and make resolution idempotentWithout a timeout, the WS connect can hang indefinitely; also guard duplicate resolve paths.
- return new Promise(resolve => { + return new Promise(resolve => { const ws = new WebSocket(wsRpcUrl); - const handleConnectSuccess = () => { - selfClient.trackEvent(ProofEvents.TEE_CONN_SUCCESS); - resolve(true); - }; - const handleConnectError = (msg: string = 'connect_error') => { - selfClient.trackEvent(ProofEvents.TEE_CONN_FAILED, { message: msg }); - resolve(false); - }; + let done = false; + const handleConnectSuccess = () => { + if (done) return; + done = true; + clearTimeout(timeout); + selfClient.trackEvent(ProofEvents.TEE_CONN_SUCCESS); + resolve(true); + }; + const handleConnectError = (msg: string = 'connect_error') => { + if (done) return; + done = true; + clearTimeout(timeout); + selfClient.trackEvent(ProofEvents.TEE_CONN_FAILED, { message: msg }); + try { ws.close(); } catch {} + resolve(false); + }; + const timeout = setTimeout(() => { + handleConnectError('connect_timeout'); + }, 15000); @@ - if (!actor) { - return; - } + if (!actor) { + handleConnectError('actor_not_initialized'); + return; + }
1016-1032: Always close WS even if handlers are missingCleanup currently skips closing when
wsHandlersis null, leaking sockets.- if (ws && wsHandlers) { + if (ws) { try { - ws.removeEventListener('message', wsHandlers.message); - ws.removeEventListener('open', wsHandlers.open); - ws.removeEventListener('error', wsHandlers.error); - ws.removeEventListener('close', wsHandlers.close); + if (wsHandlers) { + ws.removeEventListener('message', wsHandlers.message); + ws.removeEventListener('open', wsHandlers.open); + ws.removeEventListener('error', wsHandlers.error); + ws.removeEventListener('close', wsHandlers.close); + } ws.close(); } catch (error) { console.error( 'Error removing listeners or closing WebSocket:', error, ); } - set({ wsConnection: null, wsHandlers: null }); + set({ wsConnection: null, wsHandlers: null }); }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (5)
app/README.md(10 hunks)app/package.json(1 hunks)app/src/utils/proving/provingMachine.ts(37 hunks)package.json(2 hunks)packages/mobile-sdk-alpha/package.json(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- packages/mobile-sdk-alpha/package.json
🧰 Additional context used
📓 Path-based instructions (4)
package.json
📄 CodeRabbit inference engine (.cursor/rules/technical-specification.mdc)
Distribute the SDK via npm/yarn with proper package metadata
Files:
package.json
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
**/*.{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:
app/src/utils/proving/provingMachine.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/utils/proving/provingMachine.ts
🧠 Learnings (21)
📓 Common learnings
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/proving/** : Place proof input generation in packages/mobile-sdk-alpha/src/proving/
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.
📚 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: yarn nice passes (fixes linting and formatting) before PR
Applied to files:
package.jsonapp/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: After review changes, re-run yarn nice, yarn test, yarn types
Applied to files:
package.jsonapp/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 committing, run repository checks (yarn nice, yarn lint, yarn build, contracts build, yarn types)
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.jsonapp/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-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.jsonapp/README.mdapp/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-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:
package.jsonapp/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:
package.jsonapp/README.md
📚 Learning: 2025-08-29T15:30:32.847Z
Learnt from: CR
PR: selfxyz/self#0
File: noir/AGENTS.md:0-0
Timestamp: 2025-08-29T15:30:32.847Z
Learning: Pre-commit: run `nargo fmt`, `nargo test`, and `nargo build`
Applied to files:
package.jsonapp/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: Document complex native module changes for AI review
Applied to files:
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/README.md : Document new/updated SDK modules and usage in packages/mobile-sdk-alpha/README.md
Applied to files:
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: Document API changes with examples, flag breaking changes, note performance and security implications for AI review
Applied to files:
app/README.md
📚 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: Document any breaking changes
Applied to files:
app/README.md
📚 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: For Android, install Android SDK + Emulator, configure ANDROID_HOME, and use JDK 17 (JAVA_HOME)
Applied to files:
app/README.md
📚 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:
app/README.md
📚 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/src/utils/proving/provingMachine.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:
app/src/utils/proving/provingMachine.ts
📚 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: Passport verification workflow: NFC data extraction → MRZ validation → DSC verification → Register proof → compliance via ZK → attestation
Applied to files:
app/src/utils/proving/provingMachine.ts
🧬 Code graph analysis (1)
app/src/utils/proving/provingMachine.ts (5)
packages/mobile-sdk-alpha/src/types/public.ts (1)
SelfClient(183-206)common/src/utils/appType.ts (1)
EndpointType(14-14)packages/mobile-sdk-alpha/src/constants/analytics.ts (1)
ProofEvents(105-165)packages/mobile-sdk-alpha/src/documents/utils.ts (1)
loadSelectedDocument(54-90)app/src/utils/notifications/notificationService.ts (1)
registerDeviceToken(42-93)
🪛 markdownlint-cli2 (0.17.2)
app/README.md
113-113: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
⏰ 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). (6)
- GitHub Check: build-android
- GitHub Check: build-ios
- GitHub Check: test
- GitHub Check: e2e-ios
- GitHub Check: analyze-android
- GitHub Check: analyze-ios
🔇 Additional comments (4)
app/README.md (1)
15-20: Align pinned NDK with Gradle config; avoid env-var driftDocs pin NDK 27.0.11718014 and instruct setting ANDROID_NDK/ANDROID_NDK_VERSION, but I couldn't verify a Gradle
android.ndkVersionpin from the repo scan — confirmandroid.ndkVersionis set to 27.0.11718014 in your Gradle files or update the docs to require that it match.Locations:
- app/README.md (mentions ANDROID_NDK_VERSION / ANDROID_NDK around lines 89 and 195)
- app/docs/MOBILE_DEPLOYMENT.md (ANDROID_NDK_VERSION: 27.0.11718014 at line 119)
Suggested README table change:
-| Android NDK | 27.0.11718014 | See instructions for Android below | +| Android NDK | 27.0.11718014 | Must match Gradle `android.ndkVersion`; see Android instructions below |app/package.json (1)
27-28: Prettier via Yarn: looks goodSwitching fmt scripts to
yarn prettieraligns tooling across the monorepo.package.json (2)
18-19: Formatting scripts migration: OKYarn-based Prettier invocations for CI and root formatting are consistent and fine.
49-49: Prettier 3.5.3 is published — no change required
npm verification shows 3.5.3 is available; keeping "prettier": "^3.5.3" is acceptable. Optional: pin to 3.5.3 (remove caret) for deterministic installs.
| List available SDK platforms | ||
|
|
||
| ```bash | ||
| $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --list | grep platforms | ||
| ``` | ||
|
|
||
| In the list of platforms, find the latest version and install it. (Replace *NN* with the latest version number) | ||
| In the list of platforms, find the latest version and install it. (Replace _NN_ with the latest version number) | ||
|
|
||
| ```bash | ||
| $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install "platforms;android-NN" | ||
| ``` | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add license acceptance; without it, CLI installs fail at build time
sdkmanager requires accepting licenses or Gradle builds will error later. Include this step right after listing/installing platforms.
List available SDK platforms
```bash
$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --list | grep platforms+Accept licenses (required):
+bash +$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses +
In the list of platforms, find the latest version and install it. (Replace NN with the latest version number)
$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install "platforms;android-NN"
<details>
<summary>🤖 Prompt for AI Agents</summary>
In app/README.md around lines 71 to 82, the docs list and install Android
platforms but omit accepting SDK licenses; add an instruction to run the
sdkmanager --licenses command immediately after listing platforms (or right
before installing the chosen platform) so CI/local builds won't fail due to
unaccepted licenses; update the ordering to: list platforms, run sdkmanager
--licenses to accept all prompts, then install the selected
"platforms;android-NN".
</details>
<!-- fingerprinting:phantom:triton:chinchilla -->
<!-- This is an auto-generated comment by CodeRabbit -->
| Install the NDK | ||
|
|
||
| ```bash | ||
| $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install "ndk;27.0.11718014" | ||
| ``` | ||
|
|
||
| Define the environment variable `ANDROID_NDK_VERSION` to `27.0.11718014` and `ANDROID_NDK` to `$ANDROID_HOME/ndk/27.0.11718014` | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Use standard NDK env var naming and document ndk.dir option
ANDROID_NDK isn’t a standard variable. Prefer ANDROID_NDK_ROOT or ndk.dir in android/local.properties to avoid ambiguity. Keep Gradle ndkVersion as the source of truth.
-Define the environment variable `ANDROID_NDK_VERSION` to `27.0.11718014` and `ANDROID_NDK` to `$ANDROID_HOME/ndk/27.0.11718014`
+Define `ANDROID_NDK_VERSION=27.0.11718014` and either:
+- `ANDROID_NDK_ROOT=$ANDROID_HOME/ndk/27.0.11718014`, or
+- set `ndk.dir` in `android/local.properties`.
+Gradle’s `android.ndkVersion` must match the version above.📝 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.
| Install the NDK | |
| ```bash | |
| $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install "ndk;27.0.11718014" | |
| ``` | |
| Define the environment variable `ANDROID_NDK_VERSION` to `27.0.11718014` and `ANDROID_NDK` to `$ANDROID_HOME/ndk/27.0.11718014` | |
| Install the NDK | |
🤖 Prompt for AI Agents
In app/README.md around lines 83 to 90, the docs currently recommend setting a
nonstandard ANDROID_NDK env var; change this to recommend the standard
ANDROID_NDK_ROOT (or documenting adding ndk.dir in android/local.properties) and
explicitly instruct users to keep Gradle's ndkVersion as the source of truth.
Update the instructions to show setting ANDROID_NDK_ROOT to the installed NDK
path (and/or adding a ndk.dir=... line to android/local.properties) and note
that ndkVersion in build.gradle should match that NDK.
| or create it with | ||
|
|
||
| ```bash | ||
| echo sdk.dir=$ANDROID_HOME > android/local.properties | ||
| ``` | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Show ndk.dir in local.properties example to match NDK guidance
This prevents Gradle from resolving the wrong NDK when multiple versions are present.
Create the file `android/local.properties` specifying the SDK directory, for example:
sdk.dir=/path/to/your/android/sdk
+ndk.dir=/path/to/your/android/sdk/ndk/27.0.11718014
or create it with
```bash
echo sdk.dir=$ANDROID_HOME > android/local.properties
+echo ndk.dir=$ANDROID_HOME/ndk/27.0.11718014 >> android/local.properties
<details>
<summary>🤖 Prompt for AI Agents</summary>
In app/README.md around lines 131 to 136, the local.properties example only sets
sdk.dir which can let Gradle pick an unintended NDK; add an ndk.dir entry
showing the expected NDK path and update the shell example to append ndk.dir to
android/local.properties (use the specific ndk path under the SDK, e.g.,
$ANDROID_HOME/ndk/) so Gradle resolves the correct NDK when multiple
versions exist.
</details>
<!-- fingerprinting:phantom:triton:chinchilla -->
<!-- This is an auto-generated comment by CodeRabbit -->
…ed by yarn lint are not the same. we are doomed
There was a problem hiding this 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 (2)
common/src/utils/hash.ts (2)
28-42: Replace Buffer with ethers BytesLike to avoid RN runtime breakageBuffer is not available by default in React Native/Hermes. ethers.sha256/ripemd160 accept hex BytesLike directly; this also removes an extra copy.
- const inputBytes = Buffer.from(solidityPackedUserContextData.slice(2), 'hex'); - const sha256Hash = ethers.sha256(inputBytes); + const sha256Hash = ethers.sha256(solidityPackedUserContextData); const ripemdHash = ethers.ripemd160(sha256Hash); return BigInt(ripemdHash);
131-140: Normalize and validate userID hex; validate destChainIDFile: common/src/utils/hash.ts (lines 131–140)
Lowercase and ensure a 0x prefix, validate the hex with ethers.isHexString before calling zeroPadValue to avoid runtime throws; also validate destChainID is a non-negative safe integer.
- const userIdHex = userID.replace(/-/g, ''); + const userIdHex = userID.replace(/-/g, '').toLowerCase(); + const normalizedUserIdHex = userIdHex.startsWith('0x') ? userIdHex : ('0x' + userIdHex); + if (!ethers.isHexString(normalizedUserIdHex)) { + throw new Error('Invalid userID: expected a hex string (optionally 0x-prefixed) or UUID.'); + } return ethers.solidityPacked( ['bytes32', 'bytes32', 'bytes'], [ ethers.zeroPadValue(ethers.toBeHex(destChainID), 32), - - ethers.zeroPadValue(userIdHex.startsWith('0x') ? userIdHex : '0x' + userIdHex, 32), + ethers.zeroPadValue(normalizedUserIdHex, 32), ethers.toUtf8Bytes(userDefinedData), ] );Also validate destChainID (must be a non-negative safe integer) before calling ethers.toBeHex.
♻️ Duplicate comments (1)
packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.test.ts (1)
50-59: Drop protocol store module mock; set real store state for integration-style tests.Module-mocking the store and spying on getState makes the test brittle and masks regressions. Use the real store and setState to control fixtures per case. This aligns with our test guidelines and avoids module graph pitfalls. (Previously raised—reiterating here for this file.)
-vi.mock('../../src/stores/protocolStore', () => ({ - useProtocolStore: { - getState: () => ({ - passport: { - ofac_trees: 'ofac-tree-data', - commitment_tree: 'commitment-tree-data', - }, - }), - }, -})); +// Remove the module mock; use the real store imported above. @@ -describe('generateTEEInputsDisclose', () => { - beforeEach(() => { - vi.clearAllMocks(); - }); +describe('generateTEEInputsDisclose', () => { + beforeEach(() => { + vi.clearAllMocks(); + // Default happy-path state; individual tests override as needed. + useProtocolStore.setState({ + passport: { + ofac_trees: { + nameAndDob: {}, + nameAndYob: {}, + passportNoAndNationality: {}, + }, + commitment_tree: { root: '0x00' }, + }, + } as any); + }); + afterEach(() => { + vi.restoreAllMocks(); + // Reset to an empty state to avoid leakage across tests. + useProtocolStore.setState({} as any); + }); @@ - it('throws error for unknown document category', () => { - // Mock the store to return an unknown document category - vi.spyOn(useProtocolStore, 'getState').mockReturnValue({ - unknown: undefined - } as any); - - expect(() => generateTEEInputsDisclose(mockSecret, mockPassportData, mockSelfApp)).toThrowError( - `Unknown or unloaded document category in protocol store: passport` - ); - }); + it('throws error for unknown document category', () => { + // Pass a document category that isn't loaded in the store. + const pdUnknown = { ...mockPassportData, documentCategory: 'eu_id_card' } as typeof mockPassportData; + expect(() => generateTEEInputsDisclose(mockSecret, pdUnknown, mockSelfApp)).toThrowError( + 'Unknown or unloaded document category in protocol store: eu_id_card' + ); + }); @@ - it('throws error for unknown tree type', () => { - // This test doesn't make sense as written since tree type is determined internally - // Let's test the commitment tree validation instead - vi.spyOn(useProtocolStore, 'getState').mockReturnValue({ - passport: { - ofac_trees: 'ofac-tree-data', - commitment_tree: undefined, - }, - } as any); - - expect(() => generateTEEInputsDisclose(mockSecret, mockPassportData, mockSelfApp)).toThrowError( - `Commitment tree not loaded` - ); - }); + it('throws error if commitment tree not loaded (guarded path)', () => { + useProtocolStore.setState({ + passport: { + ofac_trees: { + nameAndDob: {}, + nameAndYob: {}, + passportNoAndNationality: {}, + }, + commitment_tree: undefined, + }, + } as any); + expect(() => generateTEEInputsDisclose(mockSecret, mockPassportData, mockSelfApp)).toThrowError( + 'Commitment tree not loaded' + ); + }); @@ - it('throws error if commitment tree not loaded', () => { - vi.spyOn(useProtocolStore, 'getState').mockReturnValue({ - passport: { - ofac_trees: 'ofac-tree-data', - commitment_tree: undefined, - }, - } as any); - - expect(() => generateTEEInputsDisclose(mockSecret, mockPassportData, mockSelfApp)).toThrowError( - `Commitment tree not loaded` - ); - }); + // (Optional) If you keep a second variant, vary the ofac_trees shape to ensure both resolver paths are exercised.Also applies to: 61-65, 71-80, 82-95, 97-108
🧹 Nitpick comments (2)
common/src/utils/aadhaar/assets/dataInput.d.ts (1)
1-3: Avoid shipping large test payloads in production bundlesIf the underlying data string is large, keep it in test-only locations and ensure it’s tree-shaken from production (e.g., move to fixtures, guard imports, or exclude via package “files”/“exports”).
common/src/utils/hash.test.ts (1)
1-45: Add edge-case tests to lock in input validation and cross-runtime behaviorTo prevent silent breakages and ensure portability:
- Invalid userID: non-hex characters or odd-length hex should throw.
- Negative destChainID should throw.
- Very long userDefinedData should still produce a hash (no crash).
- (Optional) Verify results match across Node and RN Hermes if you run tests in both.
Example additions:
+ it('throws on invalid hex userID', () => { + expect(() => calculateUserIdentifierHash(1, 'zzzz', 'x')).toThrow(/Invalid userID/i); + }); + + it('throws on odd-length hex userID', () => { + expect(() => calculateUserIdentifierHash(1, 'abc', 'x')).toThrow(/Invalid userID/i); + }); + + it('throws on negative destChainID', () => { + expect(() => calculateUserIdentifierHash(-1 as unknown as number, '550e8400-e29b-41d4-a716-446655440000', 'x')).toThrow(); + });I can wire these once you confirm the input guards in hash.ts.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (5)
common/src/utils/aadhaar/assets/dataInput.d.ts(1 hunks)common/src/utils/hash.test.ts(1 hunks)common/src/utils/hash.ts(2 hunks)packages/mobile-sdk-alpha/package.json(2 hunks)packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.test.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/mobile-sdk-alpha/package.json
🧰 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:
common/src/utils/aadhaar/assets/dataInput.d.tscommon/src/utils/hash.test.tscommon/src/utils/hash.tspackages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.test.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/utils/aadhaar/assets/dataInput.d.tscommon/src/utils/hash.test.tscommon/src/utils/hash.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/src/utils/hash.test.tspackages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.test.ts
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/processing/generate-disclosure-inputs.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/processing/generate-disclosure-inputs.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/processing/generate-disclosure-inputs.test.ts
🧠 Learnings (14)
📓 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/src/proving/** : Place proof input generation in packages/mobile-sdk-alpha/src/proving/
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}} : Test isPassportDataValid() with realistic synthetic passport data (never real user data)
Applied to files:
packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.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/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/tests/processing/generate-disclosure-inputs.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}} : Write integration tests that exercise the real validation logic (not mocks)
Applied to files:
packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.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/processing/generate-disclosure-inputs.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/processing/generate-disclosure-inputs.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/processing/generate-disclosure-inputs.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}} : Use actual imports from selfxyz/mobile-sdk-alpha in tests
Applied to files:
packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.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}} : 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/processing/generate-disclosure-inputs.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/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/tests/processing/generate-disclosure-inputs.test.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/__setup__/databaseMocks.ts : Provide SQLite testing utilities in tests/__setup__/databaseMocks.ts and use a mock database instance
Applied to files:
packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.test.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/tests/processing/generate-disclosure-inputs.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-alpha/tests/processing/generate-disclosure-inputs.test.ts
📚 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 **/*.{ts,tsx} : Define IdentityCommitment with fields: commitment (Poseidon hash), nullifier (domain-separated), timestamp (UTC number), version (circuit version), documentType ('passport' | 'eu_id_card')
Applied to files:
packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.test.ts
🧬 Code graph analysis (4)
common/src/utils/aadhaar/assets/dataInput.d.ts (1)
common/src/utils/aadhaar/assets/dataInput.ts (1)
testQRData(1-4)
common/src/utils/hash.test.ts (2)
common/src/utils/hash.ts (1)
calculateUserIdentifierHash(28-42)common/src/utils/utils.ts (2)
hash(170-191)uuidToBigInt(383-387)
common/src/utils/hash.ts (1)
common/src/utils/utils.ts (6)
user_identifier(496-514)uuidToBigInt(383-387)bigIntToHex(395-397)hexToBigInt(372-374)castFromUUID(389-393)checkBigInt(376-381)
packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.test.ts (1)
packages/mobile-sdk-alpha/src/processing/generate-disclosure-inputs.ts (1)
generateTEEInputsDisclose(11-30)
🪛 GitHub Actions: Common CI
common/src/utils/aadhaar/assets/dataInput.d.ts
[warning] 1-1: Prettier formatting issues detected in src/utils/aadhaar/assets/dataInput.d.ts. Run 'prettier --write' to fix.
🪛 GitHub Check: lint
packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.test.ts
[warning] 106-106:
Insert ,
[warning] 104-104:
Delete ····
[warning] 93-93:
Insert ,
[warning] 91-91:
Delete ····
[warning] 78-78:
Insert ,
[warning] 76-76:
Delete ····
[warning] 74-74:
Insert ,
[failure] 5-5:
Run autofix to sort these imports!
🪛 GitHub Actions: Mobile SDK CI
packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.test.ts
[warning] 1-1: Code style issues found in tests/processing/generate-disclosure-inputs.test.ts. Run 'yarn workspace @selfxyz/mobile-sdk-alpha prettier --write .' to fix.
⏰ 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). (6)
- GitHub Check: build-android
- GitHub Check: test
- GitHub Check: build-ios
- GitHub Check: analyze-ios
- GitHub Check: analyze-android
- GitHub Check: e2e-ios
🔇 Additional comments (2)
common/src/utils/aadhaar/assets/dataInput.d.ts (1)
1-3: Verify test QR fixture is synthetic and test-onlytestQRData is defined in common/src/utils/aadhaar/assets/dataInput.ts and imported by common/src/utils/aadhaar/mockData.ts and multiple tests (circuits/tests/…). mockData is exported from common/index.ts and could be bundled in published builds — confirm the numeric QR payload is synthetic/non-identifiable. If it contains real Aadhaar PII, remove/redact it or move it to test-only fixtures (or exclude from package exports). This is a blocker if not synthetic.
packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.test.ts (1)
5-5: Unblock CI: enable Corepack (or use Yarn 4.6.0) and run Prettier + ESLint --fixCI failing for style (import order / trailing commas). Local attempt failed due to Yarn/Corepack mismatch — enable Corepack or install Yarn 4.6.0, then run:
# from repo root corepack enable yarn workspace @selfxyz/mobile-sdk-alpha prettier --write packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.test.ts yarn workspace @selfxyz/mobile-sdk-alpha eslint packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.test.ts --fixFile: packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.test.ts
| export declare const testQRData: { | ||
| testQRData: string; | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Eliminate manual declaration drift by tying the .d.ts to the source
Manually duplicating the shape can drift from dataInput.ts. Point the declaration at the source type.
Apply:
-export declare const testQRData: {
- testQRData: string;
-};
+export declare const testQRData: typeof import("./dataInput").testQRData;📝 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.
| export declare const testQRData: { | |
| testQRData: string; | |
| }; | |
| export declare const testQRData: typeof import("./dataInput").testQRData; |
🧰 Tools
🪛 GitHub Actions: Common CI
[warning] 1-1: Prettier formatting issues detected in src/utils/aadhaar/assets/dataInput.d.ts. Run 'prettier --write' to fix.
🤖 Prompt for AI Agents
In common/src/utils/aadhaar/assets/dataInput.d.ts lines 1-3, the file contains a
manual duplicated declaration for testQRData which can drift from the actual
implementation; replace the manual shape with a declaration that references the
implementation in dataInput.ts (e.g., re-export the symbol or declare the const
using typeof import from the source module) so the .d.ts mirrors the real source
type and stays in sync.
Fix Prettier violation to unblock CI
Formatting is failing in CI. Normalize indentation and remove the trailing blank line.
Apply:
-export declare const testQRData: {
- testQRData: string;
-};
+export declare const testQRData: {
+ testQRData: string;
+};
-📝 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.
| export declare const testQRData: { | |
| testQRData: string; | |
| }; | |
| export declare const testQRData: { | |
| testQRData: string; | |
| }; |
🧰 Tools
🪛 GitHub Actions: Common CI
[warning] 1-1: Prettier formatting issues detected in src/utils/aadhaar/assets/dataInput.d.ts. Run 'prettier --write' to fix.
🤖 Prompt for AI Agents
In common/src/utils/aadhaar/assets/dataInput.d.ts around lines 1 to 3, the file
has a Prettier formatting violation: fix indentation to match project style (use
consistent 4-space or configured indentation) and remove the trailing blank line
at EOF so the file ends immediately after the closing semicolon; save with the
repo's Prettier settings (or run npx prettier --write) to ensure CI passes.
packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.test.ts
Show resolved
Hide resolved
packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.test.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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)
common/src/utils/aadhaar/utils.ts (1)
45-64: Fix signing bytes handling and sanitize error logs.forge.md.update is fed via a non-standard encoder; also avoid logging key-related errors verbatim. Use a safe byte conversion and redact details.
Apply:
- const md = forge.md.sha256.create(); - md.update(forge.util.binary.raw.encode(newSignedData)); + const md = forge.md.sha256.create(); + // Convert Uint8Array -> raw byte string for forge + const raw = Array.from(newSignedData, (b) => String.fromCharCode(b)).join(''); + md.update(raw, 'raw'); - const signature = privateKey.sign(md); - const signatureBytes = forge.util.binary.raw.decode(signature); - return new Uint8Array(signatureBytes); + const signature = privateKey.sign(md); + const sigBytes = Uint8Array.from(signature, (ch) => ch.charCodeAt(0)); + return sigBytes; @@ - console.error('Failed to sign data with forge:', error); - throw new Error(`Signing failed: ${error}`); + console.error('Signing failed'); // avoid leaking key/context + throw new Error('Signing failed');
🧹 Nitpick comments (7)
common/index.ts (1)
1-104: Minor: Format the file with PrettierThe file has formatting inconsistencies that should be addressed.
Run the following command to fix the formatting:
prettier --write common/index.tscommon/src/utils/aadhaar/mockData.ts (1)
1-446: Minor: Format the file with PrettierThe file has formatting issues that should be addressed.
Run the following command to fix the formatting:
prettier --write common/src/utils/aadhaar/mockData.tscommon/src/utils/aadhaar/utils.ts (2)
423-441: Clarify timestamp units.timestamp?: string is coerced with +timestamp. If callers pass seconds since epoch, dates will be 1000× off. Accept number | string and document milliseconds. Validate length/scale.
471-479: Re-export util name and type.stringToAsciiArray returns number[]. If consumers expect Uint8Array for hashing/compression paths, consider returning Uint8Array to avoid repeated conversions.
common/src/utils/trees.ts (3)
45-61: Throttle logging in Aadhaar SMT builder.Per-leaf console.log will flood logs on large sets and slow builds. Log every N items or behind a DEBUG flag.
- if (i !== 0) { - console.log('Processing', treetype, 'number', i, 'out of', field.length); - } + if (i !== 0 && i % 1000 === 0) { + console.log('Processing', treetype, 'number', i, 'out of', field.length); + }Also applies to: 88-89
605-615: Validate Aadhaar DOB inputs are numeric and zero-padded.getNameDobLeafAadhaar assumes year/month/day are numeric strings. Guard and normalize (e.g., month ‘8’ -> ‘08’) to prevent divergent hashes.
576-582: Follow-up: “WRONG” TODO on DSC metadata path.This function is flagged as WRONG. Either fix in this PR or open an issue; it’s part of the public leaf derivation surface.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
common/index.ts(3 hunks)common/package.json(1 hunks)common/src/constants/constants.ts(1 hunks)common/src/utils/aadhaar/build_aadhaar_ofac_smt.ts(1 hunks)common/src/utils/aadhaar/mockData.ts(7 hunks)common/src/utils/aadhaar/utils.ts(3 hunks)common/src/utils/bytes.ts(1 hunks)common/src/utils/trees.ts(15 hunks)
✅ Files skipped from review due to trivial changes (1)
- common/src/utils/aadhaar/build_aadhaar_ofac_smt.ts
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{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:
common/src/utils/bytes.tscommon/src/constants/constants.tscommon/src/utils/trees.tscommon/src/utils/aadhaar/utils.tscommon/src/utils/aadhaar/mockData.tscommon/index.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/utils/bytes.tscommon/src/constants/constants.tscommon/src/utils/trees.tscommon/src/utils/aadhaar/utils.tscommon/src/utils/aadhaar/mockData.ts
🧠 Learnings (14)
📓 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/src/proving/** : Place proof input generation in packages/mobile-sdk-alpha/src/proving/
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:30:12.210Z
Learnt from: CR
PR: selfxyz/self#0
File: app/AGENTS.md:0-0
Timestamp: 2025-08-29T15:30:12.210Z
Learning: yarn nice passes (fixes linting and formatting) before PR
Applied to files:
common/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:
common/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:
common/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:
common/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: Use yarn nice, yarn lint, yarn types, yarn test locally before PR
Applied to files:
common/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:
common/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: After review changes, re-run yarn nice, yarn test, yarn types
Applied to files:
common/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 **/*.{ts,tsx} : Define DSCKeyCommitment with fields: publicKeyHash (Poseidon hash), certificateChain (hashes), revocationStatus (boolean), issuer (country code)
Applied to files:
common/src/utils/trees.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:
common/src/utils/trees.tscommon/src/utils/aadhaar/utils.tscommon/src/utils/aadhaar/mockData.tscommon/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:
common/src/utils/aadhaar/utils.tscommon/src/utils/aadhaar/mockData.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:
common/src/utils/aadhaar/mockData.ts
📚 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 **/*.{ts,tsx} : Define IdentityCommitment with fields: commitment (Poseidon hash), nullifier (domain-separated), timestamp (UTC number), version (circuit version), documentType ('passport' | 'eu_id_card')
Applied to files:
common/src/utils/aadhaar/mockData.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:
common/index.ts
🧬 Code graph analysis (5)
common/src/utils/bytes.ts (1)
common/src/utils/utils.ts (1)
bigIntToChunkedBytes(206-218)
common/src/constants/constants.ts (1)
common/index.ts (2)
API_URL(20-20)API_URL_STAGING(21-21)
common/src/utils/trees.ts (3)
common/index.ts (2)
getLeafDscTree(74-74)CertificateData(3-3)common/src/utils/certificate_parsing/dataStructure.ts (1)
CertificateData(3-24)common/src/utils/bytes.ts (1)
packBytes(94-108)
common/src/utils/aadhaar/utils.ts (1)
common/index.ts (2)
generateTestData(96-96)testCustomData(96-96)
common/src/utils/aadhaar/mockData.ts (5)
common/src/utils/aadhaar/utils.ts (2)
calculateAge(71-96)stringToAsciiArray(476-478)common/src/utils/circuits/generateInputs.ts (2)
findIndexInTree(44-55)formatInput(57-77)common/src/utils/trees.ts (4)
generateMerkleProof(170-186)getNameDobLeafAadhaar(605-615)getNameYobLeafAahaar(739-748)generateSMTProof(191-240)common/src/constants/constants.ts (1)
COMMITMENT_TREE_DEPTH(36-36)common/src/utils/bytes.ts (1)
splitToWords(140-153)
🪛 GitHub Actions: Core SDK CI
common/src/utils/bytes.ts
[error] 9-9: TypeScript error TS2339: Property 'valueOf' does not exist on type 'never'.
🪛 GitHub Actions: Contracts CI
common/src/utils/bytes.ts
[error] 9-9: TypeScript error TS2339: Property 'valueOf' does not exist on type 'never'. Build step: 'yarn workspace @selfxyz/common build'.
🪛 GitHub Actions: Mobile E2E
common/src/utils/bytes.ts
[error] 9-9: TypeScript error TS2339: Property 'valueOf' does not exist on type 'never'.
🪛 GitHub Actions: Mobile CI
common/src/utils/bytes.ts
[error] 9-9: Build error: TS2339 - Property 'valueOf' does not exist on type 'never' in src/utils/bytes.ts at line 9, column 64.
🪛 GitHub Actions: Common CI
common/src/utils/bytes.ts
[error] 9-9: TS2339: Property 'valueOf' does not exist on type 'never'.
common/src/constants/constants.ts
[warning] 1-1: Prettier formatting issue detected in 'src/constants/constants.ts'. Run 'prettier --write' to fix.
common/src/utils/trees.ts
[warning] 1-1: Prettier formatting issue detected in 'src/utils/trees.ts'. Run 'prettier --write' to fix.
common/src/utils/aadhaar/utils.ts
[warning] 1-1: Prettier formatting issue detected in 'src/utils/aadhaar/utils.ts'. Run 'prettier --write' to fix.
common/src/utils/aadhaar/mockData.ts
[warning] 1-1: Prettier formatting issue detected in 'src/utils/aadhaar/mockData.ts'. Run 'prettier --write' to fix.
common/index.ts
[warning] 1-1: Prettier formatting issue detected in 'index.ts'. Run 'prettier --write' to fix.
🪛 GitHub Actions: QRCode SDK CI
common/src/utils/bytes.ts
[error] 9-9: Build step 'yarn workspace @selfxyz/common build' failed: src/utils/bytes.ts(9,64): error TS2339: Property 'valueOf' does not exist on type 'never'.
🪛 GitHub Actions: Mobile Bundle Analysis
common/src/utils/bytes.ts
[error] 9-9: TypeScript error TS2339: Property 'valueOf' does not exist on type 'never'.
🪛 GitHub Actions: Mobile SDK CI
common/src/utils/bytes.ts
[error] 9-9: Build step 'yarn workspace @selfxyz/common build' failed with TS2339: Property 'valueOf' does not exist on type 'never' (src/utils/bytes.ts:9).
🪛 GitHub Actions: Web CI
common/src/utils/bytes.ts
[error] 9-9: TypeScript error TS2339: Property 'valueOf' does not exist on type 'never'. (during build step: 'yarn workspace @selfxyz/common build')
🔇 Additional comments (6)
common/package.json (1)
650-652: LGTM: scripts aligned to Yarn 4 execution model.This switch to
yarn eslint ...is consistent with the repo’spackageManager: "[email protected]". Please ensure CI runners enable Corepack and use Yarn 4 to avoid PATH resolution issues for binaries.common/src/constants/constants.ts (1)
4-4: Confirm single source of truth for Aadhaar attestation ID
- TS: single declaration at common/src/constants/constants.ts:4 (export const AADHAAR_ATTESTATION_ID = '3'); all TypeScript imports reference it (e.g., contracts/test/v2/discloseAadhaar.test.ts, registerAadhaar.test.ts).
- Solidity: equivalent numeric value is defined in contracts/contracts/constants/AttestationId.sol (AADHAAR = bytes32(uint256(3))). Ensure on-chain and TS values stay synchronized — centralize generation or add a CI/assertion that they match.
common/src/utils/aadhaar/mockData.ts (1)
165-285: Validate cryptographic inputs and merkle-tree state before useFile: common/src/utils/aadhaar/mockData.ts — prepareAadhaarDiscloseTestData (≈lines 165–285). Automated search didn't show existing checks; confirm/implement the items below.
- Validate selector (whitelist/enum or regex) before accepting/using it.
- Ensure scope and user_identifier are valid numeric/hex strings and within expected ranges before calling BigInt(...) — reject or sanitize invalid values and catch BigInt errors.
- Verify merkletree integrity: confirm merkletree.root exists, insertion (if updateTree) succeeded, and findIndexInTree returned a valid index (not -1) before generateMerkleProof; validate leaf_depth/path/siblings lengths.
- Assert sharedData.extractedFields required fields (name, dob/mob/yob, photoHash, aadhaarLast4Digits, pincode, state) are present/formatted before computing nullifier/commitment.
Add clear fail-fast errors and unit tests for these cases.
common/src/utils/aadhaar/utils.ts (2)
169-176: Possible off-by-one in photo randomization.You compute photoLength = dataLength - begin and replace [begin+1, begin+photoLength-1] with getRandomBytes(photoLength - 1). Verify replaceBytesBetween semantics (inclusive vs exclusive) to avoid truncation/corruption.
1-1: Prettier formatting applied — file reformatted.
Ran: npx prettier --write common/src/utils/aadhaar/utils.ts; file was reformatted and should unblock CI.common/src/utils/trees.ts (1)
1-1: Run Prettier to fix CI formatting errorCI reports a Prettier failure for common/src/utils/trees.ts; the previous attempt failed with "ERROR --workspace-root may only be used inside a workspace". Run and commit one of these locally:
pnpm exec prettier --write common/src/utils/trees.ts
npx prettier --write common/src/utils/trees.tsPush the formatted file and re-run CI.
| if (updateTree) { | ||
| merkletree.insert(BigInt(commitment)); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Tree mutation without thread safety considerations
The function conditionally mutates the merkletree parameter when updateTree is true. This in-place mutation could cause issues in concurrent scenarios or when the tree is shared across multiple operations.
Consider:
- Documenting that this function mutates the input tree
- Using a copy-on-write pattern if the tree might be shared
- Adding a mutex or synchronization mechanism if this could be called concurrently
/**
* @param merkletree - The Merkle tree (will be mutated if updateTree is true)
* @param updateTree - If true, inserts the commitment into the tree
*/🤖 Prompt for AI Agents
In common/src/utils/aadhaar/mockData.ts around lines 212 to 214, the code
mutates the supplied merkletree in-place when updateTree is true which can cause
race conditions or unexpected side-effects; update the function to (1) document
that merkletree will be mutated when updateTree is true by adding a JSDoc
comment on the parameter, (2) adopt copy-on-write semantics when callers may
share the tree by cloning/creating a new tree instance, inserting the commitment
into the clone and returning it (or clearly returning the mutated tree), and (3)
if this function can be called concurrently on the same tree, add a
synchronization mechanism (e.g., a mutex around the insert) or require callers
to hold external synchronization—pick one approach and apply it consistently,
update any call sites or types to reflect returning a new tree vs mutating in
place, and add a unit test for both behaviors.
| ofac_name_yob_smt_siblings: formatInput(ofac_name_yob_smt_siblings), | ||
| selector, | ||
| minimumAge: formatInput(age - 2), | ||
| currentYear: formatInput(currentYear), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential underflow risk in age calculation
The minimumAge is calculated as age - 2 without checking if age is at least 2. This could result in a negative value or underflow if age is less than 2.
Add validation to prevent negative minimum age:
- minimumAge: formatInput(age - 2),
+ minimumAge: formatInput(Math.max(0, age - 2)),Or throw an error if the age is too low for the operation:
+ if (age < 2) {
+ throw new Error('Age must be at least 2 for this operation');
+ }
minimumAge: formatInput(age - 2),📝 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.
| minimumAge: formatInput(age - 2), | |
| minimumAge: formatInput(Math.max(0, age - 2)), |
🤖 Prompt for AI Agents
In common/src/utils/aadhaar/mockData.ts around line 271, the minimumAge is set
to formatInput(age - 2) without validating age; add a guard so age - 2 cannot
become negative — either validate age first and throw a descriptive error if age
< 2, or clamp the result (e.g., use Math.max(age - 2, 0) before formatting) and
ensure formatInput receives a non-negative value; update any tests or callers as
needed to reflect the chosen behavior.
| @@ -1,27 +1,45 @@ | |||
| import forge from 'node-forge'; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Avoid node-forge in shared “common” code; prefer native crypto or isolate to Node-only.
node-forge inflates bundles and requires shims in React Native. Either:
- move signing to a Node-only helper (used in tests/CLI), or
- implement using WebCrypto (globalThis.crypto.subtle) with a Node fallback.
This prevents runtime/polyfill issues in mobile/web builds.
🧰 Tools
🪛 GitHub Actions: Common CI
[warning] 1-1: Prettier formatting issue detected in 'src/utils/aadhaar/utils.ts'. Run 'prettier --write' to fix.
🤖 Prompt for AI Agents
common/src/utils/aadhaar/utils.ts lines 1-1: the file currently imports
node-forge which bloats bundles and breaks RN/web; remove the node-forge import
and either (A) replace the signing/crypto routines with WebCrypto APIs (use
globalThis.crypto.subtle for browsers and fallback to Node's crypto.webcrypto or
createKey/importKey/subtle.sign/verify equivalents) ensuring data
encoding/format (ArrayBuffer/Uint8Array) matches existing behavior, or (B) move
the node-forge-based signing code into a Node-only helper (e.g., common-node or
server/utils) and update callers to import the Node-only helper where
appropriate; implement one of these paths and update exports/tests so that
shared/common code no longer imports node-forge and mobile/web bundles don’t
require shims.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point. this is file was just reorganized by lint. not new so i wont do this now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aaronmgdr Understood! You're absolutely right to keep the scope focused. Since this is existing code that was just reorganized, it makes perfect sense to defer the node-forge refactoring to a separate effort. Thanks for the clarification.
(\ /)
( ._. )
o_(")(")
understanding nod
🧠 Learnings used
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
| export const generateTestData = ({ | ||
| privKeyPem, | ||
| data, | ||
| dob, | ||
| gender, | ||
| pincode, | ||
| state, | ||
| photo, | ||
| name, | ||
| timestamp, | ||
| }: { | ||
| privKeyPem: string; | ||
| data: string; | ||
| dob?: string; | ||
| gender?: string; | ||
| pincode?: string; | ||
| state?: string; | ||
| photo?: boolean; | ||
| name?: string; | ||
| timestamp?: string; | ||
| }) => { | ||
| const qrDataBytes = convertBigIntToByteArray(BigInt(data)); | ||
| const decodedData = decompressByteArray(qrDataBytes); | ||
|
|
||
| // Turning test data V1 into V2 | ||
| // Adding the version specifier prefix, | ||
| // the last 4 digits of phone number and timestamp to now | ||
| const dataToSign = createCustomV2TestData({ | ||
| signedData: decodedData.slice(0, decodedData.length - 256), | ||
| dob, | ||
| pincode, | ||
| gender, | ||
| state, | ||
| photo, | ||
| name, | ||
| timestamp, | ||
| }); | ||
|
|
||
| // Signing the newly generated testData | ||
| const signature = signNewTestData(dataToSign, privKeyPem); | ||
|
|
||
| // Reconstructing the whole QR data | ||
| const tempData = Buffer.concat([dataToSign, signature]); | ||
|
|
||
| // Compressing the data to have it in the same format as the QR code | ||
| const newCompressedData = rawDataToCompressedQR(tempData); | ||
| const newQrData = { | ||
| testQRData: newCompressedData.toString(), | ||
| ...returnFullId(dataToSign), | ||
| }; | ||
|
|
||
| return newQrData; | ||
| }; | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace Buffer.concat with Uint8Array to keep RN/web compatibility.
Buffer is Node-only and will break/require shims in React Native/web.
- const tempData = Buffer.concat([dataToSign, signature]);
+ const tempData = new Uint8Array(dataToSign.length + signature.length);
+ tempData.set(dataToSign, 0);
+ tempData.set(signature, dataToSign.length);If rawDataToCompressedQR expects Buffer, consider overloading to accept Uint8Array (or wrap once at the callsite where Node is guaranteed).
📝 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.
| export const generateTestData = ({ | |
| privKeyPem, | |
| data, | |
| dob, | |
| gender, | |
| pincode, | |
| state, | |
| photo, | |
| name, | |
| timestamp, | |
| }: { | |
| privKeyPem: string; | |
| data: string; | |
| dob?: string; | |
| gender?: string; | |
| pincode?: string; | |
| state?: string; | |
| photo?: boolean; | |
| name?: string; | |
| timestamp?: string; | |
| }) => { | |
| const qrDataBytes = convertBigIntToByteArray(BigInt(data)); | |
| const decodedData = decompressByteArray(qrDataBytes); | |
| // Turning test data V1 into V2 | |
| // Adding the version specifier prefix, | |
| // the last 4 digits of phone number and timestamp to now | |
| const dataToSign = createCustomV2TestData({ | |
| signedData: decodedData.slice(0, decodedData.length - 256), | |
| dob, | |
| pincode, | |
| gender, | |
| state, | |
| photo, | |
| name, | |
| timestamp, | |
| }); | |
| // Signing the newly generated testData | |
| const signature = signNewTestData(dataToSign, privKeyPem); | |
| // Reconstructing the whole QR data | |
| const tempData = Buffer.concat([dataToSign, signature]); | |
| // Compressing the data to have it in the same format as the QR code | |
| const newCompressedData = rawDataToCompressedQR(tempData); | |
| const newQrData = { | |
| testQRData: newCompressedData.toString(), | |
| ...returnFullId(dataToSign), | |
| }; | |
| return newQrData; | |
| }; | |
| export const generateTestData = ({ | |
| privKeyPem, | |
| data, | |
| dob, | |
| gender, | |
| pincode, | |
| state, | |
| photo, | |
| name, | |
| timestamp, | |
| }: { | |
| privKeyPem: string; | |
| data: string; | |
| dob?: string; | |
| gender?: string; | |
| pincode?: string; | |
| state?: string; | |
| photo?: boolean; | |
| name?: string; | |
| timestamp?: string; | |
| }) => { | |
| const qrDataBytes = convertBigIntToByteArray(BigInt(data)); | |
| const decodedData = decompressByteArray(qrDataBytes); | |
| // Turning test data V1 into V2 | |
| // Adding the version specifier prefix, | |
| // the last 4 digits of phone number and timestamp to now | |
| const dataToSign = createCustomV2TestData({ | |
| signedData: decodedData.slice(0, decodedData.length - 256), | |
| dob, | |
| pincode, | |
| gender, | |
| state, | |
| photo, | |
| name, | |
| timestamp, | |
| }); | |
| // Signing the newly generated testData | |
| const signature = signNewTestData(dataToSign, privKeyPem); | |
| // Reconstructing the whole QR data | |
| const tempData = new Uint8Array(dataToSign.length + signature.length); | |
| tempData.set(dataToSign, 0); | |
| tempData.set(signature, dataToSign.length); | |
| // Compressing the data to have it in the same format as the QR code | |
| const newCompressedData = rawDataToCompressedQR(tempData); | |
| const newQrData = { | |
| testQRData: newCompressedData.toString(), | |
| ...returnFullId(dataToSign), | |
| }; | |
| return newQrData; | |
| }; |
🤖 Prompt for AI Agents
In common/src/utils/aadhaar/utils.ts around lines 360 to 413, the code uses
Buffer.concat which is Node-only and breaks React Native/web; replace the
Buffer.concat call with a Uint8Array-based concatenation (allocate a new
Uint8Array of combined length and set the two source Uint8Array/ArrayBuffer
slices into it) so the result is a plain Uint8Array; then pass that Uint8Array
to rawDataToCompressedQR and returnFullId, or if those helpers require Buffer,
wrap to Buffer only at a Node-only boundary or add an overload to accept
Uint8Array and convert internally — ensure types are updated accordingly so the
module remains RN/web compatible.
| export function returnNewDateString(timestamp?: string): string { | ||
| const newDate = timestamp ? new Date(+timestamp) : new Date(); | ||
|
|
||
| // Convert the UTC date to IST by adding 5 hours and 30 minutes | ||
| const offsetHours = 5; | ||
| const offsetMinutes = 30; | ||
| newDate.setUTCHours(newDate.getUTCHours() + offsetHours); | ||
| newDate.setUTCMinutes(newDate.getUTCMinutes() + offsetMinutes); | ||
|
|
||
| return ( | ||
| newDate.getUTCFullYear().toString() + | ||
| (newDate.getUTCMonth() + 1).toString().padStart(2, '0') + | ||
| newDate.getUTCDate().toString().padStart(2, '0') + | ||
| newDate.getUTCHours().toString().padStart(2, '0') + | ||
| newDate.getUTCMinutes().toString().padStart(2, '0') + | ||
| newDate.getUTCSeconds().toString().padStart(2, '0') + | ||
| newDate.getUTCMilliseconds().toString().padStart(3, '0') | ||
| ); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Timestamp format mismatch (generator vs extractor).
returnNewDateString emits YYYYMMDDHHMMSSmmm (17 chars), while extractQRDataFields assembles only YYYY-MM-DD HH:MM. This is brittle and can decode the wrong positions.
Two options (pick one and align tests):
- Emit 12-digit YYYYMMDDHHMM in returnNewDateString, or
- Update extraction to parse 14–17 digits robustly before formatting.
Proposed generator change:
- newDate.getUTCHours().toString().padStart(2, '0') +
- newDate.getUTCMinutes().toString().padStart(2, '0') +
- newDate.getUTCSeconds().toString().padStart(2, '0') +
- newDate.getUTCMilliseconds().toString().padStart(3, '0')
+ newDate.getUTCHours().toString().padStart(2, '0') +
+ newDate.getUTCMinutes().toString().padStart(2, '0')Also ensure the IST offset logic isn’t applied twice when a custom timestamp is already in IST.
Also applies to: 308-335
🏁 Script executed:
#!/bin/bash
set -euo pipefail
TARGET="common/src/utils/aadhaar/utils.ts"
echo "PWD: $(pwd)"
echo "Checking for $TARGET ..."
if [ ! -f "$TARGET" ]; then
echo "FILE_NOT_FOUND: $TARGET"
rg -n --hidden --glob '!*node_modules/**' "returnNewDateString|extractQRDataFields" || true
exit 0
fi
echo "---- Matches for function names in file ----"
rg -n --hidden --glob '!*node_modules/**' "returnNewDateString|extractQRDataFields" "$TARGET" || true
echo
echo "---- $TARGET : lines 300-340 (covers 308-335) ----"
nl -ba "$TARGET" | sed -n '300,340p'
echo
echo "---- $TARGET : lines 420-445 (covers 423-441) ----"
nl -ba "$TARGET" | sed -n '420,445p'
echo
echo "---- Search repo for other date-formatting / UTC helpers ----"
rg -n --hidden --glob '!*node_modules/**' "getUTC|setUTC|getUTCHours|getUTCMinutes|getUTCMilliseconds|getUTCSeconds|padStart\\(" || true
echo
echo "---- Search repo for numeric timestamp-like literals (12-17 digits) ----"
rg -n --hidden --glob '!*node_modules/**' -P '\\b\\d{12,17}\\b' || true
echo "done"Length of output: 457
🏁 Script executed:
#!/bin/bash
set -euo pipefail
TARGET="common/src/utils/aadhaar/utils.ts"
if [ ! -f "$TARGET" ]; then
echo "FILE_NOT_FOUND"
rg -n --hidden --glob '!*node_modules/**' "returnNewDateString|extractQRDataFields" || true
exit 0
fi
echo "=== FILE: $TARGET ==="
echo
echo "=== LINES 1-220 ==="
sed -n '1,220p' "$TARGET"
echo
echo "=== LINES 221-360 ==="
sed -n '221,360p' "$TARGET"
echo
echo "=== LINES 361-520 ==="
sed -n '361,520p' "$TARGET"
echo
echo "=== getUTC / setUTC / padStart occurrences ==="
rg -n --hidden --glob '!*node_modules/**' "getUTC|setUTC|getUTCHours|getUTCMinutes|getUTCMilliseconds|getUTCSeconds|padStart\\(" "$TARGET" || trueLength of output: 16576
Fix timestamp format mismatch between generator and extractor
- returnNewDateString (common/src/utils/aadhaar/utils.ts — lines 423–441) emits YYYYMMDDHHMMSSmmm (17 chars). extractQRDataFields (same file — lines ~252–333) expects YYYYMMDDHHMM (12 chars) and assembles "YYYY-MM-DD HH:MM"; this will read wrong byte positions and produce incorrect timestamps.
- Options (choose one and align tests):
- Generator change (recommended minimal fix): make returnNewDateString emit 12-digit YYYYMMDDHHMM by removing seconds and milliseconds. Replace the seconds+ms lines with only hours+minutes.
- Extractor change: parse the timestamp field robustly — read the contiguous numeric bytes between delimiters, accept 12–17 digits, then extract substrings (YYYY=0..4, MM=4..6, DD=6..8, hh=8..10, mm=10..12) to build the formatted timestamp.
- Also ensure IST offset isn't applied twice: createCustomV2TestData calls returnNewDateString (newDateString set at line ~147); returnNewDateString currently adds +5:30 unconditionally — verify incoming timestamp semantics (epoch-ms vs already-local) and avoid double-offsetting.
common/src/utils/aadhaar/utils.ts — actionable locations: newDateString usage at line ~147; extractQRDataFields at ~252; returnNewDateString at 423–441.
| export function getLeafDscTree(dsc_parsed: CertificateData, csca_parsed: CertificateData): string { | ||
| const dscLeaf = getLeaf(dsc_parsed, 'dsc'); | ||
| const cscaLeaf = getLeaf(csca_parsed, 'csca'); | ||
| return poseidon2([dscLeaf, cscaLeaf]).toString(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: hashing strings instead of bigint in DSC+CSCA leaf.
poseidon2 expects bigint inputs; dscLeaf/cscaLeaf are strings.
-export function getLeafDscTree(dsc_parsed: CertificateData, csca_parsed: CertificateData): string {
- const dscLeaf = getLeaf(dsc_parsed, 'dsc');
- const cscaLeaf = getLeaf(csca_parsed, 'csca');
- return poseidon2([dscLeaf, cscaLeaf]).toString();
+export function getLeafDscTree(dsc_parsed: CertificateData, csca_parsed: CertificateData): string {
+ const dscLeaf = BigInt(getLeaf(dsc_parsed, 'dsc'));
+ const cscaLeaf = BigInt(getLeaf(csca_parsed, 'csca'));
+ return poseidon2([dscLeaf, cscaLeaf]).toString();
}Add a unit test to catch this.
📝 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.
| export function getLeafDscTree(dsc_parsed: CertificateData, csca_parsed: CertificateData): string { | |
| const dscLeaf = getLeaf(dsc_parsed, 'dsc'); | |
| const cscaLeaf = getLeaf(csca_parsed, 'csca'); | |
| return poseidon2([dscLeaf, cscaLeaf]).toString(); | |
| } | |
| export function getLeafDscTree(dsc_parsed: CertificateData, csca_parsed: CertificateData): string { | |
| const dscLeaf = BigInt(getLeaf(dsc_parsed, 'dsc')); | |
| const cscaLeaf = BigInt(getLeaf(csca_parsed, 'csca')); | |
| return poseidon2([dscLeaf, cscaLeaf]).toString(); | |
| } |
🤖 Prompt for AI Agents
In common/src/utils/trees.ts around lines 566 to 570, getLeafDscTree calls
poseidon2 with dscLeaf and cscaLeaf which are strings but poseidon2 requires
bigint inputs; convert both values to bigint (e.g., BigInt(dscLeaf) and
BigInt(cscaLeaf)) before calling poseidon2 (or update getLeaf to return bigint),
and return the resulting hash as a string as before. Also add a unit test that
supplies known certificate leaves as string values and asserts the returned hash
equals the expected poseidon2 result to prevent regressions.
| export function getPassportNumberAndNationalityLeaf( | ||
| passport: (bigint | number)[], | ||
| nationality: (bigint | number)[], | ||
| i?: number | ||
| ): bigint { | ||
| if (passport.length !== 9) { | ||
| console.log('parsed passport length is not 9:', i, passport); | ||
| return; | ||
| } | ||
| if (nationality.length !== 3) { | ||
| console.log('parsed nationality length is not 3:', i, nationality); | ||
| return; | ||
| } | ||
| try { | ||
| const fullHash = poseidon12(passport.concat(nationality)); | ||
| return generateSmallKey(fullHash); | ||
| } catch (err) { | ||
| console.log('err : passport', err, i, passport); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Ensure consistent return types and minimize PII in logs.
Return BigInt(0) on invalid inputs instead of undefined, and avoid logging raw passport/nationality values.
if (passport.length !== 9) {
- console.log('parsed passport length is not 9:', i, passport);
- return;
+ console.log('parsed passport length is not 9:', i);
+ return BigInt(0);
}
if (nationality.length !== 3) {
- console.log('parsed nationality length is not 3:', i, nationality);
- return;
+ console.log('parsed nationality length is not 3:', i);
+ return BigInt(0);
}
try {
const fullHash = poseidon12(passport.concat(nationality));
return generateSmallKey(fullHash);
} catch (err) {
- console.log('err : passport', err, i, passport);
+ console.log('err : passport hashing failed', i);
+ return BigInt(0);
}📝 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.
| export function getPassportNumberAndNationalityLeaf( | |
| passport: (bigint | number)[], | |
| nationality: (bigint | number)[], | |
| i?: number | |
| ): bigint { | |
| if (passport.length !== 9) { | |
| console.log('parsed passport length is not 9:', i, passport); | |
| return; | |
| } | |
| if (nationality.length !== 3) { | |
| console.log('parsed nationality length is not 3:', i, nationality); | |
| return; | |
| } | |
| try { | |
| const fullHash = poseidon12(passport.concat(nationality)); | |
| return generateSmallKey(fullHash); | |
| } catch (err) { | |
| console.log('err : passport', err, i, passport); | |
| } | |
| } | |
| export function getPassportNumberAndNationalityLeaf( | |
| passport: (bigint | number)[], | |
| nationality: (bigint | number)[], | |
| i?: number | |
| ): bigint { | |
| if (passport.length !== 9) { | |
| console.log('parsed passport length is not 9:', i); | |
| return BigInt(0); | |
| } | |
| if (nationality.length !== 3) { | |
| console.log('parsed nationality length is not 3:', i); | |
| return BigInt(0); | |
| } | |
| try { | |
| const fullHash = poseidon12(passport.concat(nationality)); | |
| return generateSmallKey(fullHash); | |
| } catch (err) { | |
| console.log('err : passport hashing failed', i); | |
| return BigInt(0); | |
| } | |
| } |
🤖 Prompt for AI Agents
In common/src/utils/trees.ts around lines 750 to 769, the function sometimes
returns undefined and logs raw passport/nationality arrays; change it to always
return BigInt(0) on invalid input or on error, and stop printing raw PII — log
only context (e.g., index i, expected vs actual lengths, or a masked/hashed
identifier). Specifically: when passport.length !== 9 or nationality.length !==
3 return BigInt(0) and replace the console logs with messages that do not
include the arrays (e.g., log i and lengths); in the catch block return
BigInt(0) and log the error plus non-PII context instead of the raw
passport/nationality.
There was a problem hiding this 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
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (5)
common/src/utils/bytes.ts (5)
10-13: Bytes vs bits: mask/shift use bits; parameter is in bytes
bytesPerChunkis documented as bytes, but mask/shift treat it as bits. This will extract the wrong slices and can corrupt data.- const msk = (1n << BigInt(bytesPerChunk)) - 1n; - for (let i = 0; i < numChunks; ++i) { - res.push(((bigintNum >> BigInt(i * bytesPerChunk)) & msk).toString()); - } + const msk = (1n << (8n * BigInt(bytesPerChunk))) - 1n; + for (let i = 0; i < numChunks; ++i) { + const shift = BigInt(i) * 8n * BigInt(bytesPerChunk); + res.push(((bigintNum >> shift) & msk).toString()); + }
94-108: Type the API and validate inputs in packBytesMissing types and range checks can propagate bad data into bigints.
-export function packBytes(unpacked) { +export function packBytes(unpacked: number[]): bigint[] { + for (const b of unpacked) { + if (!Number.isInteger(b) || b < 0 || b > 255) { + throw new Error('packBytes: byte values must be integers in [0,255]'); + } + } const bytesCount = [31, 31, 31]; const packed = [0n, 0n, 0n];
63-70: Guard against odd-length hex strings (silent truncation bug)Looping to
length - 1silently drops the last nibble on odd inputs; fail fast instead.-export function hexToSignedBytes(hexString: string): number[] { +export function hexToSignedBytes(hexString: string): number[] { const bytes = []; - for (let i = 0; i < hexString.length - 1; i += 2) { - const byte = parseInt(hexString.substr(i, 2), 16); + if (hexString.length % 2 !== 0) { + throw new Error('hexToSignedBytes: hexString must have even length'); + } + for (let i = 0; i < hexString.length; i += 2) { + const byte = parseInt(hexString.slice(i, i + 2), 16); bytes.push(byte >= 128 ? byte - 256 : byte); } return bytes; }
42-49: Apply the same even-length check to hexStringToSignedIntArraySame truncation risk as above; validate input.
export function hexStringToSignedIntArray(hexString: string) { const result = []; - for (let i = 0; i < hexString.length; i += 2) { - const byte = parseInt(hexString.substr(i, 2), 16); + if (hexString.length % 2 !== 0) { + throw new Error('hexStringToSignedIntArray: hexString must have even length'); + } + for (let i = 0; i < hexString.length; i += 2) { + const byte = parseInt(hexString.slice(i, i + 2), 16); result.push(byte > 127 ? byte - 256 : byte); } return result; }
140-151: Avoid Number/Math.pow with BigInt; use shifts and throw Error objectsUsing Number in BigInt math risks precision bugs; shifting is exact and faster. Also throw
Error, not strings.export function splitToWords(number: bigint, wordsize: number, numberElement: number) { let t = number; const words: string[] = []; for (let i = 0; i < numberElement; ++i) { - const baseTwo = BigInt(2); - - words.push(`${t % BigInt(Math.pow(Number(baseTwo), wordsize))}`); - t = BigInt(t / BigInt(Math.pow(Number(BigInt(2)), wordsize))); + const basePow = 1n << BigInt(wordsize); // 2^wordsize + words.push(`${t % basePow}`); + t = t / basePow; } - if (!(t == BigInt(0))) { - throw `Number ${number} does not fit in ${(wordsize * numberElement).toString()} bits`; + if (t !== 0n) { + throw new Error(`Number ${number} does not fit in ${(wordsize * numberElement).toString()} bits`); } return words; }
♻️ Duplicate comments (6)
common/src/utils/bytes.ts (1)
4-9: Fix redundant bigint union and unreachable coercionParam type
bigint | bigintis redundant and keeps the unnecessary coercion branch alive. Standardize to primitivebigintand drop the fallback.-export function bigIntToChunkedBytes( - num: bigint | bigint, +export function bigIntToChunkedBytes( + num: bigint, bytesPerChunk: number, numChunks: number ) { const res: string[] = []; - const bigintNum: bigint = typeof num == 'bigint' ? num : BigInt(num); + const bigintNum: bigint = num;packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.test.ts (5)
13-14: Import from the public SDK entrypoint to keep tests aligned with the supported API surface.Using internal source paths is brittle and breaks during refactors. Import
generateTEEInputsDisclosefrom@selfxyz/mobile-sdk-alpha.Apply:
-import { generateTEEInputsDisclose } from '../../src/processing/generate-disclosure-inputs'; +import { generateTEEInputsDisclose } from '@selfxyz/mobile-sdk-alpha';Verify the export exists:
#!/bin/bash rg -nP -C2 '\bexport\b[^{]*\{[^}]*\bgenerateTEEInputsDisclose\b' packages/mobile-sdk-alpha/src/index.ts
91-104: Avoid module-level mocks of the protocol store; use the real store and set state directly.Module mocks are fragile and mask integration issues. Set up default store state in
beforeEachand reset inafterEach.-vi.mock('../../src/stores/protocolStore', () => ({ - useProtocolStore: { - getState: () => ({ - passport: { - ofac_trees: { - nameAndDob: '{"root":["0"]}', - nameAndYob: '{"root":["0"]}', - passportNoAndNationality: '{"root":["0"]}', - }, - commitment_tree: '[[]]', - }, - }), - }, -})); +// Use the real store; default happy-path state for tests can be set in beforeEach. describe('generateTEEInputsDisclose', () => { beforeEach(() => { - vi.clearAllMocks(); + vi.clearAllMocks(); + useProtocolStore.setState({ + passport: { + ofac_trees: { + nameAndDob: '{"root":["0"]}', + nameAndYob: '{"root":["0"]}', + passportNoAndNationality: '{"root":["0"]}', + }, + commitment_tree: '[[]]', + }, + } as any); });Add teardown (outside the shown range):
import { afterEach } from 'vitest'; afterEach(() => { useProtocolStore.setState({ passport: undefined } as any); });Also applies to: 107-109
110-119: Prefer real store state over spying ongetStatefor the unknown-document case.Directly set the state so
passportis absent, which exercises the wrapper’s guard reliably.- // Mock the store to return an unknown document category - vi.spyOn(useProtocolStore, 'getState').mockReturnValue({ - unknown: undefined, - } as any); + // No 'passport' slice -> wrapper should throw "Unknown or unloaded ..." + useProtocolStore.setState({ passport: undefined } as any);
136-147: Fix the assertion: the wrapper throws “Commitment tree not loaded”; current expectation is for a deeper OFAC-structure error.Set a valid OFAC structure and assert the wrapper’s explicit error for the missing commitment tree.
- it('throws error if commitment tree not loaded', () => { - vi.spyOn(useProtocolStore, 'getState').mockReturnValue({ - passport: { - ofac_trees: 'ofac-tree-data', - commitment_tree: undefined, - }, - } as any); - - expect(() => generateTEEInputsDisclose(mockSecret, mockPassportData, mockSelfApp)).toThrowError( - `Invalid OFAC tree structure: missing required fields`, - ); - }); + it('throws error if commitment tree not loaded', () => { + useProtocolStore.setState({ + passport: { + ofac_trees: { + nameAndDob: '{"root":["0"]}', + nameAndYob: '{"root":["0"]}', + passportNoAndNationality: '{"root":["0"]}', + }, + commitment_tree: undefined, + }, + } as any); + + expect(() => generateTEEInputsDisclose(mockSecret, mockPassportData, mockSelfApp)) + .toThrowError(/Commitment tree not loaded/); + });
9-9: Add afterEach to the Vitest imports (required for teardown above).-import { beforeEach, describe, expect, it, vi } from 'vitest'; +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
common/index.ts(3 hunks)common/src/utils/aadhaar/constants.ts(1 hunks)common/src/utils/bytes.ts(1 hunks)packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.test.ts(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- common/src/utils/aadhaar/constants.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- common/index.ts
🧰 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:
common/src/utils/bytes.tspackages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.test.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/utils/bytes.ts
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/processing/generate-disclosure-inputs.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/processing/generate-disclosure-inputs.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/processing/generate-disclosure-inputs.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/processing/generate-disclosure-inputs.test.ts
🧠 Learnings (14)
📓 Common learnings
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/proving/** : Place proof input generation in packages/mobile-sdk-alpha/src/proving/
📚 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/processing/generate-disclosure-inputs.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/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/tests/processing/generate-disclosure-inputs.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/processing/generate-disclosure-inputs.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/processing/generate-disclosure-inputs.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}} : Write integration tests that exercise the real validation logic (not mocks)
Applied to files:
packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.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/processing/generate-disclosure-inputs.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}} : Use actual imports from selfxyz/mobile-sdk-alpha in tests
Applied to files:
packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.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/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/tests/processing/generate-disclosure-inputs.test.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/__setup__/databaseMocks.ts : Provide SQLite testing utilities in tests/__setup__/databaseMocks.ts and use a mock database instance
Applied to files:
packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.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}} : 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/processing/generate-disclosure-inputs.test.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/tests/processing/generate-disclosure-inputs.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-alpha/tests/processing/generate-disclosure-inputs.test.ts
📚 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 **/*.{ts,tsx} : Define IdentityCommitment with fields: commitment (Poseidon hash), nullifier (domain-separated), timestamp (UTC number), version (circuit version), documentType ('passport' | 'eu_id_card')
Applied to files:
packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.test.ts
🧬 Code graph analysis (2)
common/src/utils/bytes.ts (1)
common/src/utils/utils.ts (1)
bigIntToChunkedBytes(206-218)
packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.test.ts (1)
packages/mobile-sdk-alpha/src/processing/generate-disclosure-inputs.ts (1)
generateTEEInputsDisclose(11-30)
| it('throws error for unknown tree type', () => { | ||
| // This test doesn't make sense as written since tree type is determined internally | ||
| // Let's test the commitment tree validation instead | ||
| vi.spyOn(useProtocolStore, 'getState').mockReturnValue({ | ||
| passport: { | ||
| ofac_trees: 'ofac-tree-data', | ||
| commitment_tree: undefined, | ||
| }, | ||
| } as any); | ||
|
|
||
| expect(() => generateTEEInputsDisclose(mockSecret, mockPassportData, mockSelfApp)).toThrowError( | ||
| `Invalid OFAC tree structure: missing required fields`, | ||
| ); | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Remove or rewrite this test: “unknown tree type” cannot be triggered via the public wrapper.
The wrapper delegates tree selection to the stateless generator, so asserting an “unknown tree type” error couples to internals and is non-deterministic. Either delete this test or repurpose it to validate a wrapper-level guard.
- it('throws error for unknown tree type', () => {
- // This test doesn't make sense as written since tree type is determined internally
- // Let's test the commitment tree validation instead
- vi.spyOn(useProtocolStore, 'getState').mockReturnValue({
- passport: {
- ofac_trees: 'ofac-tree-data',
- commitment_tree: undefined,
- },
- } as any);
-
- expect(() => generateTEEInputsDisclose(mockSecret, mockPassportData, mockSelfApp)).toThrowError(
- `Invalid OFAC tree structure: missing required fields`,
- );
- });📝 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.
| it('throws error for unknown tree type', () => { | |
| // This test doesn't make sense as written since tree type is determined internally | |
| // Let's test the commitment tree validation instead | |
| vi.spyOn(useProtocolStore, 'getState').mockReturnValue({ | |
| passport: { | |
| ofac_trees: 'ofac-tree-data', | |
| commitment_tree: undefined, | |
| }, | |
| } as any); | |
| expect(() => generateTEEInputsDisclose(mockSecret, mockPassportData, mockSelfApp)).toThrowError( | |
| `Invalid OFAC tree structure: missing required fields`, | |
| ); | |
| }); |
🤖 Prompt for AI Agents
In packages/mobile-sdk-alpha/tests/processing/generate-disclosure-inputs.test.ts
around lines 121-134, the "throws error for unknown tree type" test relies on
internal stateless generator behavior and should be removed or repurposed into a
deterministic wrapper-level validation: either delete this test entirely, or
rewrite it to mock useProtocolStore.getState to produce an invalid/absent tree
structure (e.g., missing commitment_tree and/or malformed ofac_trees) and assert
that generateTEEInputsDisclose called via the public wrapper throws the explicit
wrapper-level error message (e.g., `Invalid OFAC tree structure: missing
required fields`) so the test no longer couples to internal tree-selection
logic.
|
|
||
| ### Android | ||
|
|
||
| | Requirement | Version | Installation Guide | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prettier
| "find:type-imports": "node scripts/find-type-import-issues.mjs", | ||
| "fmt": "prettier --check .", | ||
| "fmt:fix": "prettier --write .", | ||
| "fmt": "yarn prettier --check .", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherwise it might try to use the global prettier if you have it
| @@ -1,3 +1,4 @@ | |||
| /* eslint-disable sort-exports/sort-exports */ | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this if you want to have a bad time
| @@ -1,29 +1,34 @@ | |||
| import { calculateAge, generateTestData, testCustomData } from './utils.js'; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lint or organized the file
| @@ -1,22 +1,24 @@ | |||
| import countries from 'i18n-iso-countries'; | |||
| // @ts-ignore | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all of this is only moved functions because of lint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
automatically moved
| "check:versions": "node scripts/check-package-versions.mjs", | ||
| "format": "SKIP_BUILD_DEPS=1 yarn format:root && yarn format:github && SKIP_BUILD_DEPS=1 yarn workspaces foreach --parallel -i --all --exclude self-workspace-root run format", | ||
| "format:github": "prettier --parser yaml --write .github/**/*.yml --single-quote false", | ||
| "format:root": "prettier --parser markdown --write *.md scripts/**/*.md && prettier --parser yaml --write .*.{yml,yaml} --single-quote false && prettier --write scripts/**/*.{js,mjs,ts} && prettier --parser json --write scripts/**/*.json", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed scripts/**/*.md as it couldnt find anything and so it crashed
| "format:github": "prettier --parser yaml --write .github/**/*.yml --single-quote false", | ||
| "format:root": "prettier --parser markdown --write *.md scripts/**/*.md && prettier --parser yaml --write .*.{yml,yaml} --single-quote false && prettier --write scripts/**/*.{js,mjs,ts} && prettier --parser json --write scripts/**/*.json", | ||
| "format:github": "yarn prettier --parser yaml --write .github/**/*.yml --single-quote false", | ||
| "format:root": "echo 'format markdown' && yarn prettier --parser markdown --write *.md && echo 'format yaml' && yarn prettier --parser yaml --write .*.{yml,yaml} --single-quote false && yarn prettier --write scripts/**/*.{js,mjs,ts} && yarn prettier --parser json --write scripts/**/*.json", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added a few echos so we cans see status better
| }, | ||
| "dependencies": { | ||
| "@selfxyz/common": "workspace:^", | ||
| "socket.io-client": "^4.8.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
required by store
* feat: add aadhaar support to the ts sdk * feat: aadhaar support to go sdk * chore: refactor * move clearPassportData, markCurrentDocumentAsRegistered, reStorePassportDataWithRightCSCA to SDK (#1041) * Move self app store to mobile sdk (#1040) * chore(mobile-sdk-alpha): remove unused tslib dependency (#1053) * remove tslib -- seems unused * remove deps accidentally added to root * build file * remove unused imports (#1055) * fix: sha256 signed attr tests (#1058) * fix mock screen launch (#1059) * Hotfix: Belgium ID cards (#1061) * feat: parse belgium TD1 mrz android * feat: Parse Belgium TD1 MRZ IOS * fix: OFAC trees not found (#1060) * fix: relax OFAC tree response validation * test: cover OFAC tree edge cases * fix stateless * revert and fix types * fix tests * [SELF-723] feat: add structured NFC and Proof logging (#1048) * feat: add structured NFC logging * fix ci * Fix: add deps * logging fixes. use breadcrumbs * fix android build * update SeverityLevel * [SELF-705] feat: add proof event logging (#1057) * feat: add proof event logging * refactor: unify sentry event logging * fix types * fix mock * simplify * code rabbit feedback * fix tests --------- Co-authored-by: seshanthS <[email protected]> * skip on dev (#1063) * don't get fancy just disable (#1064) * saw it building so gonna try (#1065) * chore: bump v2.6.5 rd2 (#1067) * commit wip version bump * remove from building * chore: update tooling dependencies (#1069) * chore: update tooling dependencies * chore: align react typings and node types * update lock * chore: minor fixes across monorepo (#1068) * small fixes * fixes * fix gesture handler error * ci fixes * fix yarn build; add workflow ci (#1075) * add new workspace ci * disable package version check for now * build before checks * format * fix in future pr * feat: add functions for disclosing aadhaar attributes (#1033) * feat: add functions for disclosing aadhaar attributes * format * chore: update monorepo artifacts (#1079) * remove unneeded artifacts, skip building circuits * update md files * chore: update hub contract address * format * fix: add aadhaar in AllIds * chore: bump to v1.1.0-beta --------- Co-authored-by: vishal <[email protected]> Co-authored-by: Leszek Stachowski <[email protected]> Co-authored-by: Aaron DeRuvo <[email protected]> Co-authored-by: Justin Hernandez <[email protected]> Co-authored-by: Seshanth.S🐺 <[email protected]> Co-authored-by: seshanthS <[email protected]>
* chore: bump v2.6.5 rd2 (#1067) * commit wip version bump * remove from building * chore: update tooling dependencies (#1069) * chore: update tooling dependencies * chore: align react typings and node types * update lock * chore: minor fixes across monorepo (#1068) * small fixes * fixes * fix gesture handler error * ci fixes * fix yarn build; add workflow ci (#1075) * add new workspace ci * disable package version check for now * build before checks * format * fix in future pr * feat: add functions for disclosing aadhaar attributes (#1033) * feat: add functions for disclosing aadhaar attributes * format * chore: update monorepo artifacts (#1079) * remove unneeded artifacts, skip building circuits * update md files * cleans up unused parts of sdk interface, adds inline documentation, (#1078) * cleans up unused parts of sdk interface, adds inline documentation, * fix up build * yolo * Feat/aadhaar sdk (#1082) * feat: add aadhaar support to the ts sdk * feat: aadhaar support to go sdk * chore: refactor * move clearPassportData, markCurrentDocumentAsRegistered, reStorePassportDataWithRightCSCA to SDK (#1041) * Move self app store to mobile sdk (#1040) * chore(mobile-sdk-alpha): remove unused tslib dependency (#1053) * remove tslib -- seems unused * remove deps accidentally added to root * build file * remove unused imports (#1055) * fix: sha256 signed attr tests (#1058) * fix mock screen launch (#1059) * Hotfix: Belgium ID cards (#1061) * feat: parse belgium TD1 mrz android * feat: Parse Belgium TD1 MRZ IOS * fix: OFAC trees not found (#1060) * fix: relax OFAC tree response validation * test: cover OFAC tree edge cases * fix stateless * revert and fix types * fix tests * [SELF-723] feat: add structured NFC and Proof logging (#1048) * feat: add structured NFC logging * fix ci * Fix: add deps * logging fixes. use breadcrumbs * fix android build * update SeverityLevel * [SELF-705] feat: add proof event logging (#1057) * feat: add proof event logging * refactor: unify sentry event logging * fix types * fix mock * simplify * code rabbit feedback * fix tests --------- Co-authored-by: seshanthS <[email protected]> * skip on dev (#1063) * don't get fancy just disable (#1064) * saw it building so gonna try (#1065) * chore: bump v2.6.5 rd2 (#1067) * commit wip version bump * remove from building * chore: update tooling dependencies (#1069) * chore: update tooling dependencies * chore: align react typings and node types * update lock * chore: minor fixes across monorepo (#1068) * small fixes * fixes * fix gesture handler error * ci fixes * fix yarn build; add workflow ci (#1075) * add new workspace ci * disable package version check for now * build before checks * format * fix in future pr * feat: add functions for disclosing aadhaar attributes (#1033) * feat: add functions for disclosing aadhaar attributes * format * chore: update monorepo artifacts (#1079) * remove unneeded artifacts, skip building circuits * update md files * chore: update hub contract address * format * fix: add aadhaar in AllIds * chore: bump to v1.1.0-beta --------- Co-authored-by: vishal <[email protected]> Co-authored-by: Leszek Stachowski <[email protected]> Co-authored-by: Aaron DeRuvo <[email protected]> Co-authored-by: Justin Hernandez <[email protected]> Co-authored-by: Seshanth.S🐺 <[email protected]> Co-authored-by: seshanthS <[email protected]> * feat: change to gcp attestation verification (#959) * feat: change to gcp attestation verification * lint * fix e2e test * chore: don't check PCR0 mapping if building the app locally * fmt:fix --------- Co-authored-by: Justin Hernandez <[email protected]> * Mobile SDK: move provingMachine from the app (#1052) * Mobile SDK: move provingMachine from the app * lint, fixes * fix web build? * lint * fix metro build, add deps * update lock files * move the status handlers and proving machine tests * may it be * fix up * yolo --------- Co-authored-by: Justin Hernandez <[email protected]> Co-authored-by: Aaron DeRuvo <[email protected]> * Revert "Mobile SDK: move provingMachine from the app (#1052)" (#1084) This reverts commit 8983ac2. * fix: sdk (#1085) * bump sdk (#1086) * chore update mobile app types (#1087) * clean up types * clean up additional types * format * fix types * feat: add contract utils (#1088) * Feat/contracts npm publish (#1089) * chore: ci to publish contracts * yarn fmt * fix: use celo sepolia in common (#1091) * chore: export selfappbuilder (#1092) * [SELF-747] feat: clone android passport reader during setup (#1080) * chore: remove android private modules doc * private repo pull * skip private modules * remove unused circuits building * save wip * format * restore tsconfig * fix package install * fix internal repo cloning * unify logic and fix cloning * git clone internal repos efficiently * formatting * run app yarn reinstall from root * coderabbit feedback * coderabbit suggestions * remove skip private modules logic * fix: ensure PAT is passed through yarn-install action and handle missing PAT gracefully - Update yarn-install action to pass SELFXYZ_INTERNAL_REPO_PAT to yarn install - Make setup-private-modules.cjs skip gracefully when PAT is unavailable in CI - Fixes issue where setup script was throwing error instead of skipping for forks * prettier * fix clone ci * clone ci fixes * fix import export sorts * fix instructions * fix: remove SelfAppBuilder re-export to fix duplicate export error - Remove SelfAppBuilder import/export from @selfxyz/qrcode - Update README to import SelfAppBuilder directly from @selfxyz/common - Fixes CI build failure with duplicate export error * fix: unify eslint-plugin-sort-exports version across workspaces - Update mobile-sdk-alpha from 0.8.0 to 0.9.1 to match other workspaces - Removes yarn.lock version conflict causing CI/local behavior mismatch - Fixes quality-checks workflow linting failure * fix: bust qrcode SDK build cache to resolve stale SelfAppBuilder issue - Increment GH_SDK_CACHE_VERSION from v1 to v2 - Forces CI to rebuild artifacts from scratch instead of using cached version - Resolves quality-checks linter error showing removed SelfAppBuilder export * skip job * test yarn cache * bump cache version to try and fix the issue * revert cache version * refactor: use direct re-exports for cleaner qrcode package structure - Replace import-then-export pattern with direct re-exports - Keep SelfAppBuilder export with proper alphabetical sorting (before SelfQRcode) - Maintain API compatibility as documented in README - Eliminates linter sorting issues while keeping clean code structure * fix: separate type and value imports in README examples - Import SelfApp as type since it's an interface - Import SelfAppBuilder as value since it's a class - Follows TypeScript best practices and improves tree shaking * address version mismatches and package resolutions (#1081) * fix package version mismatches and resolutions * fixes * update lock * fix comma * fixes * fix packages * update packages * remove firebase analytics. not needed * fix: aadhaar verifier abi (#1096) * fix: aadhaar verifier abi * bump: core * fix: go-sdk (#1090) * SELF-725: add iOS qrcode opener and aadhaar screen (#1038) * add iOS qrcode opener and aadhaar screen * format * fix test * add Image-picker android (#1077) * add image-picker android * fix validation * feat: implement Aadhaar upload success and error screens, enhance AadhaarNavBar with dynamic progress indication - Added AadhaarUploadedSuccessScreen and AadhaarUploadErrorScreen components for handling upload outcomes. - Updated AadhaarNavBar to reflect current upload step with dynamic progress bar. - Integrated new screens into navigation flow for Aadhaar upload process. - Introduced blue check and warning SVG icons for visual feedback on success and error states. * feat: generate mock aadhar (#1083) * feat: generate mock aadhar * add yarn.lock * update yarn.lock * update protocolStore, update types, start modifying provingMachine * Register mock aadhar (#1093) * Register mock aadhar * fix ofac * temp: generate name * fix dob * Add Aadhaar support to ID card component and screens - Integrated Aadhaar icon and conditional rendering in IdCardLayout. - Updated AadhaarUploadScreen to process QR codes and store Aadhaar data. - Modified navigation and button text in AadhaarUploadedSuccessScreen. - Added mock data generation for Aadhaar in the mobile SDK. - Updated ManageDocumentsScreen to include Aadhaar document type. - Enhanced error handling and validation for Aadhaar QR code processing. - Added utility functions for Aadhaar data extraction and commitment processing. * aadhaar disclose - wip (#1094) * fix: timestamp cal of extractQRDataFields * Feat/aadhar fixes (#1099) * Fix - android aadhar qr scanner * fixes * update text * yarn nice * run prettier * Add mock Aadhaar certificates for development - Introduced hardcoded Aadhaar test certificates for development purposes. - Moved Aadhaar mock private and public keys to a dedicated file for better organization. - Updated the mock ID document generation utility to utilize the new Aadhaar mock certificates. * prettier write * add 'add-aadhaar' button (#1100) * Update .gitleaks.toml to include path for mock certificates in the common/dist directory * yarn nice * Enhance Aadhaar error handling with specific error types - Updated the AadhaarUploadErrorScreen to display different messages based on the error type (general or expired). - Modified the AadhaarUploadScreen to pass the appropriate error type when navigating to the error screen. - Set initial parameters for the home screen to include a default error type. * Update passport handling in proving machine to support Aadhaar document category - Modified the handling of country code in the useProvingStore to return 'IND' for Aadhaar documents. - Ensured that the country code is only fetched from passport metadata for non-Aadhaar documents. * tweak layout, text, change email to support, hide help button * fix ci, remove aadhaar logging, add aadhaar events * remove unused aadhaar tracking events * update globs * fix gitguardian config * don't track id --------- Co-authored-by: Justin Hernandez <[email protected]> Co-authored-by: Seshanth.S🐺 <[email protected]> Co-authored-by: vishal <[email protected]> * fix aadhaar screen test (#1101) * add iOS qrcode opener and aadhaar screen * format * fix test * add Image-picker android (#1077) * add image-picker android * fix validation * feat: implement Aadhaar upload success and error screens, enhance AadhaarNavBar with dynamic progress indication - Added AadhaarUploadedSuccessScreen and AadhaarUploadErrorScreen components for handling upload outcomes. - Updated AadhaarNavBar to reflect current upload step with dynamic progress bar. - Integrated new screens into navigation flow for Aadhaar upload process. - Introduced blue check and warning SVG icons for visual feedback on success and error states. * feat: generate mock aadhar (#1083) * feat: generate mock aadhar * add yarn.lock * update yarn.lock * update protocolStore, update types, start modifying provingMachine * Register mock aadhar (#1093) * Register mock aadhar * fix ofac * temp: generate name * fix dob * Add Aadhaar support to ID card component and screens - Integrated Aadhaar icon and conditional rendering in IdCardLayout. - Updated AadhaarUploadScreen to process QR codes and store Aadhaar data. - Modified navigation and button text in AadhaarUploadedSuccessScreen. - Added mock data generation for Aadhaar in the mobile SDK. - Updated ManageDocumentsScreen to include Aadhaar document type. - Enhanced error handling and validation for Aadhaar QR code processing. - Added utility functions for Aadhaar data extraction and commitment processing. * aadhaar disclose - wip (#1094) * fix: timestamp cal of extractQRDataFields * Feat/aadhar fixes (#1099) * Fix - android aadhar qr scanner * fixes * update text * yarn nice * run prettier * Add mock Aadhaar certificates for development - Introduced hardcoded Aadhaar test certificates for development purposes. - Moved Aadhaar mock private and public keys to a dedicated file for better organization. - Updated the mock ID document generation utility to utilize the new Aadhaar mock certificates. * prettier write * add 'add-aadhaar' button (#1100) * Update .gitleaks.toml to include path for mock certificates in the common/dist directory * yarn nice * Enhance Aadhaar error handling with specific error types - Updated the AadhaarUploadErrorScreen to display different messages based on the error type (general or expired). - Modified the AadhaarUploadScreen to pass the appropriate error type when navigating to the error screen. - Set initial parameters for the home screen to include a default error type. * Update passport handling in proving machine to support Aadhaar document category - Modified the handling of country code in the useProvingStore to return 'IND' for Aadhaar documents. - Ensured that the country code is only fetched from passport metadata for non-Aadhaar documents. * tweak layout, text, change email to support, hide help button * fix ci, remove aadhaar logging, add aadhaar events * remove unused aadhaar tracking events * update globs * fix gitguardian config * don't track id * fix test --------- Co-authored-by: turnoffthiscomputer <[email protected]> Co-authored-by: Seshanth.S🐺 <[email protected]> Co-authored-by: vishal <[email protected]> --------- Co-authored-by: Justin Hernandez <[email protected]> Co-authored-by: Nesopie <[email protected]> Co-authored-by: Aaron DeRuvo <[email protected]> Co-authored-by: vishal <[email protected]> Co-authored-by: Leszek Stachowski <[email protected]> Co-authored-by: Seshanth.S🐺 <[email protected]> Co-authored-by: seshanthS <[email protected]> Co-authored-by: Justin Hernandez <[email protected]> Co-authored-by: Vishalkulkarni45 <[email protected]>
* SDK Go version (#920) * feat: helper functions and constant for go-sdk * feat: formatRevealedDataPacked in go * chore: refactor * feat: define struct for selfBackendVerifier * feat: verify function for selfBackendVerifier * feat(wip): custom hasher * feat: SelfVerifierBacked in go * test(wip): scope and userContextHash is failing * test: zk proof verified * fix: MockConfigStore getactionId function * chore: refactor * chore: remove abi duplicate files * chore: move configStore to utils * chore: modified VcAndDiscloseProof struct * chore: more review changes * feat: impl DefaultConfig and InMemoryConfigStore * chore: refactor and export functions * fix: module import and README * chore: remove example folder * chore: remove pointers from VerificationConfig * chore: coderabbit review fixes * chore: more coderabbit review fix * chore: add license * fix: convert attestationIdd to int * chore: remove duplicate code --------- Co-authored-by: ayman <[email protected]> * Moving proving Utils to common (#935) * remove react dom * moves proving utils to the common * need to use rn components * fix imports * add proving-utils and dedeuplicate entry configs for esm and cjs. * must wrap in text component * fix metro bundling * fix mock import * fix builds and tests * please save me * solution? * fix test * Move proving inputs to the common package (#937) * create ofactTree type to share * move proving inputs from app to register inputs in common * missed reexport * ok * add some validations as suggested by our ai overlords * Fix mock passport flow (#942) * fix dev screens * add hint * rename * fix path * fix mobile-ci path * fix: extractMRZ (#938) * fix: extractMRZ * yarn nice && yarn types * fix test: remove unused * fix mobile ci * add script --------- Co-authored-by: Justin Hernandez <[email protected]> * Move Proving attest and cose (#950) * moved attest and cose utils to common with cursor converted tests in common to use vitest and converted coseVerify.test to vitest after moving from app to common what does cryptoLoader do? * moved away * get buff Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * SELF-253 feat: add user email feedback (#889) * feat: add sentry feedback * add sentry feedback to web * feat: add custom feedback modal & fix freeze on IOS * yarn nice * update lock * feat: show feedback widget on NFC scan issues (#948) * feat: show feedback widget on NFC scan issues * fix ref * clean up * fix report issue screen * abstract send user feedback email logic * fixes * change text to Report Issue * sanitize email and track event messge * remove unnecessary sanitization * add sanitize error message tests * fix tests * save wip. almost done * fix screen test * fix screen test * remove non working test --------- Co-authored-by: Justin Hernandez <[email protected]> Co-authored-by: Justin Hernandez <[email protected]> * chore: centralize license header checks (#952) * chore: centralize license header scripts * chore: run license header checks from root * add header to other files * add header to bundle * add migration script and update check license headers * convert license to mobile sdk * migrate license headers * remove headers from common; convert remaining * fix headers * add license header checks * update unsupported passport screen (#953) * update unsupported passport screen * yarn nice * Migrate Analytics (#951) * setup analytics adapter for self mobile sdk client and use in app * wrap for context * fix build * yarn types is an alias for build when build just compiles ts * ok unlock * deeper * ok this looks to work * fix license check * make sure it starts with this line * someone didnt commit * fix double analytics bug and builds * lint * Read document catalog from selfClient (#936) * [SELF-676] feat: upgrade React Native from 0.75.4 to 0.76.9 (#943) * chore: upgrade build tooling to Node 22 and AGP 8.6 * chore: upgrade react-native to 0.76.9 * update lock files and formatting * fix path * fix: handle hermes-engine cache mismatch in CI after React Native upgrade - Add fallback logic to run 'pod update hermes-engine' when pod install fails - This resolves CocoaPods cache issues that occur after React Native version upgrades - Fixes CI pipeline failures on codex/update-core-tooling-for-react-native-upgrade branch * fix: improve hermes-engine cache handling in CI - Preemptively clear CocoaPods cache before pod install - This prevents dependency analysis failures that occur when cached podspecs conflict - Addresses the root cause: cache conflicts during 'Analyzing dependencies' phase - Keeps fallback logic for additional safety * fix: handle hermes-engine cache in mobile-bundle-analysis workflow - Add pod-install-with-cache-fix.sh script to handle hermes-engine cache conflicts - Update install-app:setup script to use the new cache fix approach - This fixes the mobile-bundle-analysis.yml workflow failures after React Native upgrade - Proactively clears CocoaPods cache and has fallback for hermes-engine updates * formatting * fix: robust hermes-engine cache handling in CI workflows - Apply comprehensive cache clearing to mobile-ci.yml and mobile-e2e.yml - Pre-emptively run 'pod update hermes-engine' before pod install - Clear multiple cache locations to handle CI environment differences - This prevents 'hermes-engine differs from Pods/Local Podspecs' errors - Fixes all workflows affected by React Native 0.76.9 upgrade cache issues * fixes * clean up * update lock files * fix tests * sort * fixes * fix ci * fix deployment target * android fixes * upgrade fix * fixes * fix: streamline mobile CI build and caching (#946) * fix: streamline mobile CI build and caching * Enable mobile E2E tests on codex/fix-mobile-ci-workflow-errors branch * test * simplify and fix path * workflow fixes * fix loading on 0.76.9 * clean up unnecessary comments * fix readme * finalize upgrade to 0.76.9 * fix android build and upgrade * fix bundler caching * download cli to fix "yarn start" issues * fix cli build erorr * fix script path * better path * abstract build step to prevent race condition * fixes * better cache * fix corepack build error * update lock * update lock * add yarn cache to workflows * fix test building * ci caching improvements * fix common type check * fix common ci * better mobile sdk alpha building logic * chore: speed up mobile e2e workflow (#962) * chore: speed up mobile e2e workflow * chore: disable android e2e job * chore: speed up ios build * fix: bundle js for ios debug build * fix e2e * fix mobile ci (#964) * feat: improve mixpanel flush strategy (#960) * feat: improve mixpanel flush strategy * fixes * fix build * update lock * refactor methods * conslidate calls * update package and lock * refactor: remove namespace imports (#969) * refactor: remove namespace imports * refactor: use named fs imports * refactor(app): replace path and fs namespace imports * format * format * Mixpanel tweaks (#971) * udpates * fox * update license * Add DSC parsing check (#836) * Handle missing dsc parsed * nice * fix test * throw * fix * chore(app): upgrade dependencies (#968) * chore(app): upgrade dependencies * update package * update lock files * fixes * lock * fix * Auth Adapter + (#958) * basic auth adapater * remove SelfMobileSDk, this was another architecture which the adapter patern replaced * rename to avoid confusion with client.test.ts * basic auth adapater * remove SelfMobileSDk, this was another architecture which the adapter patern replaced * rename to avoid confusion with client.test.ts * self * fix * remove prototypes * make sure its mounted * fix tests * fmt * require required adapters * fix types * not a partial * adds missing exports * fix missing data * Fix nfc configuration scanning issue (#978) * fix nfc scanning on ios and android * save test * fix tests * fix lint * Chore fix ios nfc scanning and compiling (#979) * fixes * silence error * fix debugge * fix nfc scanning * lint and pipeline fixes * large runner (#980) * chore: update to macos latest large runner (#981) * bump up to macos-latest-large * fix ci * Move loadSelectedDocument to SDK (#967) Co-authored-by: Aaron DeRuvo <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * docs: update mobile SDK migration progress (#982) * docs: record app integration progress * docs: consolidate mobile SDK migration tracking * docs: humanize migration tracking and merge prompts * docs: add common consolidation tasks * docs: reprioritize migration tasks * docs: soften migration plan tone * docs: detail agent prompts with file paths * docs: catalog Linear tasks for SDK * updates * remove artifact management * moves validateDocument functions into the common package. (#977) * moves validateDocument functions into the common package. * fix build issues and lint * handle bad connections better in nullifiier * add an abort controler to nullifer fetcher, ignore fals positives * import types separately * take it as an arg * chore: update yarn.lock * chore(app): resolve lint warnings (#990) * chore(app): resolve lint warnings * update lock * clean up any types * fix types * feedback from cr * [SELF-703] feat: Migrate mock generator to mobile sdk (#992) * feat: expose mock generator * formatting * fix tests and lint * rename passport to document * fix types * [SELF-698] scaffold mobile sdk demo app (#993) * chore: scaffold mobile sdk demo app * test: cover demo app menu * prettier and types * sort * add android app foundation * fix android loading * get ios app running * update script * cr feedback * disable fabric * fixes * fixes * fix * SELF-702: Refactor navigation structure and dev utilities (#994) * Refactor navigation and dev screens * refactor: rename passport screens to document * fixes * add missing header * fixes * type files * feat: clarify proof verification analytics (#996) * feat: increase sha256 byte size and add new rsa circuits (#986) * feat: increase sha256 byte size and add new rsa circuits * feat: modularise the rsa fp pow mod * chore: comment signature verifier for testing * fix: sha256_sha256_sha224_ecdsa_secp224r1 * lint * chore: implement google play suggestions (#997) * google play suggestions * update gitguardian ignore * remove unused * chore: address yarn lock issues (#1004) * address yarn lock issues * fix postinstall * skip postinstall for ci (#1005) * [SELF-654] feat: add native modules (#919) * feat: add ios native modules * fix: extractMRZ * Add android OCR native module * wire native mrz module with adapter * wire Native modules and fix tests * fixes * fix license header logic * fix tests * fix types * fix: ci test * fix: android build ci * fix: ios build CI * add podfile.lock * add yarn.lock * update lock files * add yarn.lock * add license * order methods * update lock * pipeline fixes * prettier * update lock file * fix native modules on external apps * bundle @selfxyz/common into mobile-sdk-alpha * chore: address yarn lock issues (#1004) * address yarn lock issues * fix postinstall * update lock * fix build issues * fix pipeline issue * fix ci * fix bad merge * fix android ci * fix ci errors * fix mobile sdk ci. stop gap fix for now until we create a package * tweaks * retry aapt2 approach * use ^0.8.4 instead of ^0.8.0 due to the use of custom errors * workflow fixes * fix file * update * fix ci * test ci fix * fix test --------- Co-authored-by: Justin Hernandez <[email protected]> Co-authored-by: Justin Hernandez <[email protected]> * chore: update dev with staging 09/06/25 (#1007) * update CI * bump iOS version * update readme * update mobile-deploy ci * bump version iOS * update workflow to use workload identity federation (#933) * update workflow to use workload identity federation * add token permissions * correct provider name * chore: incrementing android build version for version 2.6.4 [github action] --------- Co-authored-by: Self GitHub Actions <[email protected]> * update ci * update ci * update ci * update ci * update ci * fix ci * fix ci * fix ci * remove fastlane use for android * bump iOS build version * update CI python script * iterate on CI * iterate on CI * iterate on CI * Dev (#941) * SDK Go version (#920) * feat: helper functions and constant for go-sdk * feat: formatRevealedDataPacked in go * chore: refactor * feat: define struct for selfBackendVerifier * feat: verify function for selfBackendVerifier * feat(wip): custom hasher * feat: SelfVerifierBacked in go * test(wip): scope and userContextHash is failing * test: zk proof verified * fix: MockConfigStore getactionId function * chore: refactor * chore: remove abi duplicate files * chore: move configStore to utils * chore: modified VcAndDiscloseProof struct * chore: more review changes * feat: impl DefaultConfig and InMemoryConfigStore * chore: refactor and export functions * fix: module import and README * chore: remove example folder * chore: remove pointers from VerificationConfig * chore: coderabbit review fixes * chore: more coderabbit review fix * chore: add license * fix: convert attestationIdd to int * chore: remove duplicate code --------- Co-authored-by: ayman <[email protected]> * Moving proving Utils to common (#935) * remove react dom * moves proving utils to the common * need to use rn components * fix imports * add proving-utils and dedeuplicate entry configs for esm and cjs. * must wrap in text component * fix metro bundling * fix mock import * fix builds and tests * please save me * solution? * fix test * Move proving inputs to the common package (#937) * create ofactTree type to share * move proving inputs from app to register inputs in common * missed reexport * ok * add some validations as suggested by our ai overlords * Fix mock passport flow (#942) * fix dev screens * add hint * rename * fix path * fix mobile-ci path * fix: extractMRZ (#938) * fix: extractMRZ * yarn nice && yarn types * fix test: remove unused * fix mobile ci * add script --------- Co-authored-by: Justin Hernandez <[email protected]> * Move Proving attest and cose (#950) * moved attest and cose utils to common with cursor converted tests in common to use vitest and converted coseVerify.test to vitest after moving from app to common what does cryptoLoader do? * moved away * get buff Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * SELF-253 feat: add user email feedback (#889) * feat: add sentry feedback * add sentry feedback to web * feat: add custom feedback modal & fix freeze on IOS * yarn nice * update lock * feat: show feedback widget on NFC scan issues (#948) * feat: show feedback widget on NFC scan issues * fix ref * clean up * fix report issue screen * abstract send user feedback email logic * fixes * change text to Report Issue * sanitize email and track event messge * remove unnecessary sanitization * add sanitize error message tests * fix tests * save wip. almost done * fix screen test * fix screen test * remove non working test --------- Co-authored-by: Justin Hernandez <[email protected]> Co-authored-by: Justin Hernandez <[email protected]> * chore: centralize license header checks (#952) * chore: centralize license header scripts * chore: run license header checks from root * add header to other files * add header to bundle * add migration script and update check license headers * convert license to mobile sdk * migrate license headers * remove headers from common; convert remaining * fix headers * add license header checks * update unsupported passport screen (#953) * update unsupported passport screen * yarn nice --------- Co-authored-by: Vishalkulkarni45 <[email protected]> Co-authored-by: ayman <[email protected]> Co-authored-by: Aaron DeRuvo <[email protected]> Co-authored-by: Justin Hernandez <[email protected]> Co-authored-by: Seshanth.S🐺 <[email protected]> Co-authored-by: Justin Hernandez <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * bump version * bump yarn.lock * update ci (#966) * chore: Manually bump and release v2.6.4 (#961) * update lock files * bump and build android * update build artifacts * show generate mock document button * update lock * fix formatting and update failing e2e test * revert podfile * fixes * fix cold start of the app with deeplink * update ci * update ci * Sync MARKETING_VERSION to iOS project files after version bump * chore: incrementing android build version for version 2.6.4 [github action] (#976) Co-authored-by: remicolin <[email protected]> * chore: add build dependencies step for iOS and Android in mobile deploy workflow * chore: enhance mobile deploy workflow by adding CMake installation step * bump android build version * chore: incrementing android build version for version 2.6.4 [github action] (#985) Co-authored-by: remicolin <[email protected]> * chore: configure Metro bundler for production compatibility in mobile deploy workflow * chore: incrementing android build version for version 2.6.4 [github action] (#987) Co-authored-by: remicolin <[email protected]> * Revert "chore: configure Metro bundler for production compatibility in mobile deploy workflow" This reverts commit 60fc1f2580c2f6ad3105d8b904d969412a18bd2e. * reduce max old space size in mobile-deploy ci * fix android french id card (#957) * fix android french id card * fix common ci cache * feat: log apdu (#988) --------- Co-authored-by: Justin Hernandez <[email protected]> Co-authored-by: Seshanth.S🐺 <[email protected]> * unblock ci * fix merge * merge fixes * fix tests * make ci happy --------- Co-authored-by: turnoffthiscomputer <[email protected]> Co-authored-by: pputman-clabs <[email protected]> Co-authored-by: Self GitHub Actions <[email protected]> Co-authored-by: turnoffthiscomputer <[email protected]> Co-authored-by: Vishalkulkarni45 <[email protected]> Co-authored-by: ayman <[email protected]> Co-authored-by: Aaron DeRuvo <[email protected]> Co-authored-by: Seshanth.S🐺 <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * chore: fix yarn format (#1009) * fix yarn format * yarn format * fix lint * undo temporary disabling * pipeline fixes * revert nvmrc change * add new home screen (#1019) * add new home screen * fix typing issue * yarn nice * chore: update the cpp build script (#1021) * chore: install node (#1022) * chore: use node v22 (#1023) * chore: install yarn (#1024) * chore: yarn cache (#1025) * chore: sanitise node version (#1026) * remove lazy loading (#1018) * remove lazy loading * fix tests * formatting * fix imports and web ci * fix tests * fix building * fix * debug ci * fix web ci issue * fix * fix * fix ci * remove web render test * coderabbit feedback * fix ci * use import * fix lint * fix compiling * update lock * update lock * fix: update yarn.lock hash for @selfxyz/mobile-sdk-alpha Resolves CI error where yarn install --immutable failed due to outdated package hash. The hash changed from b2afc4 to f9ebb9. * fix: update yarn.lock hash after mobile-sdk-alpha changes - Hash changed from c0e6b9 to 0d0f72 due to package modifications - Cleaned caches and regenerated lockfile to ensure consistency - This resolves CI cache mismatch where old artifacts had stale hash * fix: update yarn.lock hash after building mobile-sdk-alpha - Final hash: 89f5a6 (includes built dist artifacts) - Built mobile-sdk-alpha to ensure package is in stable state - This should resolve CI immutable install errors * fix yarn lock and build * chore(ci): improve mobile e2e caching (#1010) * chore(ci): improve mobile e2e caching * chore(ci): restore deriveddata cache * chore(ci): remove ios deriveddata cache * chore(ci): cache ios derived data * chore(ci): optimize mobile deploy caching * chore(ci): enable ccache for ios e2e builds * fix(ci): add ccache path for ios e2e * moves ofac and protocol store (#1012) * move ofact tree fetch to common * move protocol store to the msdk, fix some dependencies on msdk * chore: remove register id from register circuits (#1028) * chore: remove register id from register circuits * chore: only use 128ram instance * Feat/build cpp (#1029) * chore: remove register id from register circuits * chore: only use 128ram instance * chore: build 2 circuits at a time * Remove navigationRef from provingMachine (#1011) * SDK: minimize amount of data sent through PROVING_PASSPORT_NOT_SUPPORTED event (#1030) * Fix mock passport generation (#1031) * fix mock passport generation * fix mobile ci tests * Feat/aadhaar (#949) * make contract sdk simpler (#514) * make contract sdk simpler * reduce root inputs * delete convert function * summarize our library * update npm package * update package version * update attestation id * add util function to get revealed data * Revert "make contract sdk simpler (#514)" (#518) This reverts commit 847b88d5ecc0d449b976a552f68af38eec8e561b. * merge dev into main (#576) * Feat: Show error code in SDK (#500) * feat: emit `error_code` and `reason` in app * feat: add `onError` in sdk * feat: Display reason in app * lint & fmt * feat: add scrollview in ProofRequestStatusScreen for long reasons * Fix input generation for 521bit curves (#481) * fix EC point padding for 521 bit curves * rename modulus to point in findStartIndexEC as it is a point * simplify matching logic * simplify padding logic * remove comment * remove log removing .only so the CI/CD runs circuit tests fix disclosure test fix scope in test fix scope error in circuit tests remove .only fix test * run ci/cd * Feat/simpler contract sdk (#519) * make contract sdk simpler * reduce root inputs * delete convert function * summarize our library * update npm package * update package version * update attestation id * add util function to get revealed data --------- Co-authored-by: motemotech <[email protected]> * forgot to include package update (#521) * Bump version to 2.5.1 (#522) * bump version * update fastlane * fix bump version * bump build and add todo * disable commit for now * [SEL-154] Step 1: Scan your passport (#511) * simplify navigation logic * use aesop design hook * save wip * add new aesop redesign screens * save wip design * refactor nav bar logic * fix paths * save wip * stub progress navbar and save wip * save wip progress bar animation * save wip progress bar, almost done with design * fix progress bar design * fix bottom padding * disable git commit for now * fix flaky android downloads that causes pipeline to crash * update lock for ci * [SEL-46] FE: Add minimum bottom padding (#510) * fix bottom padding for smaller screens * fix podfile post install hook permissions check * update pod lock and disable git commit action step for now * update lock * fix flaky android downloads that causes pipeline to crash * fix: improve error handling for forbidden countries list mismatch (#494) * Update SelfBackendVerifier.ts * Update constants.ts * Update formatInputs.ts * Update formatCallData.ts * DX: Auto format on save (#526) * save wip * use elint instead of prettier to sort imports * set imports to warn * sync prettier settigns * update prettier settings * save working version * fix export and disable mobile pipeline for now * limit auto formatting to the app folder * remove artefacts * SEL-187: Make bottom layout scrollable on smaller screens (#525) * fix design check * add an option to disable local sending of sentry events * better sentry enable / disable * fix scan passport height * make bottom layout scrollable so it doesn't squish top screen * simpler logic check. don't create new env var * fix internet connection issues * readd comment * use isConnected instead of internet reachable * use a dynamic bottom panel height * add missing recovery screens * move aesop below * remove dupe export * fix rebase * fix android package download issue * Feat/extend id support (#517) * refactor proving impleting xstate, speedup proving * add disclosure proof support * keep refactoring provingMachine, clean old implementation * call init method when switching from dsc to register * rebase with dev to display why the proof verification failed * refactor ws connexion between front-end and mobile to retrieve self-app * update the webclient at proofVerification and use selfAppStore in provingMachine * fix provintStore.init in ProveScreen * yarn nice * fetch data correctly in splash screen * Bump build versions for 2.5.1 (#531) * release new builds * fix app and build versions * fix env check * display error animation on failure on loading screen (#532) * display error animation on failure on loading screen * remove log --------- Co-authored-by: Justin Hernandez <[email protected]> * ci: bump actions/checkout to v4 (#529) * make contract sdk simpler (#514) * make contract sdk simpler * reduce root inputs * delete convert function * summarize our library * update npm package * update package version * update attestation id * add util function to get revealed data * Revert "make contract sdk simpler (#514)" (#518) This reverts commit 847b88d5ecc0d449b976a552f68af38eec8e561b. * ci: bump actions/checkout to v4 --------- Co-authored-by: nicoshark <[email protected]> Co-authored-by: turnoffthiscomputer <[email protected]> * fix italy (#530) * Fix/proving machine endpoint type (#538) * store endpoint type in proving machine * yarn nice * fix splash screen error (#539) * New bug fix build for v2.5.1 (#540) * bump new build for dev fixes * update lock * reinstall before running local deploy * SEL-178: Improve haptic feedback library (#535) * fix dev settings typing * add dev screens file * save haptic feedback progress * change ordedr * fix initial route and add haptic feedback screen to dev settings options * add delete scripts (#542) * update staging registry address (#545) * feat: Add Disclose history (#533) * feat: Add Disclose history * fix: Duplicate history in list * fix: Outdated disclosures * Delete app/ios/Self copy-Info.plist * allow a scale of up to 1.3 (#546) * allow a scale of up to 1.3 * update lock files * clean up unused imports * fix settings * add common sdk (#537) * add common sdk * remove sdk backend api * remove registry * regenerate sha256 rsa dsc each time * download ski-pem dynamically on staging, refactor initpassportDataParsing * add state machine for button on prove screen, improve ux on splash screen * fetch ski-pem in production * fix linter issues * fix prove screen button bugs * update podfile.lock and yarn.lock * run linter in circuits repo * bump build * bump version for sentry debugging * bump ios to version 118 --------- Co-authored-by: Justin Hernandez <[email protected]> * better connection check (#548) * Clean up navigation and setup Jest (#549) * remove dupe account screens and prefer the term home * organize screen loading better * sort keys * rename screen files wip * fix deleted directory issues * rename folders * fix paths and naming * save working jest import test * save base working jest navigation test * finalize navigation refactor and jest test * update test name and podfile lock * remove unused packages * use the correct version of react test renderer * bump build (#552) * Eth dublin (#554) * add mock id card generator * add genMockIdDoc in common/sdk exports * onboard developer id using deeplink, allow custom birthdate on mockpassport * log more dsc info (#558) * Push notification (#536) * add push notification feature * merge new app impl * change dsc key * import * reverse mock dsc * worked in the ios * checked in android * update url and delete console * delete small changes * lint * add yarn.lock * fix warning message * add mock notification service for test code * fix path for the mock implementation * add mock deeplink to the test code * nice notificationServiceMock.js * delete unused firebase related implementation * fix wording and UI related to notification service * hotfix on mockdatascreen --------- Co-authored-by: turnoffthiscomputer <[email protected]> * Fix deeplink 2 (#560) * fix deeplink * fix deeplink * yarn nice * feat: Use vision for MRZ scanning (SEL-47) (#557) * feat: Use vision for MRZ scanning * modify label to position the smartphone during the OCR scan --------- Co-authored-by: turnoffthiscomputer <[email protected]> * SEL-255: improved loading screen with estimated wait times (#550) * create new loading screen and rename static to misc * fix route * save wip loading screen * save wip animation * save static wip design * continue * splash * add a loading screen text helper * add test for loading screen text * save wip. almost there * update haptic logic * better feedback and add dev scren * save current work * update text logic and tests * load passport metadata in loading screen * simplify and fix tests * test for additional exponents * add new animation * rename file * consolidate ui useEffect and fix loading screen layout * fix current state * remove mockPassportFlow param * merge new loading screen and new notification logic * simplify * update lock * use passportMetadata instead of metadata * save simplification * update loading text based on pr feedback and tests * Bump v2.5.1: ios 122; android 60 (#561) * increment build to 120 * bump builds for 2.5.1. ios 121; android 60 * clean up logic * upgrade react native firebase for privacy manifests * update react native keychain to fix could not recover issue (#564) * fix: update ocr corrections (#563) * Chore: Polish proof history to prep for release (#566) * clean up nav and home boundaries, passport data screen insets * migrate proof history screen out of settings * minor clean up * save wip * add new ibm plex mono font and clean up proof detail screen * remove test data * remove extra loading screen text * remove unnecessary ceil * Bump v2.5.1; ios 123; android 62 (#565) * bump to build 61 * bump ios version * update version * Feature/add prettier formatter (#568) * Add Prettier configuration and ignore files for code formatting - Created .prettierignore to exclude specific directories and files from formatting. - Added .prettierrc.yml with custom settings for print width and trailing commas. - Updated package.json to include Prettier and its Solidity plugin as dependencies, along with scripts for formatting and checking code. * Run prettier formatting * fix nationality using mock passports * SEL-181 & SEL-252: Update mobile app events (#570) * improve analytics handling * add error boundary that flushes segment events before error occurs * upgrade segment analytics package * flush analytics when user encounters error screen * track all click events * add tracking to loading screen * better init and click event names * track cloud backup and modal actions * use __DEV__ for debugging * add tracking to account recovery, auth, mock data * return false instead of throwing * add more tracking events * save wip event updating * abstract analytic event names * update click events * clean up * move reasons comment * add unsupported passport event * Feature/enhance self verification root (#569) * Add SelfVerificationConsumer contract for self-verification logic - Introduced an abstract contract, SelfVerificationConsumer, that extends SelfVerificationRoot. - Implemented nullifier tracking, verification success events, and customizable validation and update methods for nullifiers. - Added error handling for nullifier check failures and hooks for derived contracts to implement custom logic after successful verification. * Add SelfHappyBirthday contract example using SelfVerificationConsumer - Introduced SelfHappyBirthday contract that allows users to claim USDC on their birthday. - Integrated SelfVerificationConsumer for handling verification and nullifier tracking. - Added functions to set claimable amount and window, along with event emissions for state changes. - Implemented logic to check if the claim is within the user's birthday window and transfer USDC accordingly. * Refactor imports in HappyBirthday contract for better organization - Updated import statements in HappyBirthday.sol to use relative paths for ISelfVerificationRoot, SelfCircuitLibrary, and SelfVerificationConsumer. - Improved code readability and maintainability by organizing imports more logically. * Refactor Airdrop contract to use SelfVerificationConsumer for registration logic - Updated Airdrop contract to inherit from SelfVerificationConsumer instead of SelfVerificationRoot. - Refactored mappings for user identifiers and nullifiers for improved clarity and functionality. - Enhanced error handling and updated function parameters for consistency. - Implemented new validation and update methods for nullifiers, streamlining the registration process. - Removed deprecated verifySelfProof function and integrated logic into new methods. * Add events and refactor SelfVerificationRoot and related contracts - Introduced new events in SelfVerificationRoot for verification configuration updates, scope changes, and attestation ID management. - Updated Airdrop contract to remove deprecated events and added a new event for Merkle root updates. - Refactored SelfPassportERC721 to inherit from SelfVerificationConsumer, enhancing verification logic and event handling. - Improved function parameters for consistency and clarity across contracts. * Refactor contracts to use SelfVerificationRoot and enhance verification logic - Removed SelfVerificationConsumer contract and updated related contracts to inherit from SelfVerificationRoot. - Refactored mappings and event emissions in Airdrop, HappyBirthday, and SelfPassportERC721 for improved clarity and functionality. - Enhanced verification success hooks to include user identifiers and nullifiers for better tracking. - Updated constructor parameters for consistency across contracts and improved error handling for user registration and claims. * Refactor constructor in SelfPassportERC721 for improved readability * Refactor function parameters in SelfVerificationRoot and related contracts * Refactor constructor parameter names in IdentityVerificationHub, Airdrop, IdentityRegistry, and ProxyRoot contracts for improved clarity and consistency * fix getCircuitName function (#575) * fix getCircuitName function * fix getCircuitName function * feat: Read ID cards (#571) * Update GitHub checkout action from v3 to v4 (#544) * Bump build version 2.5.2 to test react native keychain (#572) * bump build and version * bump version 2.5.2 * don't downgrade react native keychain * update app/README.md toolchain instructions (#140) * bump build (#580) --------- Co-authored-by: Seshanth.S🐺 <[email protected]> Co-authored-by: turboblitz <[email protected]> Co-authored-by: motemotech <[email protected]> Co-authored-by: Justin Hernandez <[email protected]> Co-authored-by: crStiv <[email protected]> Co-authored-by: Justin Hernandez <[email protected]> Co-authored-by: James Niken <[email protected]> Co-authored-by: Kevin Lin <[email protected]> Co-authored-by: leopardracer <[email protected]> Co-authored-by: Olof Andersson <[email protected]> * feat(wip): register circuit for aadhaar * chore: add anon aadhar circuits * chore: remove sc and disclose selfrica test * feat: extract aadhaar qr data * test: aadhaar qr data extract circuit * test: aadhaar register circuit * feat: extract pincode and ph no last 4 digit * fix: register aadhaar nullifier and commitment * test: Verify commitment circuit of aadhaar * feat: add photoHash inside commitment * feat: build Aadhaar OFAC SMT * feat: ofac check and reveal data (test done) * test: qr extractor for custom data input * feat: add state as reveal data inside VC and disclose * chore: add comments * fix: num2Ceil component * chore: review changes * chore: use passport SignatureVerifier * fix: signatureVerifier inputs * feat: extract ascii values of fields * feat: provide users the flexibility to reveal specific characters of a field * chore: refactor * test: register aadhaar for tampered data * test(wip): should return 0 if in ofac list * test: ofac check * test: register aadhaar circuit for different qr data * merge dev into main (#683) * remove sdk/tests (#622) * remove sdk/tests * chore: update yarn.lock --------- Co-authored-by: Ayman <[email protected]> * fix: add range check on paddedInLength of shaBytesDynamic (#623) * fix ci (#626) * implement self uups upgradeable (#592) * implement self uups upgradeable * small changes in identityVerificationHubImplV2 * delete aderyn.toml * chore: add custom verifier * chnage return output * feat: use self structs and a Generic output struct * feat: add userIdentifier, nullifier, forbiddencountries to returned output * add root view functions from registry * fix: build and compilation errors * add userDefined data into selfVerificationRoot * "resolve conflicts" * fix compilation problem * fix how to register verification config * test: CustomVerifier * fix verification root and hub integration * add scope check in hub impl * replace poseidon hash to ripemd+sha256 * add todo list * feat: refactor and add test cases for generic formatter * add performUserIdentifierCheck in basicVerification * change how to handle additionalData and fix stack too deep * start adding test codes * fix dependency problems in monorepo * fix: forbidden countries (#612) LGTM! * able to run test code * pass happy path * delete unused codes * change error code name, add caller address validation and add scripts to run test and build in monorepo * add all test cases in vcAndDisclose flow * remove comment out * chore: use actual user identifier outputs * success in registration tests * cover all cases * pass contractVersion instead of circuitVersion * fix disclose test * chore: add natspecs for ImplHubV2, CustomVerifier and GenericFormatter * change val name and remove unused lines * add val name change * remove userIdentifier from return data * feat: use GenericDiscloseOutput struct in verfication hook fix test cases for user identifier * chore: change the function order for Hub Impl V2 (#625) * fix nat specs * add nat spec in SelfStructs --------- Co-authored-by: Ayman <[email protected]> Co-authored-by: Nesopie <[email protected]> * prettier (#629) * CAN auth - android (#613) * add missed files * add NFCMethodSelectionScreen * bump android build --------- Co-authored-by: Justin Hernandez <[email protected]> * feat: add MRZ correction method to NFCMethodSelectionScreen (#627) * add npm auth token env (#632) * bump sdk version (#633) * publish npm package when merging on dev * bump common sdk version * replace yarn publish by npm publish * update common package version * Simplify dev mode gesture (#635) * Simplify developer mode gesture * Enable dev mode on MockData screen with five taps * add build smt function to common sdk * update vc_and_disclose_id test (dev branch) (#641) * fix: vc_and_disclose_id test * chore: yarn prettier * Show modal on NFC scan error (#642) * Add help button and error modal actions * fix the screen management * yarn nice * Bump build v2.5.4: ios 132; android 71 (#631) * bump version and build numbers * remove tamagui/toast * fix marketing version * fix: update TD1 and TD3 checks (#643) * bum yarn.lock * Bump build: ios 133; android 72 and build fixes (#654) * update gesture version and bump android build * bump and fix ios build * update lock files * fixes * fix fotoapparat library source * Update example contracts to include EUID usage (#656) * refactor: update HappyBirthday contract to V2 with support for E-Passport and EUID cards, introduce bonus multipliers, and enhance verification logic * refactor: update Airdrop contract to V2 with support for E-Passport and EU ID Card attestations * refactor: remove BASIS_POINTS constant from Airdrop contract * feat: introduce SelfIdentityERC721 contract for issuing NFTs based on verified identity credentials, replacing SelfPassportERC721 * fix: update verification functions in Airdrop, HappyBirthday, and SelfIdentityERC721 contracts to use customVerificationHook * cherry pick commit from add-test-self-verification... * block non-dev pr to main branch * audit fixes (#645) * merge dev branch into main (#624) * remove sdk/tests (#622) * remove sdk/tests * chore: update yarn.lock --------- Co-authored-by: Ayman <[email protected]> * fix: add range check on paddedInLength of shaBytesDynamic (#623) * fix ci (#626) --------- Co-authored-by: Ayman <[email protected]> Co-authored-by: Vishalkulkarni45 <[email protected]> * update contracts (#628) * remove sdk/tests (#622) * remove sdk/tests * chore: update yarn.lock --------- Co-authored-by: Ayman <[email protected]> * fix: add range check on paddedInLength of shaBytesDynamic (#623) * fix ci (#626) * implement self uups upgradeable (#592) * implement self uups upgradeable * small changes in identityVerificationHubImplV2 * delete aderyn.toml * chore: add custom verifier * chnage return output * feat: use self structs and a Generic output struct * feat: add userIdentifier, nullifier, forbiddencountries to returned output * add root view functions from registry * fix: build and compilation errors * add userDefined data into selfVerificationRoot * "resolve conflicts" * fix compilation problem * fix how to register verification config * test: CustomVerifier * fix verification root and hub integration * add scope check in hub impl * replace poseidon hash to ripemd+sha256 * add todo list * feat: refactor and add test cases for generic formatter * add performUserIdentifierCheck in basicVerification * change how to handle additionalData and fix stack too deep * start adding test codes * fix dependency problems in monorepo * fix: forbidden countries (#612) LGTM! * able to run test code * pass happy path * delete unused codes * change error code name, add caller address validation and add scripts to run test and build in monorepo * add all test cases in vcAndDisclose flow * remove comment out * chore: use actual user identifier outputs * success in registration tests * cover all cases * pass contractVersion instead of circuitVersion * fix disclose test * chore: add natspecs for ImplHubV2, CustomVerifier and GenericFormatter * change val name and remove unused lines * add val name change * remove userIdentifier from return data * feat: use GenericDiscloseOutput struct in verfication hook fix test cases for user identifier * chore: change the function order for Hub Impl V2 (#625) * fix nat specs * add nat spec in SelfStructs --------- Co-authored-by: Ayman <[email protected]> Co-authored-by: Nesopie <[email protected]> * prettier (#629) --------- Co-authored-by: Ayman <[email protected]> Co-authored-by: Vishalkulkarni45 <[email protected]> Co-authored-by: nicoshark <[email protected]> Co-authored-by: Nesopie <[email protected]> * fix: vc_and_disclose_id test (#640) * fix: vc_and_disclose_id test * chore: yarn prettier * fix: check if a config id exists * chore: change the function where the config not set verification is happening * fix: add await * feat: add getConfigId function in SelfVerificationRoot (#650) * feat: add getConfigId function in SelfVerificationRoot * update comment --------- Co-authored-by: motemotech <[email protected]> * chore: fix ofac end index in eu id cards * chore: fix tests * fix: example contracts and tests --------- Co-authored-by: turnoffthiscomputer <[email protected]> Co-authored-by: Vishalkulkarni45 <[email protected]> Co-authored-by: nicoshark <[email protected]> * Update deployment module for Identity Verification Hub V2 with detailed documentation and library linkage for CustomVerifier. Update initialization process to reflect changes in V2 implementation, ensuring proper setup for proxy deployment. (#658) * publish npm-package (#651) * App/eu id updates (#638) * fix build issues * generate disclosure proof with euids * generate disclosure proof with euids * Eu id updates 2 (#648) * update vc_and_disclose_id test (dev branch) (#641) * fix: vc_and_disclose_id test * chore: yarn prettier * Show modal on NFC scan error (#642) * Add help button and error modal actions * fix the screen management * yarn nice * Bump build v2.5.4: ios 132; android 71 (#631) * bump version and build numbers * remove tamagui/toast * fix marketing version * fix: update TD1 and TD3 checks (#643) * bum yarn.lock * add version and user defined data --------- Co-authored-by: Vishalkulkarni45 <[email protected]> Co-authored-by: Justin Hernandez <[email protected]> Co-authored-by: Seshanth.S🐺 <[email protected]> * remove the mock user define data * get the useridentifier as a hash from the user defined data * chore: add version and userDefinedData * feat: use the version in register / dsc proofs as well * update calculateUserIdentifierHash * yarn nice * refactor: consolidate user context data handling and update payload structure * fix typing issues on sha1 * remove console.log(sha1) * fix sha1 import * refactor: streamline userDefinedData handling and adjust payload type for circuit * refactor: update sha1 usage and enhance logging in calculateUserIdentifierHash * yarn nice * yarn lint common * use ts-ignore for sha1 import * fix app ci tests * fix typing issue * remove unused ts-ignore * cast uuid before calling generateinputs * bump qrcode version * add tsup on the qrcode sdk * fix: exports on selfxyz/qrcode * update how we define config.version * fix yarn imports * yarn format --------- Co-authored-by: Vishalkulkarni45 <[email protected]> Co-authored-by: Justin Hernandez <[email protected]> Co-authored-by: Seshanth.S🐺 <[email protected]> Co-authored-by: Ayman <[email protected]> * Hotfix contract compile error (#660) * Fix previous rebase error * Refactor deployment module for Identity Verification Hub V2. * Fix/sdk (#652) * fix: sdk build configs * chore: SelfBackendVerifier (WIP) * feat: add custom verification * feat: consider destination chain in user defined data * chore: export attestation id * chore: export attestation id * chore: export config storage * chore: don't throw an error if the proof is not valid * chore: trim abi and rm typechain types * refactor * chore: rm unnecessary exports * 📝 Add docstrings to `fix/sdk` (#653) Docstrings generation was requested by @remicolin. * https://github.com/selfxyz/self/pull/652#issuecomment-2992046545 The following files were modified: * `sdk/core/src/utils/hash.ts` * `sdk/core/src/utils/proof.ts` * `sdk/core/src/utils/utils.ts` Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * review fixes * chore: fix package.json cjs types * chore: add minor changes to checks * feat: add InMemoryConfigStore, allIds constant and verificationResult type * chore: export Verification config * feat: change the verification config types * fix: throw issues early if verification config is null * fix: update yarn.lock file * chore: lint * fix: rm ts expect error directive * fix: contract tests * use excluded countries instead forbidden countries list * chore: change types in constnats --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update npm-publish workflow and bump core package version to 1.0.0 (#661) * update import * Update get verification config visibility (#664) * Update deployment module for Identity Verification Hub V2 to correct file paths and module name for deployment commands. * Add troubleshooting documentation for verification issues in deployHubV2.ts. Include manual verification steps and common failure reasons to assist users during deployment. * Change visibility of getVerificationConfigV2 function from internal to public in IdentityVerificationHubImplV2 contract to allow external access. * Apply BUSL v1.1 license headers to app (#665) * Add BSL license headers to app sources * prettier * fix license reference - https://spdx.org/licenses/BUSL-1.1.html * bump build: android 73 (#659) * Contracts/deploy staging (#668) * update scripts * deploy vc and disclose id * fix the deployment scripts on staging * update yarn.lock * bump ios build and version (#669) * configure coderabbitai (#670) * tweak coderabbit * bump * more thorough test spec * Apply BSL to app codebase (#639) * Clean up root license wording * Simplify SPDX header * simplify license and rename BSL to BUSL * fix merge issues * fix missing method --------- Co-authored-by: Justin Hernandez <[email protected]> * SEL-423 apply xcode build suggestions (#671) * apply recommended app settings from xcode * stick to portrait orientation and update target settings * remove app clip references * Circuit audit fixes (#644) * feat: add range checks before use of LessEqThan and SelectSubArray * fix: Num2Bits_strict to constrain virtualKey * bump core version * bump core version and fix ci * chore: use npm_auth_token in yarnrc * chroe: rm yarnrc changes * chore: update npm publish * chore: run npm publish manually * chore: change hub contract address (#675) * Update npm-publish.yml * chore: use proper secret when publishing * feat: enable publishing if workflow was triggered manually * Contracts/update verifier (#673) * update hardhat config * update vc and disclose verifier * update vc and disclose verifier script and run it * update test self verification root * update verifier * bump sdk version and use new hub address * chore: update zk-kit binary merkle root dep (#674) * refactor deployment scripts (#678) * feat: add register eu id instances (#682) * feat: add register eu id instances * feat: add new instances * chore: update scripts * chore: fix sig alg * chore: rm circuits --------- Co-authored-by: Ayman <[email protected]> Co-authored-by: Vishalkulkarni45 <[email protected]> Co-authored-by: nicoshark <[email protected]> Co-authored-by: Nesopie <[email protected]> Co-authored-by: Seshanth.S🐺 <[email protected]> Co-authored-by: Justin Hernandez <[email protected]> Co-authored-by: Justin Hernandez <[email protected]> Co-authored-by: Kevin Lin <[email protected]> Co-authored-by: kevinsslin <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Eric Nakagawa <[email protected]> * fix: commitment hash * fix: register aadhaar test * chore: refactor * feat: reveal data in packed bytes * feat: add constrain on delimiterIndices * feat: reveal timestamp * merge main to feat/aadhaar * fix: tests * feat: hash pubKey * feat: add registry contract * feat: Update HubImplV2 (WIP) * add functions to generate aadhaar data (WIP) * modularize aadhaar data generation (WIP) * fix(wip): register test * fix: test qr extractor * fix * chore: refactor functions * feat: add age extractor and tested * feat: add isMiniumAge check * fix: prepareAadhaarTestData func * registry contract tests * feat: registry contract tests * feat: extract fields from qr data bytes * chore: refactor mockData * feat: move minimum age to revealPackedData * feat: create a constant.ts to retrive fields from unpacked bytes * chore: refactor * fix: exports * rebase * rebase * feat: add public signal ,indices mapping * chore: add public output to indices mapping * fix:AADHAAR_PUBLIC_SIGNAL_INDICES * feat: make nullifier public * fix: nullifier cal for disclose circuits * feat: merge isMiniumAgeValid and miniumAge signal * fix: disclsoe test * feat: support for user identifier and secret * chore :refactor * feat: ofac test last name , firstname * feat: add forbidden_countries_list check * feat: add tests for aadhaar (WIP) * failing ofac tests * feat: finish contract tests * fix: merge conflicts * update the common package to be usable in circuits and contracts * lint everything * coderabbit fixes * chore: update name dob,yob aadhaar ofac tree * feat: merge ofac and reverse ofac check into one * test: merged ofac constrain * SELF-253 feat: add user email feedback (#889) * feat: add sentry feedback * add sentry feedback to web * feat: add custom feedback modal & fix freeze on IOS * yarn nice * update lock * feat: show feedback widget on NFC scan issues (#948) * feat: show feedback widget on NFC scan issues * fix ref * clean up * fix report issue screen * abstract send user feedback email logic * fixes * change text to Report Issue * sanitize email and track event messge * remove unnecessary sanitization * add sanitize error message tests * fix tests * save wip. almost done * fix screen test * fix screen test * remove non working test --------- Co-authored-by: Justin Hernandez <[email protected]> Co-authored-by: Justin Hernandez <[email protected]> * chore: centralize license header checks (#952) * chore: centralize license header scripts * chore: run license header checks from root * add header to other files * add header to bundle * add migration script and update check license headers * convert license to mobile sdk * migrate license headers * remove headers from common; convert remaining * fix headers * add license header checks * update unsupported passport screen (#953) * update unsupported passport screen * yarn nice * feat: support new ofac trees * fix: qr extractor tests * chore: remove unassigned age signal * chore: modify timestamp func comment * fix: add constrain on photo bytes delimiter * fix: add range check on minimumAge within 2^7 * fix: range check for country not in list * chore: remove dummy constrain * fix: assert lessthan * fix: check is photoEOI valid * fix: replace maxDataLength with qrPaddedLength for valid del indices * feat: update forbidden countries in disclose and disclose id * feat: convert name to uppercase * fix: add constrain between delimiter and photoEOI * feat: support for phno len 4 and 10 * chore: hard-code attestaion_ID to 3 * feat: calculate nullifier using uppercase name * feat: add real id support * fix: rebase error * chore: refactor * add new nullifier and commitment calc * fix: reuse uppercase name from verify commitment * feat: add a function that will iterate though all pubkeys * chore: skip real id test * chore: yarn format * chore: update yarn.lock * chore: rm trailing / from import * chore: add support for issuing state * chore: linting and types * chore: rm types script from circuits * chore: add license header --------- Co-authored-by: nicoshark <[email protected]> Co-authored-by: turnoffthiscomputer <[email protected]> Co-authored-by: Seshanth.S🐺 <[email protected]> Co-authored-by: turboblitz <[email protected]> Co-authored-by: Justin Hernandez <[email protected]> Co-authored-by: crStiv <[email protected]> Co-authored-by: Justin Hernandez <[email protected]> Co-authored-by: James Niken <[email protected]> Co-authored-by: Kevin Lin <[email protected]> Co-authored-by: leopardracer <[email protected]> Co-authored-by: Olof Andersson <[email protected]> Co-authored-by: vishal <[email protected]> Co-authored-by: Vishalkulkarni45 <[email protected]> Co-authored-by: kevinsslin <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Eric Nakagawa <[email protected]> * fix: CLA not supported (#1027) * fix: CLA not supported * fix "yarn android" building * remove unnecessary commands --------- Co-authored-by: Justin Hernandez <[email protected]> * chore: bump app version v2.6.5 (#1034) * update gem lock * bump build and version * fix app versions * chore: fix nfc passport reader private repo access (#1042) * add internal repo pat * update nfc passport reader location * update workflows to use PAT to access NFC Passport Reader * fix ci * update logic to access private repo * build(android): support 16KB page size (#1043) * build(android): support 16KB page size * fix 16kb * update lock * chore: bump v2.6.5 for release (#1036) * bump build * update to ssh clone to fix local build * update podfile lock * fix version * Feat/build aadhaar (#1044) * feat: build aadhaar circuits as well in the ci * feat: add register aadhaar case handling * fix aadhaar register output after building the cpp circuit (#1045) * fix: metro js crypto module build issues (#1047) * fix sdk build issues * fix build error * sort and fix dependencies * add constants-browserify * feat: add new verifiers (#1049) * feat: add new verifiers * format: contracts * fix: ofac check to aadhaar (#1050) * fix: hub-v2 (#1051) * Add DisclosureVerified event for comprehensive verification tracking (#945) * Add VerificationPerformed event to track verification calls - Added VerificationPerformed event with comprehensive tracking fields - Captures requestor contract, version, attestation ID, chain ID, config ID, user identifier, output, and user data - Enhanced _executeVerificationFlow to return additional tracking data - Event emission placed after verification completion for accurate tracking * chore: run formatter * chore: rename verify event name to DisclosureVerified * move clearPassportData, markCurrentDocumentAsRegistered, reStorePassportDataWithRightCSCA to SDK (#1041) * Move self app store to mobile sdk (#1040) * chore(mobile-sdk-alpha): remove unused tslib dependency (#1053) * remove tslib -- seems unused * remove deps accidentally added to root * build file * remove unused imports (#1055) * fix: sha256 signed attr tests (#1058) * fix mock screen launch (#1059) * Hotfix: Belgium ID cards (#1061) * feat: parse belgium TD1 mrz android * feat: Parse Belgium TD1 MRZ IOS * fix: OFAC trees not found (#1060) * fix: relax OFAC tree response validation * test: cover OFAC tree edge cases * fix stateless * revert and fix types * fix tests * [SELF-723] feat: add structured NFC and Proof logging (#1048) * feat: add structured NFC logging * fix ci * Fix: add deps * logging fixes. use breadcrumbs * fix android build * update SeverityLevel * [SELF-705] feat: add proof event logging (#1057) * feat: add proof event logging * refactor: unify sentry event logging * fix types * fix mock * simplify * code rabbit feedback * fix tests --------- Co-authored-by: seshanthS <[email protected]> * skip on dev (#1063) * don't get fancy just disable (#1064) * saw it building so gonna try (#1065) * Dev (#1074) * chore: bump v2.6.5 rd2 (#1067) * commit wip version bump * remove from building * chore: update tooling dependencies (#1069) * chore: update tooling dependencies * chore: align react typings and node types * update lock * chore: minor fixes across monorepo (#1068) * small fixes * fixes * fix gesture handler error * ci fixes * fix yarn build; add workflow ci (#1075) * add new workspace ci * disable package version check for now * build before checks * format * fix in future pr * feat: add functions for disclosing aadhaar attributes (#1033) * feat: add functions for disclosing aadhaar attributes * format * chore: update monorepo artifacts (#1079) * remove unneeded artifacts, skip building circuits * update md files * cleans up unused parts of sdk interface, adds inline documentation, (#1078) * cleans up unused parts of sdk interface, adds inline documentation, * fix up build * yolo * Feat/aadhaar sdk (#1082) * feat: add aadhaar support to the ts sdk * feat: aadhaar support to go sdk * chore: refactor * move clearPassportData, markCurrentDocumentAsRegistered, reStorePassportDataWithRightCSCA to SDK (#1041) * Move self app store to mobile sdk (#1040) * chore(mobile-sdk-alpha): remove unused tslib dependency (#1053) * remove tslib -- seems unused * remove deps accidentally added to root * build file * remove unused imports (#1055) * fix: sha256 signed attr tests (#1058) * fix mock screen launch (#1059) * Hotfix: Belgium ID cards (#1061) * feat: parse belgium TD1 mrz android * feat: Parse Belgium TD1 MRZ IOS * fix: OFAC trees not found (#1060) * fix: relax OFAC tree response validation * test: cover OFAC tree edge cases * fix stateless * revert and fix types * fix tests * [SELF-723] feat: add structured NFC and Proof logging (#1048) * feat: add structured NFC logging * fix ci * Fix: add deps * logging fixes. use breadcrumbs * fix android build * update SeverityLevel * [SELF-705] feat: add proof event logging (#1057) * feat: add proof event logging * refactor: unify sentry event logging * fix types * fix mock * simplify * code rabbit feedback * fix tests --------- Co-authored-by: seshanthS <[email protected]> * skip on dev (#1063) * don't get fancy just disable (#1064) * saw it building so gonna try (#1065) * chore: bump v2.6.5 rd2 (#1067) * commit wip version bump * remove from building * chore: update tooling dependencies (#1069) * chore: update tooling dependencies * chore: align react typings and node types * update lock * chore: minor fixes across monorepo (#1068) * small fixes * fixes * fix gesture handler error * ci fixes * fix yarn build; add workflow ci (#1075) * add new workspace ci * disable package version check for now * build before checks * format * fix in future pr * feat: add functions for disclosing aadhaar attributes (#1033) * feat: add functions for disclosing aadhaar attributes * format * chore: update monorepo artifacts (#1079) * remove unneeded artifacts, skip building circuits * update md files * chore: update hub contract address * format * fix: add aadhaar in AllIds * chore: bump to v1.1.0-beta --------- Co-authored-by: vishal <[email protected]> Co-authored-by: Leszek Stachowski <[email protected]> Co-authored-by: Aaron DeRuvo <[email protected]> Co-authored-by: Justin Hernandez <[email protected]> Co-authored-by: Seshanth.S🐺 <[email protected]> Co-authored-by: seshanthS <[email protected]> * feat: change to gcp attestation verification (#959) * feat: change to gcp attestation verification * lint * fix e2e test * chore: don't check PCR0 mapping if building the app locally * fmt:fix --------- Co-authored-by: Justin Hernandez <[email protected]> * Mobile SDK: move provingMachine from the app (#1052) * Mobile SDK: move provingMachine from the app * lint, fixes * fix web build? * lint * fix metro build, add deps * update lock files * move the status handlers and proving machine tests * may it be * fix up * yolo --------- Co-authored-by: Justin Hernandez <[email protected]> Co-authored-by: Aaron DeRuvo <[email protected]> * Revert "Mobile SDK: move provingMachine from the app (#1052)" (#1084) This reverts commit 8983ac22688f731bca8890cbf9be9c85b4ac2bf…
Move
useSelfAppStoreto mobile sdkcall trackEvent on selfClient
remove selfClient from proving machine state. IT IS NOT STATE.
properly type return of generatePayload
fixes so we can run yarn format from root
Summary by CodeRabbit
New Features
Refactor
Tests
Chores