import type FavaLibMediator from '../../FavaLibMediator.mjs'; import Command from '../BaseCommand.mjs'; import type { DeviceId, DeviceInfo } from '../../interfaces/SyncTypes.mjs'; import type { PublicKey, SigningPublicKey } from '../../interfaces/CryptoLib.mjs'; export interface AddSyncDeviceData { deviceId: DeviceId; publicKey: PublicKey; signingPublicKey: SigningPublicKey; deviceInfo: DeviceInfo; } /** * Represents a command that when executed add an entry to the vault. */ declare class AddSyncDeviceCommand extends Command { /** * Creates a new AddSyncDeviceCommand instance. * @inheritdoc * @param data - The data of the entry to be added. */ constructor(data: AddSyncDeviceData, id?: string, timestamp?: number, version?: string, fromRemote?: boolean, fromDeviceId?: DeviceId); /** * Executes the command to add a sync device * @inheritdoc * @throws {InvalidCommandError} If the command data is invalid. */ execute(mediator: FavaLibMediator): Promise; /** * @inheritdoc */ createUndoCommand(): Command; /** * Says why the command data is unusable. * * A shape gate only, matching the tier AddEntryCommand applies to a remote * entry. It does **not** by itself make device enrolment safe: a well formed * record carrying an attacker's public keys passes every check here. * * The checks that matter are elsewhere and deliberately so. This command must * arrive signed by a device already in the peer list * (`SyncManager.verifyCommandEnvelope`), so enrolment is closed to anyone * merely holding a public key; and `SyncManager.addSyncDevice` pins keys on * first receipt, refuses a device this vault removed, and announces a * peer-introduced device rather than letting it arrive silently. Peer trust * is flat, so a peer enrolling a device is surfaced rather than blocked. * @returns Null when the data is usable, otherwise the reason it is not. */ invalidReason(): string | null; /** * Validates the command data. * @returns True if the command data is valid, false otherwise. */ validate(): boolean; } export default AddSyncDeviceCommand;