Skip to main content

Crate car_permissions

Crate car_permissions 

Source
Expand description

Cross-platform permission preflight for Common Agent Runtime.

Unifies macOS TCC, Windows privacy/consent APIs, and Linux xdg-desktop-portal / polkit / filesystem-permissions semantics under one surface:

  • status — current grant state
  • request — trigger a native prompt if the OS supports one
  • explain — human-readable diagnostic + the user-visible fix
  • domains — which Domains are meaningful on the current OS

§Honest modeling

A domain that doesn’t exist on the current OS returns PermissionStatus::NotApplicable — NOT Denied. Callers should branch on NotApplicable and skip, rather than treating it as failure.

§No private APIs

Backends use only public, documented interfaces. On macOS that means querying TCC through Apple’s public Security/AppKit paths (or returning NotDetermined when only private access would give better data).

Structs§

Context
Context modifiers for a status/request/explain call. Most domains ignore all fields; Automation on macOS requires target_bundle_id.
PermissionExplanation
Per-domain diagnostic + user-visible fix hint. #[non_exhaustive].

Enums§

Domain
Capability domains. A domain may be NotApplicable on some OSes — the enum is the union across all supported platforms.
PermissionError
PermissionStatus
Permission state. #[non_exhaustive] — future variants are additive.

Functions§

domains
All domains defined by this crate. Callers can filter to the ones that are meaningful on the current OS by checking status() != NotApplicable.
explain
Human-readable explanation + fix suggestion.
explain_with
request
Trigger a native prompt (where the OS supports one). Returns the new status after the user responds, or the current status if no prompt was shown.
request_with
status
Current status of a single domain.
status_with
Status with per-domain context — see Context.