Skip to content

Sync Improve WalletConfig and VPTokenSigningResult / UnsignedVPToken changes in library#2504

Open
KiruthikaJeyashankar wants to merge 3 commits into
inji:developfrom
tw-mosip:lsh-feedback-1.0
Open

Sync Improve WalletConfig and VPTokenSigningResult / UnsignedVPToken changes in library#2504
KiruthikaJeyashankar wants to merge 3 commits into
inji:developfrom
tw-mosip:lsh-feedback-1.0

Conversation

@KiruthikaJeyashankar

@KiruthikaJeyashankar KiruthikaJeyashankar commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Description

Wallet Config updates

Rename validatePreRegisteredVerifier → validateTrustedVerifier aligning with the trustedVerifiers convention
Remove supportedRequestUriMethods config

VPTokenSigningResult / UnsignedVPToken Updates

Include id in the VPTokenSigningResult / UnsignedVPToken data

Issue ticket number and link

Dependent PRs

This PR is dependent on

  1. Improve WalletConfig and VPTokenSigningResult / UnsignedVPToken inji-openid4vp-ios-swift#124
  2. Improve WalletConfig and VPTokenSigningResult / UnsignedVPToken inji-openid4vp#182

Summary by CodeRabbit

Summary by CodeRabbit

  • Bug Fixes

    • Updated VP signing flow so unsigned tokens and signing results consistently include an id, and the system now validates that id is present when parsing results.
    • Improved error reporting across VP operations with clearer cause details in logs.
    • Adjusted wallet configuration parsing and trusted verifier handling to better match expected flags.
  • Style

    • Updated the disclosure key label color for improved visual consistency in credential details.

Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com>
Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com>
@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e4989897-d870-40a1-bb10-ef75aa551752

📥 Commits

Reviewing files that changed from the base of the PR and between d2b2c14 and a5cf48d.

📒 Files selected for processing (1)
  • android/app/src/main/java/io/mosip/residentapp/utils/OpenId4VPUtils.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • android/app/src/main/java/io/mosip/residentapp/utils/OpenId4VPUtils.java

Walkthrough

The PR adds id to OpenID4VP token types and propagates it through shared, Android, and iOS token serialization and signing-result parsing. Android wallet config parsing and error logging are updated, and the VC disclosure label color changes.

Changes

OpenID4VP token id propagation and wallet config update

Layer / File(s) Summary
Token type contracts: id field added
shared/openID4VP/openid4vp.types.ts
Removes the unused VC import and adds required id: string fields to UnsignedVPToken and VPTokenSigningResult.
TypeScript helpers and shared flow updates
shared/openID4VP/OpenID4VPHelper.ts, shared/openID4VP/OpenID4VP.ts, machines/openID4VP/openID4VPActions.ts
Propagates id into signDataForVpPreparation, refines isDcqlFlow to accept Record<string, unknown>, removes getSignatureSuite, and adds event.data.cause to setSendVPShareError logging.
Android token serialization and wallet config parsing
android/app/src/main/java/io/mosip/residentapp/utils/OpenId4VPUtils.java
Adds parseUnsignedVPTokens, updates parseVPTokenSigningResults to require and carry id, and changes parseWalletConfig to read validate_trusted_verifier and wire the new trusted-verifier flag into WalletConfig.
Android module error handling and request payload
android/app/src/main/java/io/mosip/residentapp/InjiOpenID4VPModule.java, android/app/src/main/java/io/mosip/residentapp/InjiVCIClientCallback.kt
Delegates constructUnsignedVPToken to parseUnsignedVPTokens, adds Log.e output in rejectWithOpenID4VPExceptions, changes the emitted cause value to a cause-message string, and adds "id" to each signed-VP-token request entry.
iOS token serialization and signing-result parsing
ios/Utils/OpenId4VPUtils.swift
Adds "id" to unsigned VP token JSON output and requires "id" when parsing VPTokenSigningResult, constructing the result with both id and decoded signedData.

VC Card Disclosure Label Color

Layer / File(s) Summary
DisclosureNode label color update
components/VC/Views/VCCardViewContent.tsx
Updates the DisclosureNode text color styling to use Theme.Colors.Details.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

Possibly related PRs

  • inji/inji-wallet#2486: Both PRs adjust wallet configuration handling around trusted verifier interpretation.

Suggested reviewers

  • swatigoel

