Files
tools-legacy/openspec/changes/cropper-token-auth/tasks.md
T
adebisi-fa 796094f61b feat(cropper): save with the session token — no OTP, domain from a2loft
Consumes the a2loft cropper-token-auth change: the save now sends the
session's PocketBase token as a bearer credential and no phone/otp. The
backend authorizes with OpenFGA crop_image (domain:<code> -> domain:idid),
so an operator no longer needs super-user rights in the profile's domain —
which is what made saves fail with a blanket 'Invalid OTP specified.'.

- the save's domain comes from a2loft's own record of the picture
  (dims/picture/{uploadId} -> domainCode), falling back to the queue label,
  guarded by a path-safety pattern instead of the catalog check
- the 'core' -> 'uc' alias is deleted: 'core' is a2loft's own pseudo-domain
  for a profile picture (special-cased there), so rewriting it changed the
  attribution and the ID-card notification
- queue loads are enriched with the profile's domainCode; the panel shows
  the profile's domain and, when it differs, the picture target
- the cropper's OTP field, state and parameters are gone; the fingerprint
  wizard is untouched (its own OTP flow on its own endpoints)
- tests updated: bearer + no query auth, resolved domain wins, unsafe values
  refused, no OTP field served (46 pass)

Requires the a2loft change deployed first.
2026-10-01 12:37:25 +01:00

883 B

Tasks

  • 1. Save handler: Authorization: Bearer <session token>, no ?phone/otp; domain resolved from dims/picture/{uploadId} (domainCode) with the queue label as fallback, guarded by a path-safety pattern; requireOtp and the core → uc alias deleted.
  • 2. Queue loads enriched with the profile's domainCode for display; load-by-id passes it through.
  • 3. UI: OTP field, state and call parameters removed; panel shows the profile's domain and the picture target.
  • 4. Tests: save carries the bearer token and no query auth; the resolved domain wins over the body; unsafe values are refused; no OTP field in the served page; queue load exposes domainCode (46 tests pass).
  • 5. Deploy a2loft and this app, then a field pass: load a queued picture → save with no OTP → confirm the picture lands attributed to the token's phone.