Skip to content

Conversation

@coodos
Copy link
Contributor

@coodos coodos commented Dec 9, 2025

Description of change

Issue Number

Type of change

  • Update (a change which updates existing functionality)

How the change has been tested

Change checklist

  • I have ensured that the CI Checks pass locally
  • I have removed any unnecessary logic
  • My code is well documented
  • I have signed my commits
  • My code follows the pattern of the application
  • I have self reviewed my code

Summary by CodeRabbit

  • New Features

    • Distinguishes authentication origin (QR scan vs deeplink) to apply the appropriate post-auth flow.
  • Bug Fixes

    • More reliable drawer transitions after QR-initiated login; scanning restarts automatically when applicable.
  • Chores

    • Reduced verbose debug logging and standardized public-key sync checks.
    • API response updated: whois now returns keyBindingCertificates instead of a publicKey field.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 9, 2025

Warning

Rate limit exceeded

@coodos has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 13 minutes and 4 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 9a74267 and 1362a29.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (3)
  • infrastructure/eid-wallet/src/routes/(app)/scan-qr/scanLogic.ts (6 hunks)
  • platforms/emover-api/package.json (1 hunks)
  • platforms/emover-api/src/services/MigrationService.ts (2 hunks)

Walkthrough

Adds an isFromScan writable store to scan QR logic to distinguish scan-origin vs deeplink-origin auth flows; branches auth handling to POST JSON for scan-origin or open a /deeplink-login URL for deeplink-origin. Also removes a localStorage short‑circuit in evault sync and changes the whois response schema.

Changes

