Expand description
Enrollment (device flow), access tokens and lease renewal.
The instance’s Ed25519 key is its only long-lived secret: every access token is minted from a fresh signed assertion and cached until shortly before it expires. Nothing here runs inside a tool call.
Structs§
- AppKey
Offers - The keys LeanCTX Code may hand over with a pairing: its chat key
(rc4-32), its task-propose key (rc4-67) and its opt-in key (rc4-16), any
of them or none (
Default). - Enrollment
Token - A pre-issued Host enrollment token (
het_and 64 hex digits) that a team admin handed out, e.g. through MDM. It enrolls this machine without a browser approval. The value is wiped on drop and never printed: itsDebugshows the prefix only, and no error names it. - Session
- A connected instance: its record, verified lease and keys.
- Setup
Announcement - The project an engine names at connect (C0 2.1 device setup): the checkout’s folder name and the remote it sees, plus what it shares.
Enums§
- Chat
KeyRepair - What a chat key re-pair of a connected computer did (rc4-32, p37
§3.18.1): its
reasonincloud connect --json.
Constants§
- APP_
KEYS_ UNSUPPORTED - The words for a Cloud that cannot bind the keys of LeanCTX Code in the
pairing (its code answer lacks
device_app_keys, or it refused the announcedapp_keys): nothing was paired (app-key-bind-v1 §1). - APP_
KEY_ PAIRING_ FAILED - The words for a pairing whose offered keys the Cloud refused as not the
announced set or with a bind signature that does not verify (f3129
app_key_not_announced/app_key_bind_invalid, app-key-bind-v1 §11). - CHAT_
KEY_ BOUND - Another chat key is bound to this computer (
409 invalid_state, reasonchat_key_bound). - CHAT_
KEY_ CLEARED - The offered chat key was removed (
409, reasonchat_key_cleared). - CHAT_
KEY_ REFUSED - The local error for LeanCTX Cloud’s
400 invalid_fieldon a pairing that carried a chat key (rc4-32): the bind did not verify there. - CHAT_
KEY_ REPAIR_ REASONS - The answers of a chat key re-pair that name why it was refused, kept by
CloudError::from_responseasServer { code }(this protocol version does not name them). - CHAT_
KEY_ TOKEN_ ENROLLMENT - A computer connected with an enrollment token (
400 token_enrollment). - CHAT_
KEY_ WITH_ TOKEN - An enrollment token has no device code to sign the app keys over (f3129 S3), so it binds none: a chat key with a token is refused before anything is sent, like the task and opt-in keys.
- ENROLLMENT_
TOKEN_ PREFIX - The plaintext prefix of a pre-issued Host enrollment token.
- ENROLLMENT_
TOKEN_ UNUSABLE - Why a Cloud refused an enrollment token, in the words a person acts on.
- OPTIN_
KEY_ ALREADY_ BOUND - The words for a pairing while another opt-in key is bound (§46.4).
- OPTIN_
KEY_ REFUSED - The words for a pairing whose opt-in key LeanCTX Code offered was refused (rc4-16).
- OPTIN_
KEY_ TOKEN_ ENROLLMENT - The words for a pairing with an opt-in key of a computer connected with
an enrollment token (
400 token_enrollment, §46.2). - OPTIN_
KEY_ WAS_ REMOVED - The words for a pairing with an opt-in key removed on the web (§46.4).
- TASK_
KEY_ ALREADY_ BOUND - The words for a pairing while another task key is bound.
- TASK_
KEY_ REFUSED - The words for a pairing whose task key LeanCTX Code offered was refused.
- TASK_
KEY_ WAS_ REMOVED - The words for a pairing with a task key removed on the web.
Functions§
- announce_
setup - Step 1b (C0 2.1): name the project and what this machine shares, so the
approval page asks “Share this project” too. Only when the Cloud offers
it;
falsewhen it did not take it (the terminal then asks, as before). - chat_
key_ repair_ refusal - A refused chat key re-pair: its
reason(absent fortoken_enrollment, forinvalid_field chat_keyand for an app-key refusal, whose eventcodeisapp_key_not_announced) and fixed text;Nonefor any other error. - complete_
enrollment - Verify an enrollment answer against the root key and persist it.
- engine_
os - enroll_
with_ token - Enroll this machine with a pre-issued enrollment token (no browser):
one
POST /v1/device/tokenwith the token asdevice_code, then the enrollment is verified and persisted exactly as after a device approval. - enroll_
with_ token_ chat enroll_with_tokenas LeanCTX Code calls it: a chat key offer is refused (config) before the Cloud is contacted (CHAT_KEY_WITH_TOKEN).- finish_
device_ flow - Step 2: poll until the user approved (or the code expired), then verify
and persist the enrollment.
sleepis injectable for tests. - finish_
device_ flow_ with finish_device_flowthat also binds the keys LeanCTX Code offers (chat key rc4-32, task-propose key rc4-67): each offer is checked against this machine’s public key before anything is sent, and its public part is kept once the pairing is accepted. A pairing without one forgets a key of that kind bound earlier.- repair_
chat_ key - Pair LeanCTX Code’s chat key with this ALREADY connected computer
(p37 §3.18.1): the normal device flow (
codefromstart_device_flow_for, the person approves in the browser) with the existing instance keys pluschat_key, and noreplaces. LeanCTX Cloud keeps the instance, its keys, vault links and workers; locally the enrollment record, vault links and the worker state stay as they are: only the lease (and the cached session token) the answer renews and the bound chat key change. - start_
device_ flow - Step 1: ask Cloud for a device code;
labelis the user’s--label, if any (the approval page shows it, Cloud task #11). - start_
device_ flow_ for - Step 1 for
cloud connect [--trial]:trialnames the plan whose one-step trial the browser starts (None: a plain sign-in, whose request is exactly the one older Clouds know). - start_
device_ flow_ with start_device_flow_forthat announces the keys LeanCTX Code offers (f3129 S2, app-key-bind-v1 §2):app_keysinPOST /v1/device/code, sorted by kind, absent when nothing is offered (the request is then byte-identical to the plain one). A Cloud whose code answer does not listdevice_app_keysbinds no key: the pairing stops here, before the browser opens or anything is polled (fail closed, §1).- trial_
refusal - A trial request an older Cloud refused for its unknown members (
400 invalid_request) isCloudError::TrialUnsupported: it is never sent again without them, so nobody signs in thinking a trial started.
Type Aliases§
- Sharing
Answer - What the device approval answered beyond the enrollment: the page’s
answer to “Share this project” (C0 2.1).
None: the page did not ask (no setup, or an older Cloud);Some(None): an older page approved it.