diff --git a/libs/common/src/auth/abstractions/devices-api.service.abstraction.ts b/libs/common/src/auth/abstractions/devices-api.service.abstraction.ts index 92f0ebf1667..ede49fba4bc 100644 --- a/libs/common/src/auth/abstractions/devices-api.service.abstraction.ts +++ b/libs/common/src/auth/abstractions/devices-api.service.abstraction.ts @@ -20,10 +20,7 @@ export abstract class DevicesApiServiceAbstraction { deviceKeyEncryptedDevicePrivateKey: string, ) => Promise; - updateTrust: ( - updateDevicesTrustRequestModel: UpdateDevicesTrustRequest, - deviceIdentifier: string, - ) => Promise; + updateTrust: (updateDevicesTrustRequestModel: UpdateDevicesTrustRequest) => Promise; getDeviceKeys: ( deviceIdentifier: string, @@ -31,11 +28,10 @@ export abstract class DevicesApiServiceAbstraction { ) => Promise; /** - * Notifies the server that the device has a device key, but didn't receive any associated decryption keys. + * Notifies the server that the current device has a device key, but didn't receive any associated decryption keys. * Note: For debugging purposes only. - * @param deviceIdentifier - current device identifier */ - postDeviceTrustLoss: (deviceIdentifier: string) => Promise; + postDeviceTrustLoss: () => Promise; /** * Deactivates a device diff --git a/libs/common/src/auth/abstractions/devices/devices.service.abstraction.ts b/libs/common/src/auth/abstractions/devices/devices.service.abstraction.ts index ba6890947c1..135a6c6206f 100644 --- a/libs/common/src/auth/abstractions/devices/devices.service.abstraction.ts +++ b/libs/common/src/auth/abstractions/devices/devices.service.abstraction.ts @@ -5,7 +5,6 @@ import { DeviceView } from "./views/device.view"; export abstract class DevicesServiceAbstraction { abstract getDevices$(): Observable>; - abstract getDeviceByIdentifier$(deviceIdentifier: string): Observable; abstract isDeviceKnownForUser$(email: string, deviceIdentifier: string): Observable; abstract updateTrustedDeviceKeys$( deviceIdentifier: string, diff --git a/libs/common/src/auth/services/device-trust.service.implementation.ts b/libs/common/src/auth/services/device-trust.service.implementation.ts index 15c12b7a39a..d139382ddb1 100644 --- a/libs/common/src/auth/services/device-trust.service.implementation.ts +++ b/libs/common/src/auth/services/device-trust.service.implementation.ts @@ -252,7 +252,7 @@ export class DeviceTrustService implements DeviceTrustServiceAbstraction { "[Device trust rotation] Posting device trust update with current device:", deviceIdentifier, ); - await this.devicesApiService.updateTrust(trustRequest, deviceIdentifier); + await this.devicesApiService.updateTrust(trustRequest); this.logService.info("[Device trust rotation] Device trust update posted successfully."); } @@ -359,8 +359,7 @@ export class DeviceTrustService implements DeviceTrustServiceAbstraction { } async recordDeviceTrustLoss(): Promise { - const deviceIdentifier = await this.appIdService.getAppId(); - await this.devicesApiService.postDeviceTrustLoss(deviceIdentifier); + await this.devicesApiService.postDeviceTrustLoss(); } private getSecureStorageOptions(userId: UserId): StorageOptions { diff --git a/libs/common/src/auth/services/devices-api.service.implementation.ts b/libs/common/src/auth/services/devices-api.service.implementation.ts index cf760effbdf..a5e79492161 100644 --- a/libs/common/src/auth/services/devices-api.service.implementation.ts +++ b/libs/common/src/auth/services/devices-api.service.implementation.ts @@ -73,10 +73,7 @@ export class DevicesApiServiceImplementation implements DevicesApiServiceAbstrac return new DeviceResponse(result); } - async updateTrust( - updateDevicesTrustRequestModel: UpdateDevicesTrustRequest, - deviceIdentifier: string, - ): Promise { + async updateTrust(updateDevicesTrustRequestModel: UpdateDevicesTrustRequest): Promise { await this.apiService.send( "POST", "/devices/update-trust", @@ -84,9 +81,6 @@ export class DevicesApiServiceImplementation implements DevicesApiServiceAbstrac true, false, null, - (headers) => { - headers.set("Device-Identifier", deviceIdentifier); - }, ); } @@ -104,18 +98,8 @@ export class DevicesApiServiceImplementation implements DevicesApiServiceAbstrac return new ProtectedDeviceResponse(result); } - async postDeviceTrustLoss(deviceIdentifier: string): Promise { - await this.apiService.send( - "POST", - "/devices/lost-trust", - null, - true, - false, - null, - (headers) => { - headers.set("Device-Identifier", deviceIdentifier); - }, - ); + async postDeviceTrustLoss(): Promise { + await this.apiService.send("POST", "/devices/lost-trust", null, true, false); } async deactivateDevice(deviceId: string): Promise { diff --git a/libs/common/src/services/api.service.ts b/libs/common/src/services/api.service.ts index ad59ad0837a..41fd40afcb4 100644 --- a/libs/common/src/services/api.service.ts +++ b/libs/common/src/services/api.service.ts @@ -1913,6 +1913,7 @@ export class ApiService implements ApiServiceAbstraction { let requestBody: any = null; const headers = new Headers({ "Device-Type": this.deviceType, + "Device-Identifier": await this.appIdService.getAppId(), }); if (flagEnabled("prereleaseBuild")) {