import { Observable } from "rxjs"; import { EncString } from "../../platform/models/domain/enc-string"; import { UserId } from "../../types/guid"; import { DeviceKey, UserKey } from "../../types/key"; import { DeviceResponse } from "../abstractions/devices/responses/device.response"; export abstract class DeviceTrustCryptoServiceAbstraction { supportsDeviceTrust$: Observable; /** * @description Retrieves the users choice to trust the device which can only happen after decryption * Note: this value should only be used once and then reset */ getShouldTrustDevice: (userId: UserId) => Promise; setShouldTrustDevice: (userId: UserId, value: boolean) => Promise; trustDeviceIfRequired: (userId: UserId) => Promise; trustDevice: (userId: UserId) => Promise; /** Retrieves the device key if it exists from state or secure storage if supported for the active user. */ getDeviceKey: (userId: UserId) => Promise; decryptUserKeyWithDeviceKey: ( userId: UserId, encryptedDevicePrivateKey: EncString, encryptedUserKey: EncString, deviceKey: DeviceKey, ) => Promise; rotateDevicesTrust: ( userId: UserId, newUserKey: UserKey, masterPasswordHash: string, ) => Promise; }