yera.cli.resources.creds

Credential-related helpers shared across CLI commands.

Symbols

def authorised_credentials_for_active_group — Credentials map for the active credential group after TOFU / authorisation checks.
def authorised_store_and_credentials — Return ``(store, credentials)`` for *group_name* after TOFU / authorisation.
def ensure_authorised_store — Return the credential store after ensuring the credential group exists and is authorised.
def raise_if_bare_leaf_for_prefix_command — Raise if *path* is only a leaf (prefix commands need a namespace or subtree).
def read_json_object_from_cli — Resolve JSON input from inline string or file path.
def read_json_raw_from_path_or_stdin — Read raw text from a filesystem path, or stdin when *path_or_dash* is ``'-'``.

authorised_credentials_for_active_group

authorised_credentials_for_active_group(
    ctx: AppContext,
) → CredentialGroupMap

Credentials map for the active credential group after TOFU / authorisation checks.

authorised_store_and_credentials

authorised_store_and_credentials(
    ctx: AppContext,
    group_name: str,
) → tuple[CredentialStore, CredentialGroupMap]

Return (store, credentials) for group_name after TOFU / authorisation.

ensure_authorised_store

ensure_authorised_store(
    ctx: AppContext,
    group_name: str,
) → CredentialStore

Return the credential store after ensuring the credential group exists and is authorised.

raise_if_bare_leaf_for_prefix_command

raise_if_bare_leaf_for_prefix_command(
    path: str,
    creds: CredentialGroupMap,
    single_leaf_command: str,
    purpose_phrase: str,
) → None

Raise if path is only a leaf (prefix commands need a namespace or subtree).

single_leaf_command is the suggested invocation, e.g. yera put cred my.key. purpose_phrase completes Use '…' for …, e.g. single-leaf writes.

read_json_object_from_cli

read_json_object_from_cli(
    json_str: str | None,
    from_file: str | None,
) → dict[str, Any]

Resolve JSON input from inline string or file path.

Exactly one of json_str or from_file must be provided. --from-file - reads from sys.stdin.

read_json_raw_from_path_or_stdin

read_json_raw_from_path_or_stdin(
    path_or_dash: str,
) → str

Read raw text from a filesystem path, or stdin when path_or_dash is '-'.