'integer', 'secret' => 'encrypted', 'passphrase' => 'encrypted', ]; /** The single configured host login, or null when the operator hasn't set one up yet. */ public static function current(): ?self { return static::query()->orderBy('id')->first(); } /** * A TRANSIENT Server (never persisted) that points SSH tooling — FleetService, DockerService — * at the Clusev host itself, reusing the encrypted host login. The SshCredential is likewise * transient; its encrypted 'secret' cast round-trips the plaintext back for CredentialVault. * verifyHostKey skips pinning a non-persisted server, so this creates no fleet row. */ public function toServer(): Server { $cred = new SshCredential(['username' => $this->username, 'auth_type' => $this->auth_type]); $cred->secret = $this->secret; if ($this->passphrase) { $cred->passphrase = $this->passphrase; } $server = new Server([ 'name' => 'Clusev Host', 'ip' => $this->host, 'ssh_port' => $this->port, 'status' => 'online', ]); $server->setRelation('credential', $cred); return $server; } }