Skip to content

Commit

Permalink
refactor: updated webauthn version to latest (9.0.3) (#657)
Browse files Browse the repository at this point in the history
* fido version updated

Signed-off-by: tipusinghaw <tipu.singh@ayanworks.com>

* fix: email auth issue

Signed-off-by: tipusinghaw <tipu.singh@ayanworks.com>

---------

Signed-off-by: tipusinghaw <tipu.singh@ayanworks.com>
  • Loading branch information
tipusinghaw authored and KulkarniShashank committed Sep 6, 2024
1 parent f2124b6 commit 1e31697
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
3 changes: 2 additions & 1 deletion apps/api-gateway/src/fido/fido.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export class FidoService extends BaseService {
}

async generateAuthenticationOption(generateAuthentication: GenerateAuthenticationDto) : Promise<{response: object}> {
const payload = { generateAuthentication };
const {userName} = generateAuthentication;
const payload = { userName };
return this.sendNats(this.fidoServiceProxy, 'generate-authentication-options', payload);
}

Expand Down
2 changes: 1 addition & 1 deletion apps/user/repositories/fido-user.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class FidoUserRepository {
// eslint-disable-next-line camelcase
async checkFidoUserExist(email: string): Promise<user> {
try {
return this.prisma.user.findFirst({
return this.prisma.user.findFirstOrThrow({
where: {
email
}
Expand Down
4 changes: 4 additions & 0 deletions apps/user/src/fido/dtos/fido-user.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ class ResponseDto {
email: string;
}

export class GenerateAuthentication {
userName: string;
}


class VerifyAuthenticationResponseDto {
@ApiProperty()
Expand Down
7 changes: 4 additions & 3 deletions apps/user/src/fido/fido.controller.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Controller, Logger } from '@nestjs/common';
import { MessagePattern } from '@nestjs/microservices';
import { GenerateRegistrationDto, VerifyRegistrationPayloadDto, VerifyAuthenticationPayloadDto, UpdateFidoUserDetailsDto, UserNameDto, credentialDto, updateDeviceDto } from './dtos/fido-user.dto';
import { GenerateRegistrationDto, VerifyRegistrationPayloadDto, VerifyAuthenticationPayloadDto, UpdateFidoUserDetailsDto, UserNameDto, credentialDto, updateDeviceDto, GenerateAuthentication } from './dtos/fido-user.dto';
import { FidoService } from './fido.service';

@Controller('fido')
Expand Down Expand Up @@ -33,8 +33,9 @@ export class FidoController {
* @returns Get authentication response
*/
@MessagePattern({ cmd: 'generate-authentication-options' })
generateAuthenticationOption(payload: GenerateRegistrationDto): Promise<object> {
return this.fidoService.generateAuthenticationOption(payload.email);
generateAuthenticationOption(payload: GenerateAuthentication): Promise<object> {
const { userName } = payload;
return this.fidoService.generateAuthenticationOption(userName);
}
/**
* Description: FIDO User Verification
Expand Down

0 comments on commit 1e31697

Please sign in to comment.