Bring in pipeline, auth, deploy and docs from the boilerplate
roledesk is built on the boilerplate from here on: pipeline 2.0 (queue and scheduler), auth (one password, sessions, passkeys), the deploy kit and its docs, plus the coupling and packaging tests. Downstream copies, unedited. Refreshed from boilerplate/d56949f7d0f6c0bfe5745478e09007bfad67ae87 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1f436104f3
commit
9d666d0937
76 files changed
+15235
No files matched your search
@@ -0,0 +1,56 @@
|
||||
"""The five bodies this package accepts. Small on purpose.
|
||||
|
||||
A ceremony's `credential` is passed through as an opaque dict — it is the
|
||||
browser's `PublicKeyCredential` serialised by `toJSON()`, and its shape is the
|
||||
WebAuthn spec's business rather than ours. Restating it as a model here would
|
||||
be a second, staler copy of a structure the library already parses and
|
||||
validates properly.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class LoginBody(BaseModel):
|
||||
"""The whole login form. No username field, because there is no username —
|
||||
asking for one would be theatre, and a wrong guess at it would be an error
|
||||
message about something that does not exist."""
|
||||
|
||||
#: Bounded, because it is the one field an unauthenticated stranger can
|
||||
#: send: scrypt is memory-hard by design and a megabyte of "password" is a
|
||||
#: megabyte this process hashes before saying no.
|
||||
password: str = Field(max_length=1000)
|
||||
#: Where the middleware was sending them before it asked. Sanitised on the
|
||||
#: way back out — see `_safe_next` in `auth/router.py`.
|
||||
next: str = "/"
|
||||
|
||||
|
||||
class PasswordBody(BaseModel):
|
||||
"""Changing it. `current` is required even though the caller is signed in;
|
||||
`auth/router.py` says why."""
|
||||
|
||||
current: str = Field(max_length=1000)
|
||||
new: str = Field(max_length=1000)
|
||||
|
||||
|
||||
class PasskeyBody(BaseModel):
|
||||
"""A finished registration ceremony, on its way to be checked."""
|
||||
|
||||
credential: dict[str, Any]
|
||||
#: What to call it in the list. Suggested by the browser, editable after.
|
||||
label: str = ""
|
||||
|
||||
|
||||
class PasskeyLoginBody(BaseModel):
|
||||
"""A finished authentication ceremony. Same reasoning as above."""
|
||||
|
||||
credential: dict[str, Any]
|
||||
|
||||
|
||||
class LabelBody(BaseModel):
|
||||
"""Renaming a passkey."""
|
||||
|
||||
label: str
|
||||
Reference in new issue
Block a user