# Changelog

## [Unreleased] — Phase 1 platform foundation
### Added
- Authentication: password reset and invitations (single-use hashed tokens), change password, session revocation, optional TOTP MFA
  (enrolment, sign-in step, replay protection, recovery codes, role-based enforcement), per-route rate limiters.
- Authorization: branches, departments, teams; roles with own/team/company scoped permissions; policies with class-level then
  record-level checks; anti-escalation and last-administrator guards; deny-by-default route inventory test.
- Audit: append-only hash-chained `audit_logs`, `AuditLogger` with redaction, `audit:verify`, audit API + screen.
- Admin screens: users, user form, roles list, role editor with permission matrix, audit log, account security, forgot/reset password, MFA sign-in step.
- Commands: `crm:create-admin` (audited), `audit:verify`, `crm:check-security`; development administrator seeded only when `APP_ENV=local`.
- Docs: first production administrator, permission model, API conventions, schema.
### Changed
- New migrations (organization tables, users/roles columns, audit, MFA/password tokens). Existing scaffold migrations are unchanged.
- Login now verifies credentials itself (uniform timing and error) and returns 202 when a second factor is needed.
- Seeded permissions grew from 4 to 8; the `admin` role requires MFA.

## Phase 1 scaffold
### Added
- Laravel 13 skeleton + Sanctum cookie-session auth (login, logout, me), `/api/v1` prefix.
- Health endpoints, standard JSON error format, request ids, baseline security headers, rate limiters.
- Tenancy primitives (`CompanyContext`, `CompanyScope`, `BelongsToCompany`), ULID public ids.
- Migrations: companies, users, sessions, roles, permissions, pivots, Sanctum tokens; idempotent seeders; `crm:create-admin`.
- Vue 3 + TypeScript SPA shell: router + guards, Pinia stores, typed API client, notifications, layouts, i18n (en), login/dashboard/404/403.
- Tooling: Pint, Larastan config, ESLint, Prettier, Vitest, GitHub Actions workflow (unverified).
### Not yet
- MFA, password reset, audit log, user/role admin, settings, all business modules.
