WP-01 exchange
OTP sketch until a later ADR replaces it. Envelope: envelope.md.
Workflow
- The client POSTs a phone to request OTP.
- The API stores a challenge. It returns no token.
- The client POSTs phone and code to verify.
- The API returns a
Session. The client keeps the token. - Later calls send that token.
GET /api/v1/afia/mereturnsAccount. - Deletion sends phone or email. The same
Accountrow is removed. Consent is a separate write withpurpose.
Wire
POST /api/v1/afia/auth/otp/request
req { "phone": "..." }
res { data: null, status, message, errors }
POST /api/v1/afia/auth/otp/verify
req { "phone": "...", "code": "..." }
res { data: { "token": "..." }, status, message, errors }
GET /api/v1/afia/me
res { data: { "id", "phone", "email", "roles": ["PATIENT", ...] }, ... }
Deletion on the /me prefix. Body is { "phone" } or { "email" }. Matches afia-web/delete-account.html.
Errors: unknown phone, bad code, missing session, last-admin delete policy later.
Ownership
WP-01 writes health.afia.app.identity and lib/domain/identity, lib/data/identity, lib/presentation/identity. Shared language is Account, Role, Session, Consent.
Does not do
Java or Dart class internals. Invented login screens. A second user table.