cayu.runtime.public_authority
Public Cayu API. Definitions are grouped by their public source module, and definitions from private implementation modules appear on their package’s page; adding a symbol does not move existing links. The import shown at each entry is a supported public namespace. Read the Python API overview and install the required extra.
parse_public_authority_alias
Section titled “parse_public_authority_alias”from cayu import parse_public_authority_aliasReturn the canonical alias components, or None for malformed input.
parse_public_authority_alias(value: str) -> ParsedPublicAuthorityAlias | NoneRelease source · Runtime guarantees · Capability guides
ParsedPublicAuthorityAlias
Section titled “ParsedPublicAuthorityAlias”from cayu import ParsedPublicAuthorityAliasCanonical, non-secret fields parsed from a public authority alias.
Decorators: @dataclass(frozen=True, slots=True).
Fields and attributes
Section titled “Fields and attributes”Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.
| Name | Type | Default |
|---|---|---|
version |
str |
required |
key_id |
str |
required |
field_name |
str |
required |
tag |
str |
required |
Release source · Runtime guarantees · Capability guides
PUBLIC_AUTHORITY_ALIAS_ACTIVE_KEY_ID_ENV
Section titled “PUBLIC_AUTHORITY_ALIAS_ACTIVE_KEY_ID_ENV”from cayu import PUBLIC_AUTHORITY_ALIAS_ACTIVE_KEY_ID_ENVPUBLIC_AUTHORITY_ALIAS_ACTIVE_KEY_ID_ENV = 'CAYU_PUBLIC_AUTHORITY_ALIAS_ACTIVE_KEY_ID'Release source · Runtime guarantees · Capability guides
public_authority_alias_codec_from_environment
Section titled “public_authority_alias_codec_from_environment”from cayu import public_authority_alias_codec_from_environmentLoad an explicit deployment codec from two environment variables.
CAYU_PUBLIC_AUTHORITY_ALIAS_KEYS is a JSON object mapping key IDs to
canonical base64url key material. The active key ID is supplied separately
so rotation never depends on mapping order. No variables means aliases are
unconfigured; partial or malformed configuration fails closed.
public_authority_alias_codec_from_environment(environ: Mapping[str, str] | None=None) -> PublicAuthorityAliasCodec | NoneRelease source · Runtime guarantees · Capability guides
public_authority_alias_is_reserved
Section titled “public_authority_alias_is_reserved”from cayu import public_authority_alias_is_reservedReturn whether a value occupies the public-authority alias namespace.
public_authority_alias_is_reserved(value: object) -> boolRelease source · Runtime guarantees · Capability guides
PUBLIC_AUTHORITY_ALIAS_KEYS_ENV
Section titled “PUBLIC_AUTHORITY_ALIAS_KEYS_ENV”from cayu import PUBLIC_AUTHORITY_ALIAS_KEYS_ENVPUBLIC_AUTHORITY_ALIAS_KEYS_ENV = 'CAYU_PUBLIC_AUTHORITY_ALIAS_KEYS'Release source · Runtime guarantees · Capability guides
PUBLIC_AUTHORITY_ALIAS_MAX_KEYS
Section titled “PUBLIC_AUTHORITY_ALIAS_MAX_KEYS”from cayu import PUBLIC_AUTHORITY_ALIAS_MAX_KEYSPUBLIC_AUTHORITY_ALIAS_MAX_KEYS = 4Release source · Runtime guarantees · Capability guides
PUBLIC_AUTHORITY_ALIAS_PREFIX
Section titled “PUBLIC_AUTHORITY_ALIAS_PREFIX”from cayu import PUBLIC_AUTHORITY_ALIAS_PREFIXPUBLIC_AUTHORITY_ALIAS_PREFIX = 'cayu_authority_'Release source · Runtime guarantees · Capability guides
PUBLIC_AUTHORITY_ALIAS_VERSION
Section titled “PUBLIC_AUTHORITY_ALIAS_VERSION”from cayu import PUBLIC_AUTHORITY_ALIAS_VERSIONPUBLIC_AUTHORITY_ALIAS_VERSION = 'v1'Release source · Runtime guarantees · Capability guides
PublicAuthorityAliasCodec
Section titled “PublicAuthorityAliasCodec”from cayu import PublicAuthorityAliasCodecCreate and verify versioned, field- and session-scoped HMAC aliases.
Decorators: @dataclass(frozen=True, slots=True).
Fields and attributes
Section titled “Fields and attributes”Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.
| Name | Type | Default |
|---|---|---|
keyring |
PublicAuthorityAliasKeyring |
required |
encode (method)
Section titled “encode (method)”PublicAuthorityAliasCodec.encode(private_value: str, *, field_name: str, session_id: str | None=None) -> straliases (method)
Section titled “aliases (method)”PublicAuthorityAliasCodec.aliases(private_value: str, *, field_name: str, session_id: str | None=None) -> tuple[str, ...]Return aliases for every accepted key, active key first.
Persistent stores use this during a keyed backfill so aliases issued before rotation remain resolvable without request-time scans.
key_fingerprint (method)
Section titled “key_fingerprint (method)”PublicAuthorityAliasCodec.key_fingerprint(key_id: str) -> strReturn a non-secret stable fingerprint for deployment validation.
keyring_fingerprint (method)
Section titled “keyring_fingerprint (method)”PublicAuthorityAliasCodec.keyring_fingerprint() -> strReturn a stable non-secret digest of the exact configured key set.
parse (method)
Section titled “parse (method)”PublicAuthorityAliasCodec.parse(value: str) -> ParsedPublicAuthorityAlias | NoneParse a canonical supported alias without verifying private authority.
matches (method)
Section titled “matches (method)”PublicAuthorityAliasCodec.matches(alias: str, private_value: str, *, field_name: str, session_id: str | None=None) -> boolrotated (method)
Section titled “rotated (method)”PublicAuthorityAliasCodec.rotated(*, active_key_id: str, key: SecretStr, retire_key_ids: tuple[str, ...]=()) -> PublicAuthorityAliasCodecReturn an immutable codec using a rotated copy of this keyring.
is_reserved (method)
Section titled “is_reserved (method)”PublicAuthorityAliasCodec.is_reserved(value: object) -> boolRelease source · Runtime guarantees · Capability guides
PublicAuthorityAliasKeyring
Section titled “PublicAuthorityAliasKeyring”from cayu import PublicAuthorityAliasKeyringAn immutable, secret-safe keyring for public authority aliases.
Key material is supplied as canonical, unpadded base64url text wrapping exactly 32 bytes. The active key signs new aliases; retained keys only verify aliases produced before rotation.
Decorators: @dataclass(frozen=True, slots=True, init=False).
Fields and attributes
Section titled “Fields and attributes”Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.
| Name | Type | Default |
|---|---|---|
active_key_id |
str |
required |
init (method)
Section titled “init (method)”PublicAuthorityAliasKeyring.__init__(*, active_key_id: str, keys: Mapping[str, SecretStr]) -> Nonekey_ids (property)
Section titled “key_ids (property)”PublicAuthorityAliasKeyring.key_ids() -> tuple[str, ...]keys (property)
Section titled “keys (property)”PublicAuthorityAliasKeyring.keys() -> Mapping[str, SecretStr]Return an immutable mapping whose values remain masked SecretStr objects.
rotated (method)
Section titled “rotated (method)”PublicAuthorityAliasKeyring.rotated(*, active_key_id: str, key: SecretStr, retire_key_ids: tuple[str, ...]=()) -> PublicAuthorityAliasKeyringReturn a new keyring with a new active key and optional retirements.