ЛР 7 — БВТ2302 — Макаренко — TLS и управление секретами

This commit is contained in:
2026-12-04 13:41:59 +03:00
parent 20afc2c790
commit 8a3cf7f2dd
55 changed files with 1991 additions and 24 deletions
+28
View File
@@ -0,0 +1,28 @@
import re
from pydantic import BaseModel, ConfigDict, Field
USERNAME_RE = re.compile(r"^[a-z0-9_]{3,32}$")
class CreateUser(BaseModel):
model_config = ConfigDict(extra="forbid")
password: str = Field(min_length=12,max_length=128)
username: str
display_name: str
class CreateChat(BaseModel):
model_config = ConfigDict(extra="forbid")
title: str
member_ids: list[str]
class CreateMessage(BaseModel):
model_config = ConfigDict(extra="forbid")
attachment_ids: list[str] = Field(default_factory=list,max_length=10)
text: str
def valid_text(value: str, maximum: int) -> bool:
return isinstance(value, str) and value.strip() != "" and 1 <= len(value) <= maximum