diff --git a/apps/agent/README.md b/apps/agent/README.md index 4ac3348f0ac105fab17515d54b5b7442a06ea0b9..63a0c6113ee88579512ff090302b25584e202825 100644 --- a/apps/agent/README.md +++ b/apps/agent/README.md @@ -1,4 +1,4 @@ -# OCM ENGINE - AGENT +# OCM ENGINE - AGENT Agent service is a wrapper around @ocm-engine/askar library. diff --git a/libs/askar/src/askar-rest/rest.controller.ts b/libs/askar/src/askar-rest/rest.controller.ts index d6417ddbe49d54c20045173c0bfa441e489161e3..a1079c9a0d853dc7ffbfed6a188946040a94641b 100644 --- a/libs/askar/src/askar-rest/rest.controller.ts +++ b/libs/askar/src/askar-rest/rest.controller.ts @@ -44,9 +44,11 @@ export class RestController { async acceptInvitation( @Body() createInvitationDto: CreateInvitationResponseDto, ) { - return this.agentService.acceptInvitation( - createInvitationDto.invitationUrl, - ); + const url = + createInvitationDto.invitationUrl || + createInvitationDto.shortInvitationUrl; + + return this.agentService.acceptInvitation(url); } @Get("/connections") diff --git a/libs/dtos/src/dtos/responses/create.invitation.response.dto.ts b/libs/dtos/src/dtos/responses/create.invitation.response.dto.ts index e7dc02d0933dd50a7929c3110d166afb40a776ba..f617fe2715e8ed8bc2360bfc04d2bb9d8b688fb3 100644 --- a/libs/dtos/src/dtos/responses/create.invitation.response.dto.ts +++ b/libs/dtos/src/dtos/responses/create.invitation.response.dto.ts @@ -1,13 +1,19 @@ +import { IsString, ValidateIf } from "class-validator"; + export class CreateInvitationResponseDto { /** * Example of long invitation url * @example "http://0.0.0.0:8001?oob=eyJAdHlwZSI6Imh0dHBzOi8vZGlkY29tbS5vcmcvb3V0LW9mLWJhbmQvMS4xL2ludml0YXRpb24iLCJAaWQiOiIzYWExNGIzNC04YTk5LTQxY2UtYTY3NC1jODUxYmVhMTIxMWEiLCJsYWJlbCI6IkRFeGNWYXNkX0FHRU5UXzQ1IiwiYWNjZXB0IjpbImRpZGNvbW0vYWlwMSIsImRpZGNvbW0vYWlwMjtlbnY9cmZjMTkiXSwiaGFuZHNoYWtlX3Byb3RvY29scyI6WyJodHRwczovL2RpZGNvbW0ub3JnL2RpZGV4Y2hhbmdlLzEuMCIsImh0dHBzOi8vZGlkY29tbS5vcmcvY29ubmVjdGlvbnMvMS4wIl0sInNlcnZpY2VzIjpbeyJpZCI6IiNpbmxpbmUtMCIsInNlcnZpY2VFbmRwb2ludCI6Imh0dHA6Ly8wLjAuMC4wOjgwMDEiLCJ0eXBlIjoiZGlkLWNvbW11bmljYXRpb24iLCJyZWNpcGllbnRLZXlzIjpbImRpZDprZXk6ejZNa3VFcHllc1pNa3k0a1BpQzhEOEplZERlcm55YTFuaTREMUF3ZmdnWWt6YmR4Il0sInJvdXRpbmdLZXlzIjpbXX1dfQ" */ + @IsString() + @ValidateIf((o) => o.shortInvitationUrl === undefined) public invitationUrl: string; /** * * @example "http://0.0.0.0:8001/invitations/85a7c179-122b-4d2d-9a86-d92ad31cef2b" */ + @IsString() + @ValidateIf((o) => o.invitationUrl === undefined) public shortInvitationUrl: string; }