ds_common_placeholder_py_lib.functions.secrets ============================================== .. py:module:: ds_common_placeholder_py_lib.functions.secrets .. autoapi-nested-parse:: **File:** ``functions/secrets.py`` **Region:** ``ds-common-placeholder-py-lib`` Description ----------- ``get_secret`` (contract §7): tenant-scoped vault keys, base64 handling, and recording each value so :meth:`Context.scrub ` can remove it. Functions --------- .. autoapisummary:: ds_common_placeholder_py_lib.functions.secrets.key_tenant ds_common_placeholder_py_lib.functions.secrets.get_secret ds_common_placeholder_py_lib.functions.secrets.secret Module Contents --------------- .. py:function:: key_tenant(key: object) -> str | None The tenant segment of a vault key ``/ds/vault///…``. Only the tenant is read; the rest of the key's format is the definition author's (and the frontend's) concern. Returns ``None`` when the key has no tenant segment, so it cannot be shown to belong to any tenant. .. py:function:: get_secret(ctx: ds_common_placeholder_py_lib.context.Context, args: list[Any]) -> str Read a vault value of the run's tenant from ds-vault. :raises PlaceholderError: ``secret_scope`` if the key's tenant segment is not the context's tenant (checked before the vault is read), ``secret_missing`` if the vault has no such key, ``secret_unavailable`` if the vault cannot be read (configuration, connection, or KMS), ``type`` if the value is not UTF-8. .. py:function:: secret(ctx: ds_common_placeholder_py_lib.context.Context, args: list[Any]) -> str A secret already read upstream (``resolve(strict=False)`` writes each one as ``@{secret, '…'}``): return it and record it, so :meth:`Context.scrub` and the SQL check know it.