import type { OperatorKey, PutOperatorKeyResponse } from "@nylorun/core/contracts"; import { type KeyCredentials } from "../project/link.js"; import type { DockerResult } from "./docker.js"; import type { FetchLike } from "./studio-login.js"; /** A local Tenant: `nylorun-operate` in its runtime container, and a fetch to probe keys. */ export interface OperateEndpoint { fetch: FetchLike; /** Runs `nylorun-operate ` in the runtime container. */ operate(args: readonly string[]): Promise; } /** The keys `nylorun start` gives the projects it links (and `-management`). */ export declare const PROJECT_KEY_ID = "project"; /** The keys nylorun commands use outside a linked project (and `-management`). */ export declare const CLI_KEY_ID = "cli"; /** Creates key `id` with `role` or rotates it; the answer holds the key, this once. */ export declare function putOperatorKey(endpoint: OperateEndpoint, id: string, role: "application" | "management"): Promise; export declare function listOperatorKeys(endpoint: OperateEndpoint): Promise; /** Deletes key `id`: false when there is none. */ export declare function deleteOperatorKey(endpoint: OperateEndpoint, id: string): Promise; /** * Whether `key` reaches the Tenant at `runtimeUrl`: one authenticated read (`GET /v1/me`, which * every key reaches). An unknown key is `401 credential_invalid` (protocol 9; the opaque 404 * before), a key of no use here `403`; another answer is an error. */ export declare function keyAuthenticates(fetch: FetchLike, runtimeUrl: string, key: string): Promise; /** * The keys `id` (application) and `id-management` (management) kept in the Host root file * `file` (0600): each of the file's keys while it still authenticates, else `adopt`'s when it * does (keys a project already holds), else a new key put through `nylorun-operate`, written to * the file. One process at a time (`lock`), so concurrent commands share one key instead of * rotating each other's. */ export declare function hostKey(options: { endpoint: OperateEndpoint; runtimeUrl: string; id: string; file: string; lock: string; adopt?: KeyCredentials; }): Promise>;