feat(hosts): manage servers and encrypted SSH credentials in UI (#7)
This commit is contained in:
@@ -126,3 +126,38 @@ export type ServerEvent =
|
||||
export type TerminalClientMessage =
|
||||
| { type: "input"; data: string }
|
||||
| { type: "resize"; cols: number; rows: number };
|
||||
|
||||
// ---- host management (#7) ----------------------------------------------------
|
||||
export type HostCredentialInput =
|
||||
| { type: "shellbook" }
|
||||
| { type: "password"; password: string }
|
||||
| { type: "privateKey"; privateKey: string; passphrase?: string };
|
||||
export interface HostCredentialMetadata {
|
||||
type: "shellbook" | "password" | "privateKey";
|
||||
fingerprint?: string;
|
||||
setAt?: string;
|
||||
}
|
||||
// GET /api/host-management
|
||||
export interface HostInventoryResponse {
|
||||
hosts: (HostInfo & { credential: HostCredentialMetadata })[];
|
||||
version: string;
|
||||
publicKey: string;
|
||||
certificateSupport: { available: false; reason: string };
|
||||
}
|
||||
// POST /api/host-management; PUT /api/host-management/:name
|
||||
export interface SaveHostRequest { host: HostInfo; baseVersion: string }
|
||||
// DELETE /api/host-management/:name {baseVersion}; returns {version}.
|
||||
// PUT /api/host-management/:name/credential (write-only); returns metadata.
|
||||
// DELETE /api/host-management/:name/credential -> ShellBook key default.
|
||||
// GET /api/host-management/:name/install-key -> {script}.
|
||||
// POST /api/host-management/:name/action -> HostActionResponse.
|
||||
export interface HostActionRequest {
|
||||
action: "test" | "install-key";
|
||||
acceptHostKey?: string;
|
||||
/** Required for install-key; must match the current displayed script. */
|
||||
script?: string;
|
||||
}
|
||||
export type HostActionResponse =
|
||||
| { exitCode: number }
|
||||
| { hostKey: { host: string; fingerprint: string; changed: boolean } };
|
||||
// DELETE /api/host-management/:name/known-key -> 204 (explicit UI confirmation).
|
||||
|
||||
Reference in New Issue
Block a user