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): implement POST /v1/accounts (MM-83) #23

Summary#

  • Adds POST /v1/accounts — operator-authenticated endpoint that provisions a pending account slot with a 24h claim code, before any DID is assigned
  • V005 migration introduces pending_accounts staging table; email and handle uniqueness is enforced across both pending and active (accounts) tables
  • Three new ErrorCode variants: AccountExists (409), HandleTaken (409), InvalidHandle (400)

What's included#

  • V005__pending_accounts.sqlpending_accounts(id, email, handle, tier, claim_code FK→claim_codes, created_at) with unique indices on email and handle
  • routes/create_account.rs — handler + 26 tests covering happy path, DB persistence, duplicate email/handle (both tables), handle format validation, tier validation, missing fields, auth, and DB error path
  • bruno/create_account.bru — Bruno collection entry
  • uuid v1 workspace dep for UUIDv4 account_id generation

Design notes#

  • pending_accounts is a staging area: no DID is assigned yet. A future wave handler will promote a row to accounts after device binding.
  • Handle validation is intentionally minimal (non-empty, ASCII, no whitespace, ≤253 chars) — ATProto handle/domain policy is deferred to a later wave to avoid incorrect rejections.
  • Both the claim_codes insert and the pending_accounts insert happen in one transaction, preventing orphaned codes.

Test plan#

  • cargo test — 112 tests, all passing
  • cargo clippy --workspace -- -D warnings — clean
  • Manually test via Bruno: POST /v1/accounts with valid payload returns 201 with accountId, claimCode, did: null, status: "pending"
  • Verify duplicate email returns 409
  • Verify invalid handle (e.g. empty string) returns 400
Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:web:malpercio.dev/sh.tangled.repo.pull/3mgvhmlpira22
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