Cua Spaces app export
These APIs are part of the Cua Spaces app export for building Spaces UIs. They are source-available under FSL-1.1-MIT and ship for Swift only (import CuaSpacesFFI); the Rust tab shows the cua-spaces-ffi crate they come from. The open source SDK packages for Python, TypeScript and Kotlin do not include them.
app_devices_view derives the Devices page from app_devices_input (a Devices.snapshot): this device's enrollment, the account's devices with their buttons, approval prompts that ask for presence, and Recent Access in words. app_enroll_reduce / app_enroll_view drive the enroll sheet (sign in again, or a one-time code approved elsewhere); app_approve_reduce / app_approve_view drive the approval sheet, whose request goes to Devices.approve after Touch ID or the login password.
Field Type Default Description tsu64Unix seconds. kindStringKind. deviceOption<String>Acting device. machineOption<String>Machine id. subjectOption<String>Other party. detailOption<String>Detail.
AppActivityRow record#
Field Type Default Description tsu64Unix seconds. textStringThe line. notableboolAccess by another account or an unenrolled device.
AppBannerTone enum#
Variant Description InfoInformational. WarningNeeds the user soon. CriticalBlocks relay access now.
AppThisDevice record#
Field Type Default Description kindAppEnrollmentKindState. titleString"Enrolled until", "Grace ends", "Needs enrollment", ... atOption<u64>The date after the title (Unix seconds); the shell formats it. nameOption<String>The device's name, once registered. action_label / actionLabelOption<String>"Enroll…" when this device needs it.
AppEnrollmentKind enum#
Swift Rust
.enrolled
.grace
.needsEnrollment
.waiting
.due
.revoked
Variant Description EnrolledEnrolled: the relay lets it reach the account's machines. GraceNot enrolled, still let through until the grace period ends. NeedsEnrollmentNot enrolled, and the relay refuses it. WaitingRegistered, waiting for approval from an enrolled device. DueEnrollment ran out: one approval re-verifies it. RevokedRevoked.
AppApprovalPrompt record#
Field Type Default Description device_id / deviceIdStringDevice id to approve. textStringThe question. requires_presence / requiresPresenceboolAsk for Touch ID / the login password before approving. nameStringThe device's name. expiredboolRe-verification of a device whose enrollment ran out (no code). notify_title / notifyTitleStringThe system notification's title. notify_body / notifyBodyStringThe system notification's body.
Field Type Default Description idStringMachine id. nameStringDisplay name. confirmedboolRegistered with an enrolled device's proof, or confirmed since (S5). true from a relay that predates the check.
AppUnconfirmedMachine record#
Field Type Default Description idStringMachine id (the native side's confirm_machine call takes this). titleStringDisplay name, or the id when it has none yet. confirmAppDeviceConfirmAsked before confirming (both shells show it as a native alert).
AppApproveRequest record#
Field Type Default Description codeOption<String>The code (a new device). device_id / deviceIdOption<String>The device id (re-verification).
AppApproveSheetState record#
Returned by app_approve_open , app_approve_reduce .
Field Type Default Description device_id / deviceIdStringThe device to approve. nameStringIts name. expiredboolRe-verification (no code) rather than a new device. codeStringThe code as typed. busyboolThe approval runs (presence, then the relay). errorOption<String>The last failure. code_expired / codeExpiredboolThe last code the relay saw expired: offers approving the waiting device of this name by id instead (see code_expired_fallback). Typing a new code clears it.
AppApproveSheetView record#
Returned by app_approve_view .
Field Type Default Description titleStringTitle. messageStringWhat approving does. needs_code / needsCodeboolA code field shows. code_label / codeLabelStringThe code field's label. code_placeholder / codePlaceholderStringIts placeholder. codeStringThe code, normalized (K7QX-M2RP). can_approve / canApproveboolApprove is enabled. approve_label / approveLabelStringApprove. deny_label / denyLabelStringDeny (a new device; revokes it) or Not Now (re-verification). deny_revokes / denyRevokesboolDeny revokes the device (one click, no confirmation). presence_reason / presenceReasonStringThe reason the presence prompt shows. busyboolWorking. errorOption<String>A failure. requestOption<AppApproveRequest>What to send once presence is confirmed (None until ready).
AppDeviceBanner record#
AppDeviceConfirm record#
Field Type Default Description titleStringThe question. messageStringWhat happens. confirm_label / confirmLabelStringThe confirming button. cancel_label / cancelLabelStringThe other button.
Field Type Default Description idStringdev_….nameStringDisplay name. stateStringpending, enrolled, expired or revoked.enrolled_until / enrolledUntilOption<u64>Re-verification due at (Unix seconds). last_seen / lastSeenOption<u64>Last session (Unix seconds). currentboolThis device. platformOption<String>Operating system the device reported (macos, windows, linux).
AppDeviceRow record#
Field Type Default Description idStringDevice id. titleStringName ((this device) suffix for the current one). subtitleStringState in words. actionsVec<AppDeviceAction>Buttons. nameStringThe name as stored (Rename starts from it). platformStringOperating system in words (macOS), empty when unknown. detailStringPlatform and state on one line. last_seen / lastSeenOption<u64>Last session (Unix seconds); the shell says it relative to now. currentboolThis device. revoke_confirm / revokeConfirmOption<AppDeviceConfirm>Asked before Revoke.
Returned by app_devices_input , app_devices_input_from_json .
Field Type Default Description devicesVec<AppDeviceInput>The account's devices. auditVec<AppAuditInput>The account's audit events, newest last. local_device_id / localDeviceIdOption<String>This device's id when it has a key (it may not be registered yet). pending_code / pendingCodeOption<String>The one-time code this device shows while it waits for approval. enforce_after / enforceAfterOption<u64>When the relay stops letting unenrolled devices through. machine_names / machineNamesHashMap<String, String>Machine ids to display names. machinesVec<AppMachineInput>The account's relay machines, for the "New machine" confirm badge (S5). Empty on a relay that predates it, or when this device cannot list them, same as machine_names.
AppDevicesLabels record#
Field Type Default Description titleStringPage title. this_device / thisDeviceStringThis device's section. devicesStringThe account's devices. recentStringThe access log's section. recent_empty / recentEmptyStringWhen the access log is empty. last_seen / lastSeenString"Last seen" before a relative time. approveStringApprove button (the row's, and the sheet's for a new device). denyStringThe row's Deny: revokes a still-pending device in one click, or (a device due for re-verification) only dismisses it, like the sheet's Deny and Not Now. renameStringRename button. revokeStringRevoke button. rename_title / renameTitleStringThe rename prompt's title. rename_confirm / renameConfirmStringThe rename prompt's confirming button. cancelStringCancel. signed_out / signedOutStringShown instead of the page while signed out. new_machines / newMachinesStringThe unconfirmed-machines section's heading. confirm_machine / confirmMachineStringConfirm button on a new machine.
AppDevicesView record#
Returned by app_devices_view .
AppEnrollOption record#
Field Type Default Description methodAppEnrollMethodMethod. titleStringTitle. detailStringOne line under it.
AppEnrollState record#
Returned by app_enroll_initial , app_enroll_reduce , app_enroll_state_from_json .
Field Type Default Description phaseAppEnrollPhasePhase. methodOption<AppEnrollMethod>The chosen method. codeOption<String>The one-time code, while waiting. errorOption<String>The last failure.
AppEnrollView record#
Returned by app_enroll_view .
Field Type Default Description titleStringTitle. ledeStringOne line under the title. optionsVec<AppEnrollOption>The methods (while choosing). codeOption<String>The one-time code (while waiting). code_help / codeHelpOption<String>How to use the code. statusOption<String>What is happening now. errorOption<String>A failure. busyboolWorking (a spinner). doneboolEnrolled. back_label / backLabelOption<String>Back (after a failure). close_label / closeLabelStringCancel, or Done once enrolled.
AppApproveSheetAction enum#
Swift Rust
. setCode ( code : String )
.submit
. failed ( error : String )
Variant Description SetCodeThe code field changed. Fields: code: String SubmitApprove was pressed (the shell asks for presence, then the relay). FailedPresence or the relay refused. Fields: error: String
AppDeviceAction enum#
Swift Rust
.enroll
.approve
.rename
.revoke
Variant Description EnrollEnroll this device (the enroll sheet). ApproveApprove another device (after presence). RenameRename a device. RevokeRevoke a device (after its confirmation).
AppEnrollAction enum#
Swift Rust
. choose ( method : AppEnrollMethod)
.signedIn
. registered ( enrolled : Bool , code : String ? )
.approved
. failed ( error : String )
.back
Variant Description ChooseA method was chosen. Fields: method: AppEnrollMethod SignedInThe interactive sign-in finished. RegisteredThe relay registered this device. Fields: enrolled: bool, code: Option<String> ApprovedAn enrolled device approved this one. FailedA step failed. Fields: error: String BackBack to the choice.
AppEnrollMethod enum#
Variant Description SignInA fresh interactive sign-in (enrolls this device at once). ApproveA one-time code approved from an enrolled device.
AppEnrollPhase enum#
Swift Rust
.choose
.signingIn
.registering
.waiting
.enrolled
.failed
Variant Description ChooseChoosing a method. SigningInThe shell runs an interactive sign-in. RegisteringThe shell registers this device with the relay. WaitingThe code shows; the shell polls until an enrolled device approves. EnrolledEnrolled. FailedSomething failed; Back returns to the choice.
app_approve_open#
Opens the approval sheet for a prompt.
Swift Rust
func appApproveOpen ( prompt : AppApprovalPrompt) -> AppApproveSheetState
Returns AppApproveSheetState
app_approve_reduce#
Advances the approval sheet. devices is the account's current devices
(for approving the waiting device of a code's name by id once the code
expires).
Swift Rust
func appApproveReduce ( state : AppApproveSheetState, action : AppApproveSheetAction, devices : [AppDeviceInput]) -> AppApproveSheetState
Returns AppApproveSheetState
app_approve_sheet_action_from_json#
An approval sheet action from JSON (parity flows).
Swift Rust
func appApproveSheetActionFromJson ( json : String ) throws -> AppApproveSheetAction
Parameter Type Default jsonStringrequired
Returns AppApproveSheetAction · Raises CuaError
app_approve_view#
The approval sheet as drawn. devices is the account's current devices
(see app_approve_reduce).
Swift Rust
func appApproveView ( state : AppApproveSheetState, devices : [AppDeviceInput]) -> AppApproveSheetView
Returns AppApproveSheetView
app_devices_clean_name#
A device name as typed for Rename (None when empty).
Swift Rust
func appDevicesCleanName ( name : String ) -> String ?
Parameter Type Default nameStringrequired
Returns Option<String>
The SDK's devices snapshot as the Devices page reads it
(pending_code: the code this device shows while it waits).
Swift Rust
func appDevicesInput ( snapshot : DevicesSnapshot, pendingCode : String ? ) -> AppDevicesInput
Parameter Type Default snapshotDevicesSnapshotrequired pending_codeOption<String>required
Returns AppDevicesInput
Devices page input from JSON (fixtures, parity flows).
Swift Rust
func appDevicesInputFromJson ( json : String ) throws -> AppDevicesInput
Parameter Type Default jsonStringrequired
Returns AppDevicesInput · Raises CuaError
app_devices_view#
The Devices page at now (Unix seconds).
Swift Rust
func appDevicesView ( input : AppDevicesInput, now : UInt64 ) -> AppDevicesView
Returns AppDevicesView
app_enroll_action_from_json#
An enroll sheet action from JSON (parity flows).
Swift Rust
func appEnrollActionFromJson ( json : String ) throws -> AppEnrollAction
Parameter Type Default jsonStringrequired
Returns AppEnrollAction · Raises CuaError
app_enroll_initial#
The enroll sheet's first state.
Swift Rust
func appEnrollInitial () -> AppEnrollState
Returns AppEnrollState
app_enroll_reduce#
Advances the enroll sheet.
Swift Rust
func appEnrollReduce ( state : AppEnrollState, action : AppEnrollAction) -> AppEnrollState
Returns AppEnrollState
app_enroll_state_from_json#
The enroll sheet's state from JSON (fixtures, parity).
Swift Rust
func appEnrollStateFromJson ( json : String ) throws -> AppEnrollState
Parameter Type Default jsonStringrequired
Returns AppEnrollState · Raises CuaError
app_enroll_view#
The enroll sheet as drawn.
Swift Rust
func appEnrollView ( state : AppEnrollState) -> AppEnrollView
Returns AppEnrollView