* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved. * @license GNU General Public License version 3 or later; see LICENSE * * Custom field for SSH private key input. * Supports both file upload (via FileReader JS) and paste-in textarea. * The key content is stored in the database, not as a file on disk. */ namespace Joomla\Component\MokoSuiteBackup\Administrator\Field; defined('_JEXEC') or die; use Joomla\CMS\Form\FormField; use Joomla\CMS\Language\Text; class SshKeyField extends FormField { protected $type = 'SshKey'; protected function getInput(): string { $value = $this->value ?? ''; $id = $this->id; $name = $this->name; $decoded = !empty($value) ? (base64_decode($value, true) ?: '') : ''; $hasKey = !empty($value) && ($value === '__KEEP_EXISTING__' || str_contains($value, 'PRIVATE KEY') || str_contains($decoded, 'PRIVATE KEY')); $html = '