LifeMate — Personal, Family & Learning Companion
docs: define backend identity and authorization contract
davoodmehraban89 committed
Oct 5, 2026 at 07:31 UTC
a9ab92bb8750120098954abe6642742049b95f96
1 file changed
+20
backend/README.md
new
+20
@@ -0,0 +1,20 @@
1
+# LifeMate backend contract
2
+
3
+Phase 2 keeps infrastructure provider-neutral.
4
+
5
+## IdentityProvider
6
+Required operations: register(email,password), verifyEmail(token), signIn(email,password), requestPasswordReset(email), resetPassword(token,newPassword), changePassword(session,currentPassword,newPassword), revokeSession(session).
7
+
8
+Security requirements: normalized email; non-enumerating recovery response; single-use/time-limited verification and reset tokens stored as digests; modern password hashing in the identity adapter; session rotation/revocation; rate limiting; audit sensitive changes.
9
+
10
+## LifeMate API authorization
11
+Every request resolves an authenticated `app_user`. Family operations evaluate active membership and explicit guardian relationships server-side. `owner_admin` is administrative authority and never grants blanket access to private teen content. Safety-controlled access is a separate audited policy path.
12
+
13
+## Invitation
14
+Invitation token is random, time-limited and stored only as a digest. Acceptance requires authenticated email match (or an explicitly audited admin correction flow), active pending status and expiry validation. Membership is created transactionally with invitation acceptance.
15
+
16
+## PostgreSQL
17
+`migrations/` contains portable schema migrations. Database helper functions/constraints are defense in depth. Clients never connect with database-owner credentials.
18
+
19
+## Staging
20
+CI exercises migrations/tests against an isolated PostgreSQL service. Persistent managed staging is attached separately and must use its own credentials/data before Phase 2 is declared complete.