Repository navigation
feat: added consent notice and intent mapping logic #1584
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; | ||
| import { IsDefined, IsOptional, IsString, IsUrl, IsUUID } from 'class-validator'; | ||
|
|
||
| export class CreateIntentNoticeDto { | ||
| @ApiProperty({ description: 'Intent ID to associate the notice with', example: 'uuid-of-intent' }) | ||
| @IsDefined() | ||
| @IsUUID() | ||
| intentId: string; | ||
|
|
||
| @ApiProperty({ description: 'URL of the notice', example: 'https://example.com/notice' }) | ||
| @IsDefined() | ||
| @IsString() | ||
| noticeUrl: string; | ||
|
Comment on lines
+10
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Verify current validation decorators and where CreateIntentNoticeDto is used.
rg -n -C2 'class CreateIntentNoticeDto|class UpdateIntentNoticeDto|noticeUrl|IsString|IsUrl' apps/api-gateway/src/oid4vc-verification/dtos/create-intent-notice.dto.ts
rg -n -C2 'CreateIntentNoticeDto|noticeUrl' apps/api-gateway/src/ecosystem apps/api-gateway/src/oid4vc-verificationRepository: credebl/platform Length of output: 4690 Enforce URL validation consistently for Line 10-13 allows any string on create, while line 22-25 requires a valid URL on update. This inconsistency permits invalid URLs to be persisted at creation time, failing validation only during updates. 🔧 Proposed fix-import { IsDefined, IsOptional, IsString, IsUrl, IsUUID } from 'class-validator';
+import { IsDefined, IsOptional, IsUrl, IsUUID } from 'class-validator';
@@
`@ApiProperty`({ description: 'URL of the notice', example: 'https://example.com/notice' })
`@IsDefined`()
- `@IsString`()
+ `@IsUrl`()
noticeUrl: string;Also applies to: 22-25 🤖 Prompt for AI Agents
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. URL validation is implemented in service file There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: Length of output: 1865
However, there is a bug in that helper worth fixing: the - const response = await fetch(noticeUrl);
+ const response = await fetch(noticeUrl, { signal: controller.signal });Regarding the original comment, while DTO-level ✏️ Learnings added
|
||
|
|
||
| @ApiPropertyOptional({ description: 'Organization ID (optional)', example: 'uuid-of-org' }) | ||
| @IsOptional() | ||
| @IsUUID() | ||
| orgId?: string; | ||
| } | ||
|
|
||
| export class UpdateIntentNoticeDto { | ||
| @ApiPropertyOptional({ description: 'URL of the notice', example: 'https://example.com/notice' }) | ||
| @IsOptional() | ||
| @IsUrl() | ||
| noticeUrl?: string; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -319,6 +319,7 @@ export class Oid4vcVerificationController { | |
| description: 'Verification presentation created successfully.', | ||
| type: ApiResponseDto | ||
| }) | ||
| @ApiQuery({ name: 'ecosystemId', required: true }) | ||
| @ApiBearerAuth() | ||
| @Roles(OrgRoles.OWNER) | ||
| @UseGuards(AuthGuard('jwt'), OrgRolesGuard) | ||
|
|
@@ -341,19 +342,29 @@ export class Oid4vcVerificationController { | |
| }) | ||
| ) | ||
| verifierId: string, | ||
| @Query( | ||
| 'ecosystemId', | ||
| new ParseUUIDPipe({ | ||
| exceptionFactory: (): Error => { | ||
| throw new BadRequestException('Invalid ecosystem ID'); | ||
| } | ||
| }) | ||
| ) | ||
| ecosystemId: string, | ||
| @User() user: user, | ||
| @Body() createIntentDto: CreateIntentBasedVerificationDto, | ||
| @Res() res: Response | ||
| ): Promise<Response> { | ||
| this.logger.debug( | ||
| `[createIntentBasedVerificationPresentation] Called with orgId=${orgId}, verifierId=${verifierId}, intent=${createIntentDto?.intent}, user=${user.id}` | ||
| `[createIntentBasedVerificationPresentation] Called with orgId=${orgId}, verifierId=${verifierId}, intent=${createIntentDto?.intent}, ecosystemId=${ecosystemId}, user=${user.id}` | ||
| ); | ||
|
|
||
| const presentation = await this.oid4vcVerificationService.createIntentBasedVerificationPresentation( | ||
| orgId, | ||
| verifierId, | ||
| createIntentDto, | ||
| user | ||
| user, | ||
| ecosystemId | ||
|
Comment on lines
+345
to
+367
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -u
echo "== createIntentBasedVerificationPresentation implementations =="
rg -n -C8 '\bcreateIntentBasedVerificationPresentation\s*\(' \
apps/api-gateway/src/oid4vc-verification/oid4vc-verification.service.ts \
apps/oid4vc-verification/src/oid4vc-verification.service.ts || true
echo
echo "== org/ecosystem scoping around downstream lookups =="
rg -n -C6 '\becosystemId\b|\borgId\b|findUnique|findFirst|where:' \
apps/api-gateway/src/oid4vc-verification/oid4vc-verification.service.ts \
apps/oid4vc-verification/src/oid4vc-verification.service.ts \
apps/ecosystem/src/ecosystem.service.ts \
apps/ecosystem/repositories/ecosystem.repository.ts || trueRepository: credebl/platform Length of output: 50373 🏁 Script executed: #!/bin/bash
set -u
# Read the api-gateway service implementation
echo "=== API-Gateway Oid4vcVerificationService.createIntentBasedVerificationPresentation ==="
sed -n '24,80p' apps/api-gateway/src/oid4vc-verification/oid4vc-verification.service.ts
echo
echo "=== Check for org/ecosystem validation in the service before intent operations ==="
rg -n -B5 -A10 'oid4vpProxy\.|ecosystemId|orgId' \
apps/api-gateway/src/oid4vc-verification/oid4vc-verification.service.ts \
| head -80Repository: credebl/platform Length of output: 5978 🏁 Script executed: #!/bin/bash
set -u
# Read the core oid4vc-verification service around the createIntentBasedVerificationPresentation method
echo "=== Core Service Implementation (lines 309-400) ==="
wc -l apps/oid4vc-verification/src/oid4vc-verification.service.ts
sed -n '309,400p' apps/oid4vc-verification/src/oid4vc-verification.service.tsRepository: credebl/platform Length of output: 3898 🏁 Script executed: #!/bin/bash
set -u
echo "=== Search for 'get-intent-template-by-intent-and-org' handler ==="
rg -n 'get-intent-template-by-intent-and-org' --type ts
echo
echo "=== Search for intent template fetching logic with orgId scoping ==="
rg -n -B5 -A15 'intentName|intent.*template.*orgId' \
apps/ecosystem/src/ecosystem.service.ts \
apps/oid4vc-verification/src/oid4vc-verification.service.ts \
2>/dev/null | head -100Repository: credebl/platform Length of output: 5909 🏁 Script executed: #!/bin/bash
set -u
echo "=== Repository implementation of getIntentTemplateByIntentAndOrg ==="
rg -n -A30 'async getIntentTemplateByIntentAndOrg' \
apps/ecosystem/repositories/ecosystem.repository.tsRepository: credebl/platform Length of output: 1279 🏁 Script executed: #!/bin/bash
set -u
echo "=== Ecosystem controller handler for get-intent-template-by-intent-and-org ==="
sed -n '237,255p' apps/ecosystem/src/ecosystem.controller.tsRepository: credebl/platform Length of output: 698 Verify The downstream template lookup (apps/ecosystem/repositories/ecosystem.repository.ts, line 820-824) does not validate that the supplied Add a check confirming 🤖 Prompt for AI Agents |
||
| ); | ||
|
|
||
| this.logger.debug(`[createIntentBasedVerificationPresentation] Presentation created successfully`); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.