Poem

🐇 Hop hop, a token found its name,
id now travels through the frame.
Android, iOS, and TS align,
Signed and tracked in tidy line.
The rabbit smiles: one path, one key,
and fewer mystery tokens for me.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 7.69% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is specific and matches the main wallet config and VP token data changes.
Description check ✅ Passed The description covers the required change summary and issue links; only the screenshots section is missing.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with 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.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 (1)
android/app/src/main/java/io/mosip/residentapp/utils/OpenId4VPUtils.java (1)

245-257: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Validate id before constructing VPTokenSigningResult.

id is now required, but this path only asserts non-null; assertions are not reliable runtime validation on Android. Reject missing/null id before decoding/constructing the result.

Suggested fix
       if (vpTokenSigningResultMap == null
         || !vpTokenSigningResultMap.hasKey("signedData")
-        || vpTokenSigningResultMap.isNull("signedData")) {
+        || vpTokenSigningResultMap.isNull("signedData")
+        || !vpTokenSigningResultMap.hasKey("id")
+        || vpTokenSigningResultMap.isNull("id")) {
         continue;
       }
 
       String signedData = vpTokenSigningResultMap.getString("signedData");
       String id = vpTokenSigningResultMap.getString("id");
       byte[] signedDataBytes = Base64.decode(signedData, Base64.URL_SAFE | Base64.NO_WRAP | Base64.NO_PADDING);
 
-      assert id != null;
       formattedVpTokenSigningResults.add(
-        new VPTokenSigningResult(id,signedDataBytes));
+        new VPTokenSigningResult(id, signedDataBytes));
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@android/app/src/main/java/io/mosip/residentapp/utils/OpenId4VPUtils.java`
around lines 245 - 257, The OpenId4VPUtils path that builds VPTokenSigningResult
only asserts id is non-null, so replace that with real runtime validation before
decoding signedData and constructing the result. In the loop that reads
vpTokenSigningResultMap, check the id field alongside signedData, skip or reject
entries with missing/null id, and only call new VPTokenSigningResult(id,
signedDataBytes) when id is present.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@android/app/src/main/java/io/mosip/residentapp/utils/OpenId4VPUtils.java`:
- Around line 81-84: In OpenId4VPUtils, the optional config flag reads for
presentationDefinitionUriSupported and validateTrustedVerifier should not call
getBoolean directly because a present null value can fail instead of falling
back to true. Update these checks to use the existing null-safe boolean helper
already used for optional config flags, so the defaulting behavior stays
consistent when the key is missing or null.

---

Outside diff comments:
In `@android/app/src/main/java/io/mosip/residentapp/utils/OpenId4VPUtils.java`:
- Around line 245-257: The OpenId4VPUtils path that builds VPTokenSigningResult
only asserts id is non-null, so replace that with real runtime validation before
decoding signedData and constructing the result. In the loop that reads
vpTokenSigningResultMap, check the id field alongside signedData, skip or reject
entries with missing/null id, and only call new VPTokenSigningResult(id,
signedDataBytes) when id is present.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2c6df879-aefb-41ef-a3c0-269390039014

📥 Commits

Reviewing files that changed from the base of the PR and between 0bb38f2 and d2b2c14.

📒 Files selected for processing (9)
  • android/app/src/main/java/io/mosip/residentapp/InjiOpenID4VPModule.java
  • android/app/src/main/java/io/mosip/residentapp/InjiVCIClientCallback.kt
  • android/app/src/main/java/io/mosip/residentapp/utils/OpenId4VPUtils.java
  • components/VC/Views/VCCardViewContent.tsx
  • ios/Utils/OpenId4VPUtils.swift
  • machines/openID4VP/openID4VPActions.ts
  • shared/openID4VP/OpenID4VP.ts
  • shared/openID4VP/OpenID4VPHelper.ts
  • shared/openID4VP/openid4vp.types.ts
💤 Files with no reviewable changes (1)
  • shared/openID4VP/OpenID4VP.ts

Comment thread android/app/src/main/java/io/mosip/residentapp/utils/OpenId4VPUtils.java Outdated
@KiruthikaJeyashankar KiruthikaJeyashankar changed the title Lsh feedback 1.0 Sync Improve WalletConfig and VPTokenSigningResult / UnsignedVPToken changes in library Jun 25, 2026
Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com>
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.

1 participant