Cohort / File(s) Summary
Scan authentication origin tracking
infrastructure/eid-wallet/src/routes/(app)/scan-qr/scanLogic.ts
Added isFromScan: Writable<boolean> to ScanStores, initialized in createScanLogic, exposed in exported stores. handleAuthRequest sets isFromScan = true; handleDeepLinkData sets isFromScan = false. handleAuth now branches: when isFromScan true → POSTs JSON to redirect URL and handles responses/UI transitions; when false → builds/opens /deeplink-login URL with query params.
evault sync short‑circuit removal & log cleanup
infrastructure/eid-wallet/src/lib/global/controllers/evault.ts
Removed the localStorage-based early return guard in syncPublicKey and eliminated several verbose pre/post log statements; core sync flow remains (whois check, key service lookup, PATCH) but without the short-circuit and reduced logging.
WHOIS response shape change
infrastructure/evault-core/src/core/http/server.ts
Replaced publicKey (string

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Inspect isFromScan concurrency/race conditions and whether state persists between flows.
  • Verify POST payload shape, redirect URL handling, and UI drawer state transitions in scanLogic.ts.
  • Review removal of localStorage guard in syncPublicKey for any behavioral regressions.
  • Confirm clients consuming /whois are updated for keyBindingCertificates vs publicKey.

Possibly related PRs

Suggested labels

evault-refactor

Suggested reviewers

  • sosweetham

Poem

I nibbled a QR beneath the moonlit glen,
A little flag — is it scan or deeplink then? 🐰
POSTs whisper, drawers swing, the scanner hops again,
Whois changed its tune and logs grew calm and thin,
A joyful hop of code — a rabbit's tiny win! ✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description is incomplete. While it follows the template structure and marks the change type as 'Update', the 'Description of change', 'Issue Number', and 'How the change has been tested' sections lack substantive details. Add a detailed description of what was changed and why. Specify the issue number if applicable. Provide concrete testing methodology and test cases in the 'How the change has been tested' section.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: better deeplink login context handling' clearly captures the main objective of these changes, which introduce origin tracking and conditional authentication flows for deeplink vs. scan-initiated auth.

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

❤️ Share

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
infrastructure/eid-wallet/src/routes/(app)/scan-qr/scanLogic.ts (2)

297-297: Extract hardcoded app version to a constant.

The app version "0.4.0" is hardcoded in two places. Consider extracting it to a named constant at the module level for easier maintenance and consistency.

Apply this diff to extract the version:

+const APP_VERSION = "0.4.0";
+
 export interface SigningData {

Then update the usage:

                 const payload = {
                     ename: vault.ename,
                     session: get(session) as string,
                     signature: signature,
-                    appVersion: "0.4.0",
+                    appVersion: APP_VERSION,
                 };
                 loginUrl.searchParams.set("ename", vault.ename);
                 loginUrl.searchParams.set("session", get(session) as string);
                 loginUrl.searchParams.set("signature", signature);
-                loginUrl.searchParams.set("appVersion", "0.4.0");
+                loginUrl.searchParams.set("appVersion", APP_VERSION);

Also applies to: 331-331


303-315: Add timeout to fetch request.

The fetch request to submit authentication has no timeout, which could cause the request to hang indefinitely if the server is unresponsive. Consider adding a timeout using AbortController or request configuration.

Example implementation:

+                const controller = new AbortController();
+                const timeoutId = setTimeout(() => controller.abort(), 10000); // 10 second timeout
+
                 const response = await fetch(redirectUrl, {
                     method: "POST",
                     headers: {
                         "Content-Type": "application/json",
                     },
                     body: JSON.stringify(payload),
+                    signal: controller.signal,
                 });
+
+                clearTimeout(timeoutId);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 90e811d and 93a92c5.

📒 Files selected for processing (1)
  • infrastructure/eid-wallet/src/routes/(app)/scan-qr/scanLogic.ts (6 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (4)
infrastructure/eid-wallet/src/routes/(app)/scan-qr/scanLogic.ts (4)

82-82: LGTM: Store declaration and initialization.

The isFromScan store is properly declared in the interface, initialized to false, and exported in the stores object, consistent with other boolean flags in the file.

Also applies to: 147-147, 1440-1440


1192-1192: LGTM: Correctly marks deeplink-origin auth.

The flag is properly set to false for deeplink-origin authentication requests, ensuring the correct flow is taken in handleAuth.


291-323: Verify intentional bypass of sessionStorage deeplink processing.

The scan flow returns early at line 323, skipping the sessionStorage deeplink processing logic (lines 342-419) that handles navigation after auth completion. This means scan-origin authentications don't process any pending deeplink data. Confirm this is intentional, as it changes the navigation behavior for scan-based auth compared to the previous implementation.

If scan-origin auth should also process pending deeplinks, the early return should be moved after the sessionStorage processing block.


460-460: No action required—flag state management is correct.

The isFromScan flag is properly managed across authentication flows. It is explicitly set to true for scan-origin requests (line 460) and to false for deeplink-origin requests (line 1192). Each new auth request establishes the correct flag state, preventing any state carryover issues between scan and deeplink authentications.

@coodos coodos force-pushed the feat/tauri-deeplink-issue branch from 93a92c5 to 5552f33 Compare December 9, 2025 17:55
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
infrastructure/eid-wallet/src/routes/(app)/scan-qr/scanLogic.ts (1)

82-82: isFromScan origin tracking is wired consistently; consider resetting on teardown

The isFromScan store is added to ScanStores, initialized, toggled in handleAuthRequest (scan → true) and handleDeepLinkData for auth (deeplink → false), and exported via stores, so handleAuth and any consumers can reliably distinguish origin. Functionally this is sound.

If you expect external consumers to treat isFromScan as “origin of the current auth flow” rather than “origin of the last auth flow”, consider resetting it (e.g. to false) in teardown paths like closeDrawer, handleSuccessOkay, and at the end of handleAuth (both branches). That would avoid any chance of stale true lingering when no auth is active.

Also applies to: 147-147, 451-462, 1171-1193, 1440-1440

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 93a92c5 and 5552f33.

📒 Files selected for processing (1)
  • infrastructure/eid-wallet/src/routes/(app)/scan-qr/scanLogic.ts (6 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build
  • GitHub Check: lint
🔇 Additional comments (1)
infrastructure/eid-wallet/src/routes/(app)/scan-qr/scanLogic.ts (1)

289-337: Scan vs. deeplink branching in handleAuth looks correct and robust

The new fromScan branch cleanly separates scan‑origin auth (server POST with JSON, early return) from deeplink‑origin auth (construct /deeplink-login URL and open it), while reusing the same signed session payload and keeping existing error handling. Early‑returning for the scan case avoids accidentally running the deep‑link redirect logic with stale deepLinkData, which matches the PR’s stated intent.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
infrastructure/evault-core/src/core/http/server.ts (1)

174-183: Consider simplifying redundant logging.

The individual warnings for missing registryUrl, sharedSecret, or no keys are redundant with the configuration status already logged at lines 130-131. Consider removing or consolidating these to reduce log noise.

Apply this diff to remove redundant warnings:

-    } else {
-        if (!registryUrl) {
-            console.warn("[WHOIS] Cannot generate certificates: Registry URL not configured");
-        }
-        if (!sharedSecret) {
-            console.warn("[WHOIS] Cannot generate certificates: Shared secret not configured");
-        }
-        if (publicKeys.length === 0) {
-            console.log("[WHOIS] No public keys to generate certificates for");
-        }
-    }
+    }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5552f33 and 03110dc.

📒 Files selected for processing (2)
  • infrastructure/eid-wallet/src/lib/global/controllers/evault.ts (5 hunks)
  • infrastructure/evault-core/src/core/http/server.ts (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • infrastructure/eid-wallet/src/lib/global/controllers/evault.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: test
  • GitHub Check: build
🔇 Additional comments (4)
infrastructure/evault-core/src/core/http/server.ts (4)

97-99: LGTM! Clear request/response framing.

The visual separators and consistent [WHOIS] prefix make it easy to trace individual requests in logs.

Also applies to: 190-191


106-123: LGTM! Comprehensive database retrieval logging.

The logging provides good visibility into key retrieval outcomes without exposing full keys. Error handling remains sound.


130-131: LGTM! Configuration status visibility.

Logging config presence without exposing values is good practice for troubleshooting.


136-166: LGTM! Per-certificate progress tracking.

The loop change from for-of to indexed for enables clear per-iteration logging. Error handling correctly continues processing remaining keys when individual certificate generation fails.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 03110dc and 9a74267.

📒 Files selected for processing (2)
  • infrastructure/eid-wallet/src/lib/global/controllers/evault.ts (1 hunks)
  • infrastructure/evault-core/src/core/http/server.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: test
  • GitHub Check: test-web3-adapter-integration
  • GitHub Check: build
🔇 Additional comments (1)
infrastructure/eid-wallet/src/lib/global/controllers/evault.ts (1)

122-123: LGTM! Correctly consumes the updated API schema.

The code correctly retrieves keyBindingCertificates as an array from the whois response, which aligns with the schema change in infrastructure/evault-core/src/core/http/server.ts.

@xPathin xPathin merged commit 565a325 into main Dec 9, 2025
6 checks passed
@coodos coodos deleted the feat/tauri-deeplink-issue branch December 9, 2025 18:31
@coderabbitai coderabbitai bot mentioned this pull request Dec 10, 2025
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants