feat: support for clientIdPrefix for HAIP support in presentation flow#1564
feat: support for clientIdPrefix for HAIP support in presentation flow#1564RinkalBhojani merged 2 commits intomainfrom
Conversation
Signed-off-by: Rinkal Bhojani <rinkal.bhojani@ayanworks.com>
📝 WalkthroughWalkthroughConsolidates signer configuration into a new RequestSigner DTO/interface, adds a ClientIdPrefix enum, and updates DTOs, controller, and services to accept and propagate Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In
`@apps/api-gateway/src/oid4vc-verification/dtos/oid4vc-verifier-presentation.dto.ts`:
- Around line 316-324: PresentationRequestDto currently declares requestSigner:
RequestSignerDto while using `@IsOptional`() and an ApiProperty description that
says "Optional", causing a type mismatch and Swagger marking it required; change
the TypeScript property to be optional (requestSigner?: RequestSignerDto) and
update the `@ApiProperty` metadata on requestSigner to explicitly set required:
false (keep `@IsOptional`(), `@ValidateNested`(), and `@Type`(() => RequestSignerDto)
as-is) so runtime validation, TS types, and Swagger docs all agree.
- Around line 303-314: In RequestSignerDto adjust the clientIdPrefix decorators:
remove the contradictory `@IsDefined`() so `@IsOptional`() can work as intended,
change `@ApiProperty`(...) to `@ApiPropertyOptional`(...) to reflect the optional
TypeScript field clientIdPrefix?, and update imports to include
ApiPropertyOptional (remove or stop using ApiProperty for that property).
🧹 Nitpick comments (1)
apps/oid4vc-verification/src/oid4vc-verification.service.ts (1)
254-279: Consider extracting a shared helper to build X5C signer objects.The X5C signer construction at Lines 254–259 (X509_P256) and Lines 274–279 (X509_ED25519) are nearly identical, differing only in the key type passed to
getCurrentActiveCertificate. The intent-based method (Lines 365–385) already consolidates this into a single branch with a ternary. Applying the same pattern here would reduce duplication.Sketch of consolidated approach
- if (sessionRequest.requestSigner.method === SignerOption.X509_P256) { - this.logger.debug('X5C based request signer method selected'); - const activeCertificate = await this.oid4vpRepository.getCurrentActiveCertificate(orgId, x5cKeyType.P256); - // ... validation ... - requestSigner = { - method: SignerMethodOption.X5C, - x5c: [activeCertificate.certificateBase64], - keyId: activeCertificate.keyId, - clientIdPrefix: sessionRequest.requestSigner.clientIdPrefix - }; - } else if (sessionRequest.requestSigner.method === SignerOption.X509_ED25519) { - this.logger.debug('X5C based request signer method selected'); - const activeCertificate = await this.oid4vpRepository.getCurrentActiveCertificate(orgId, x5cKeyType.Ed25519); - // ... identical validation ... - requestSigner = { - method: SignerMethodOption.X5C, - x5c: [activeCertificate.certificateBase64], - keyId: activeCertificate.keyId, - clientIdPrefix: sessionRequest.requestSigner.clientIdPrefix - }; + } else if ( + sessionRequest.requestSigner.method === SignerOption.X509_P256 || + sessionRequest.requestSigner.method === SignerOption.X509_ED25519 + ) { + this.logger.debug('X5C based request signer method selected'); + const keyType = sessionRequest.requestSigner.method === SignerOption.X509_P256 + ? x5cKeyType.P256 + : x5cKeyType.Ed25519; + const activeCertificate = await this.oid4vpRepository.getCurrentActiveCertificate(orgId, keyType); + // ... single validation block ... + requestSigner = { + method: SignerMethodOption.X5C, + x5c: [activeCertificate.certificateBase64], + keyId: activeCertificate.keyId, + clientIdPrefix: sessionRequest.requestSigner.clientIdPrefix + };
apps/api-gateway/src/oid4vc-verification/dtos/oid4vc-verifier-presentation.dto.ts
Show resolved
Hide resolved
apps/api-gateway/src/oid4vc-verification/dtos/oid4vc-verifier-presentation.dto.ts
Show resolved
Hide resolved
Signed-off-by: Rinkal Bhojani <rinkal.bhojani@ayanworks.com>
|



Added support for clientIdPrefix to align with HAIP in presentation flow
Summary by CodeRabbit
New Features
Refactor