Skip to content

Defined in: hub/src/types.ts:279

Property Modifier Type Description Defined in
basePath readonly string Normalized mount path, e.g. /api/uncage. hub/src/types.ts:281
approveDevice(userCode, user): Promise<"ok" | "not_found" | "expired">;

Defined in: hub/src/types.ts:294

Approve / deny / look up a user code on the website’s approve page. Unknown codes count as failed guesses: after rateLimits.userCodeFailures in the window these throw an UncageError with code rate_limited (status 429, details.retryAfterSec).

Parameter Type
userCode string
user HubUser

Promise<"ok" | "not_found" | "expired">


close(): Promise<void>;

Defined in: hub/src/types.ts:327

Disconnects machines and stops serving. Never closes store (it is yours); closes the cluster only when the hub created it (no cluster option).

Promise<void>


denyDevice(userCode, user): Promise<"ok" | "not_found" | "expired">;

Defined in: hub/src/types.ts:295

Parameter Type
userCode string
user HubUser

Promise<"ok" | "not_found" | "expired">


fetch(req, info?): Promise<Response>;

Defined in: hub/src/types.ts:288

Browser API, device endpoints, install.sh and install.ps1, and the agents’ HTTP streaming transport (<basePath>/agent/*), all under basePath, as a Fetch handler. Pass info.clientIp (the client address) when known; toNodeHandler does. info.waitUntil is the platform’s hook for work that may outlive the response (e.g. Workers’ ctx.waitUntil).

Parameter Type
req Request
info? { clientIp?: string; waitUntil?(p): void; }
info.clientIp? string
info.waitUntil? (p) => void

Promise<Response>


lookupDevice(userCode, user): Promise<
| {
expiresAt: string;
name?: string;
os?: string;
repairsMachine: | {
id: string;
name: string;
}
| null;
requestedAt: string;
requestIp: string | null;
}
| null>;

Defined in: hub/src/types.ts:303

What the approve page shows about a pending code, or null if unknown / no longer pending. Show requestedAt and requestIp next to the code: a code that arrived in a link may have been started by someone else on their own computer (device-approval phishing). repairsMachine is set when approving would re-pair one of user’s existing machines (warn “re-pairing ”): it keeps its id and sessions and its old token stops working.

Parameter Type
userCode string
user HubUser

Promise< | { expiresAt: string; name?: string; os?: string; repairsMachine: | { id: string; name: string; } | null; requestedAt: string; requestIp: string | null; } | null>


maintain(): Promise<MaintenanceReport>;

Defined in: hub/src/types.ts:320

Runs maintenance now unless another instance holds the maintenance lease or the hub is closed (ran: false). You rarely need it: see HubOptions.maintenance.

Promise<MaintenanceReport>


revokeMachine(machineId, user): Promise<void>;

Defined in: hub/src/types.ts:322

Deletes the machine (its token stops working) and disconnects it. Throws machine_not_found.

Parameter Type
machineId string
user HubUser

Promise<void>