Runtime-checkable Python Protocol defining the auth brick contract: authenticate, validate, cache invalidation, lifecycle, and import verification.
# Source: https://github.com/nexi-lab/nexus | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
"""Auth brick protocol — defines the public contract (Decision #15).
All consumers depend on this protocol, never on concrete implementations.
"""
from typing import Protocol, runtime_checkable
from nexus.bricks.auth.types import AuthResult
@runtime_checkable
class AuthBrickProtocol(Protocol):
"""Public contract for the Auth brick.
Implementations must provide authentication, validation,
cache management, and lifecycle hooks.
"""
async def authenticate(self, token: str) -> AuthResult:
"""Authenticate a request token.
Args:
token: API ke
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key