import type FavaLibMediator from '../../FavaLibMediator.mjs'; import Command from '../BaseCommand.mjs'; import type { DeviceFriendlyName, DeviceId, DeviceType } from '../../interfaces/SyncTypes.mjs'; export interface ChangeDeviceInfoData { deviceId: DeviceId; newDeviceInfo: { deviceFriendlyName?: DeviceFriendlyName; deviceType: DeviceType; }; } /** * Represents a command that when executed changes the device info of a sync device */ declare class ChangeDeviceInfoCommand extends Command { /** * Creates a new ChangeDeviceMetaCommand instance. * @inheritdoc * @param data - The id of the device to change and the new meta info */ constructor(data: ChangeDeviceInfoData, id?: string, timestamp?: number, version?: string, fromRemote?: boolean, fromDeviceId?: DeviceId); /** * Executes the command to change the device info * @inheritdoc * @throws {InvalidCommandError} If the referenced device cannot be found */ execute(mediator: FavaLibMediator): Promise; /** * @inheritdoc */ createUndoCommand(): Command; /** * Validates the command data. * * A remote rename used to return true unconditionally -- "we can only * validate this command locally" -- which made this the one ingest path with * no bound at all: any peer could set any device's friendly name to anything * of any length. Two things follow from that, and both are checked here now. * * **A peer may rename only itself.** `fromDeviceId` is the device whose * signature SyncManager verified, so requiring it to equal the device being * renamed is a real check rather than a comparison of two attacker-chosen * strings. It matters more than it looks: the friendly name is what a user * reads when deciding whether a device belongs, and a peer able to write * anyone's name can dress its own device as the user's phone. That is why * `getSyncDevices` reports a key fingerprint too -- a name is chosen, a * fingerprint is derived. * * **The length bounds apply to both paths**, since a remote name lands in * the same vault as a local one. * @inheritdoc */ validate(mediator: FavaLibMediator): boolean; } export default ChangeDeviceInfoCommand;