"""Minimal inline HTML. No template engine — just f-strings — to keep the reference single-purpose and dependency-light. Output is intentionally plain. """ from __future__ import annotations import html import json from typing import Any _PAGE = """ Porchlight RP Reference {body} """ def _block(title: str, obj: Any) -> str: pretty = html.escape(json.dumps(obj, indent=2, sort_keys=True, default=str)) return f"

{html.escape(title)}

{pretty}
" def home_page() -> str: body = """

Porchlight OIDC RP — reference

A hand-rolled Relying Party. Click below to start the Authorization Code flow (with PKCE) against your porchlight provider.

Login with Porchlight
""" return _PAGE.format(body=body) def result_page( *, id_claims: dict[str, Any], userinfo: dict[str, Any], tokens: dict[str, Any], ) -> str: body = f"""

Logged in

{_block("ID token claims (verified)", id_claims)} {_block("UserInfo response", userinfo)} {_block("Raw token response", tokens)} """ return _PAGE.format(body=body) def error_page(message: str) -> str: body = f"""

Something went wrong

{html.escape(message)}
Back home
""" return _PAGE.format(body=body)