fix(types): replace vp_token any with OpenID4VP payload type - #158
Conversation
Signed-off-by: cynox-66 <devj2311@gmail.com>
📝 WalkthroughWalkthroughThe authorization response payload DTO imports the upstream OpenID4VP authorization response payload type and uses it to strengthen the ChangesOpenID4VP Authorization Response Payload Typing
Estimated Code Review Effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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
`@heka-identity-service/src/openid4vc/verification-sessions/dto/authorization-response-payload.dto.ts`:
- Around line 319-321: The vp_token property on AuthorizationResponsePayloadDto
is only marked optional and lacks runtime validation; update the vp_token
declaration to include appropriate class-validator decorators that match
OpenId4VpAuthorizationResponsePayload['vp_token'] — if vp_token is a JWT string
add `@IsString`() (and keep `@IsOptional`()), otherwise if it is an object/array
restore `@ValidateNested`() plus `@Type`(() => YourVpTokenDto) and validate the
nested DTO fields; ensure the decorator set is applied to the
AuthorizationResponsePayloadDto.vp_token property and the nested DTO (if used)
contains the correct validators for the vp_token shape.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 58d677e8-ae3e-4e8c-b64c-eb5b4a260b74
📒 Files selected for processing (1)
heka-identity-service/src/openid4vc/verification-sessions/dto/authorization-response-payload.dto.ts
Summary
Replace the vp_token DTO property type from any with the upstream Credo OpenID4VP payload type.
Changes
Motivation
The DTO currently uses any for vp_token, which bypasses compile-time type checking and can hide type-related issues.
Using the existing upstream Credo type improves type safety, aligns the DTO with the OpenID4VP authorization response structure, and removes an unnecessary any usage without changing runtime behavior.
Testing
Summary by CodeRabbit