fix(syncing-server): calling auth server for user key params

This commit is contained in:
Karol Sójko
2023-10-06 15:56:10 +02:00
parent a6a19a391e
commit 51ca8229b8
3 changed files with 4 additions and 8 deletions
@@ -1,5 +1,5 @@
import { KeyParamsData } from '@standardnotes/responses'
export interface AuthHttpServiceInterface {
getUserKeyParams(dto: { email?: string; uuid?: string; authenticated: boolean }): Promise<KeyParamsData>
getUserKeyParams(userUuid: string): Promise<KeyParamsData>
}
@@ -42,10 +42,7 @@ export class EmailBackupRequestedEventHandler implements DomainEventHandlerInter
): Promise<void> {
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}: ${
@@ -9,15 +9,14 @@ export class AuthHttpService implements AuthHttpServiceInterface {
private authServerUrl: string,
) {}
async getUserKeyParams(dto: { email?: string; uuid?: string; authenticated: boolean }): Promise<KeyParamsData> {
async getUserKeyParams(userUuid: string): Promise<KeyParamsData> {
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,