data.drivers._pelt._auth

Page actions AI-ready formats and sharing
Open LLM text
Share with AI
Ask Claude Ask ChatGPT Ask Gemini Ask Copilot

PostgreSQL authentication helpers for the pelt I/O edge (epic E4).

Pure functions and small state machines that turn backend auth challenges into frontend PasswordMessage bytes via build_password(). SCRAM-SHA-256 uses only stdlib …

PostgreSQL authentication helpers for the pelt I/O edge (epic E4).

Pure functions and small state machines that turn backend auth challenges into frontend PasswordMessage bytes via build_password(). SCRAM-SHA-256 uses only stdlibhashlib / hmac / secrets— no channel binding (asyncpg parity; anyio lacksserver-end-point). MD5 and cleartext cover legacy/dev servers.

data.drivers._pelt._auth

Name Type Default Description
type —
qualified_name —
element_type —
description —
source_file —
line_number —
is_autodoc —
autodoc_element —
_autodoc_template —
_autodoc_url_path —
_autodoc_page_type —
title —
doc_content_hash —

Symbols on this page

_hi
function
def _hi(password: bytes, salt: bytes, iterations: int) -> bytes

SCRAMHi()— PBKDF2-HMAC-SHA256.

Parameters

Name Type Default Description
password bytes —
salt bytes —
iterations int —
_parse_server_first
function
def _parse_server_first(data: bytes) -> tuple[str, bytes, int]

Parser=...,s=...,i=...from a server-first message.

Parameters

Name Type Default Description
data bytes —
ScramSha256Client
class

Incremental SCRAM-SHA-256 client exchange (no channel binding).

build_cleartext_password
function
def build_cleartext_password(password: str) -> bytes

Respond toAuthenticationCleartextPassword.

Parameters

Name Type Default Description
password str —
build_md5_password
function
def build_md5_password(*, user: str, password: str, salt: bytes) -> bytes

Respond toAuthenticationMD5Password.

Parameters

Name Type Default Description
user str —
password str —
salt bytes —
respond_to_auth
function
def respond_to_auth(request: AuthRequest, *, user: str, password: str, scram: ScramSha256Client | None = None) -> tuple[bytes, ScramSha256Client | None]

Build the frontend bytes for one auth challenge.

Returns(password_message_bytes, updated_scram_client). scrammust be reused across the SASL continue/final rounds on the same connection.

Parameters

Name Type Default Description
request AuthRequest —
user str —
password str —
scram ScramSha256Client | None None

View source · /home/runner/work/chirp/chirp/site/../src/chirp/data/drivers/_pelt/_auth.py:1