From 51ca8229b8d5ebb3b4573a2a9da12dd8f15bf2ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20S=C3=B3jko?= Date: Fri, 6 Oct 2023 15:56:10 +0200 Subject: [PATCH] fix(syncing-server): calling auth server for user key params --- .../src/Domain/Auth/AuthHttpServiceInterface.ts | 2 +- .../src/Domain/Handler/EmailBackupRequestedEventHandler.ts | 5 +---- packages/syncing-server/src/Infra/HTTP/AuthHttpService.ts | 5 ++--- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/syncing-server/src/Domain/Auth/AuthHttpServiceInterface.ts b/packages/syncing-server/src/Domain/Auth/AuthHttpServiceInterface.ts index 2a3ebc8f2..2b1b0feb7 100644 --- a/packages/syncing-server/src/Domain/Auth/AuthHttpServiceInterface.ts +++ b/packages/syncing-server/src/Domain/Auth/AuthHttpServiceInterface.ts @@ -1,5 +1,5 @@ import { KeyParamsData } from '@standardnotes/responses' export interface AuthHttpServiceInterface { - getUserKeyParams(dto: { email?: string; uuid?: string; authenticated: boolean }): Promise + getUserKeyParams(userUuid: string): Promise } diff --git a/packages/syncing-server/src/Domain/Handler/EmailBackupRequestedEventHandler.ts b/packages/syncing-server/src/Domain/Handler/EmailBackupRequestedEventHandler.ts index cae1ebd69..d7c59836c 100644 --- a/packages/syncing-server/src/Domain/Handler/EmailBackupRequestedEventHandler.ts +++ b/packages/syncing-server/src/Domain/Handler/EmailBackupRequestedEventHandler.ts @@ -42,10 +42,7 @@ export class EmailBackupRequestedEventHandler implements DomainEventHandlerInter ): Promise { let authParams: KeyParamsData try { - authParams = await this.authHttpService.getUserKeyParams({ - uuid: event.payload.userUuid, - authenticated: false, - }) + authParams = await this.authHttpService.getUserKeyParams(event.payload.userUuid) } catch (error) { this.logger.error( `Could not get user key params from auth service for user ${event.payload.userUuid}: ${ diff --git a/packages/syncing-server/src/Infra/HTTP/AuthHttpService.ts b/packages/syncing-server/src/Infra/HTTP/AuthHttpService.ts index 27653aeab..06f8dd3cf 100644 --- a/packages/syncing-server/src/Infra/HTTP/AuthHttpService.ts +++ b/packages/syncing-server/src/Infra/HTTP/AuthHttpService.ts @@ -9,15 +9,14 @@ export class AuthHttpService implements AuthHttpServiceInterface { private authServerUrl: string, ) {} - async getUserKeyParams(dto: { email?: string; uuid?: string; authenticated: boolean }): Promise { + async getUserKeyParams(userUuid: string): Promise { const keyParamsResponse = await this.httpClient.request({ method: 'GET', timeout: 10000, headers: { Accept: 'application/json', }, - url: `${this.authServerUrl}/users/params`, - params: dto, + url: `${this.authServerUrl}/users/params?uuid=${userUuid}`, validateStatus: /* istanbul ignore next */ (status: number) => status >= 200 && status < 500,