Defined in: hub/src/types.ts:279
Properties
Section titled “Properties”| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
basePath |
readonly |
string |
Normalized mount path, e.g. /api/uncage. |
hub/src/types.ts:281 |
Methods
Section titled “Methods”approveDevice()
Section titled “approveDevice()”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).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
userCode |
string |
user |
HubUser |
Returns
Section titled “Returns”Promise<"ok" | "not_found" | "expired">
close()
Section titled “close()”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).
Returns
Section titled “Returns”Promise<void>
denyDevice()
Section titled “denyDevice()”denyDevice(userCode, user): Promise<"ok" | "not_found" | "expired">;Defined in: hub/src/types.ts:295
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
userCode |
string |
user |
HubUser |
Returns
Section titled “Returns”Promise<"ok" | "not_found" | "expired">
fetch()
Section titled “fetch()”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).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
req |
Request |
info? |
{ clientIp?: string; waitUntil?(p): void; } |
info.clientIp? |
string |
info.waitUntil? |
(p) => void |
Returns
Section titled “Returns”Promise<Response>
lookupDevice()
Section titled “lookupDevice()”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
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
userCode |
string |
user |
HubUser |
Returns
Section titled “Returns”Promise<
| {
expiresAt: string;
name?: string;
os?: string;
repairsMachine: | {
id: string;
name: string;
}
| null;
requestedAt: string;
requestIp: string | null;
}
| null>
maintain()
Section titled “maintain()”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.
Returns
Section titled “Returns”Promise<MaintenanceReport>
revokeMachine()
Section titled “revokeMachine()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
machineId |
string |
user |
HubUser |
Returns
Section titled “Returns”Promise<void>