feat(payments): trusted platform signal on the session #216
Reference in New Issue
Block a user
Delete Branch "feature/trusted-platform-signal"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Record the execution platform (kind vk|telegram|direct + device subtype ios|android|web) on each session, captured at creation and carried gateway->backend as a trusted
X-Platformheader, so the upcoming store-compliance gate has an unforgeable execution context. Signal plumbing only — no user-visible change;X-Platformis inert until the gate consumes it.Backend
backend.sessionsgains nullableplatform_kind/platform_subtypecolumns (migration00011, CHECK-constrained, jet regenerated);session.Platformcaptures them at mint, resolve returns them, middleware exposesplatform(c).kindis derived from the establish endpoint, never a client field; the account-merge session mint inherits the caller's platform from the request context.Gateway
vk_platformviavkauth(trusted), Telegram/direct best-effort from the client — and injectsX-Platformon every authenticated backend call through the request context (sourced from the resolved session, never the body).Client
subtypefield); VK is server-derived.Semantics
Tests — Go unit (vkauth subtype incl. iPhone/iPad->ios, X-Platform middleware, backend-client injection), integration (session carries platform through create + cold-cache resolve per kind, untrusted path, CHECK constraints, migration 00011 forward+backward), UI (subtype normalization + codec wire). Full local suite green: build/vet/gofmt, integration, UI check/unit/build, Playwright e2e (Chromium+WebKit).
Docs updated in-PR:
docs/ARCHITECTURE.md§3,docs/PAYMENTS.md§8 (+_ru),PLAN.md.