An easy-to-host PDS on the ATProtocol, iPhone and MacOS. Maintain control of your keys and data, always.
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(relay): POST /v1/accounts/sessions — provisioning login endpoint #34

Summary#

  • Implements POST /v1/accounts/sessions — email + password login for the provisioning API
  • Adds resolve_by_email DB helper in db/accounts.rs (sibling to resolve_identifier)
  • Corrects the original MM-85 spec: device_token auth was the early design; all mobile accounts now have password_hash set during the DID ceremony, making email + password the right mechanism

What it does#

When the app's provisioning session_token has expired or been lost (app reinstall, Keychain reset), this endpoint lets the user re-authenticate and get a fresh 1-year opaque bearer token compatible with all require_session-protected provisioning endpoints.

Request: POST /v1/accounts/sessions

{ "email": "user@example.com", "password": "..." }
Response:


{ "sessionToken": "...", "did": "did:plc:..." }
Implementation notes
Reuses verify_password, rate-limit functions (is_rate_limited / record_failure / clear_failures), and generate_token  no new auth primitives
Same 1-year TTL and token format as create_did.rs
NULL password_hash accounts (pre-DID ceremony) return 401
Test plan
 Valid email + password returns 200 with sessionToken and did
 sessionToken hash is queryable by the require_session DB lookup
 Wrong password  401 AUTHENTICATION_REQUIRED
 Unknown email  same 401 (identical body to wrong password  no enumeration)
 NULL password_hash account  401
 Deactivated account  401
 Rate limit triggers after RATE_LIMIT_MAX_FAILURES failures  429
 Successful login clears rate-limit counter
Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:web:malpercio.dev/sh.tangled.repo.pull/3mhvokufr4o22
Diff #0

No differences found between the selected revisions.

History

1 round 0 comments
sign up or login to add to the discussion
malpercio.dev submitted #0
patch application failed: error: No valid patches in input (allow with "--allow-empty")
expand 0 comments