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/claim-codes (MM-86) #21

Summary#

  • Implements POST /v1/accounts/claim-codes for operator-authenticated invite code generation
  • Fixes V002 schema: the original claim_codes table required a NOT NULL did FK to accounts, making pre-account invite codes structurally impossible — V004 migration recreates the table correctly
  • 6-char uppercase alphanumeric codes via OsRng, batch-inserted in one transaction; status derived from redeemed_at/expires_at (no stored status enum)

Changes#

  • V004__claim_codes_invite.sql — recreates claim_codes without did FK; adds idx_claim_codes_expires_at
  • routes/claim_codes.rs — handler with 15 tests (happy path, format, DB persistence, validation, auth)
  • app.rs — route registered at POST /v1/accounts/claim-codes
  • relay/Cargo.toml — added rand_core dependency

Test plan#

  • cargo test -p relay -- claim_codes — 15 tests, all green
  • cargo test --workspace — 158 tests, all green
  • cargo clippy --workspace -- -D warnings — clean
  • cargo fmt --all --check — clean
  • Manual: POST with valid Bearer token + {"count": 3} returns 3 unique 6-char codes
  • Manual: wrong token → 401; count: 0 or count: 11 → 400
Labels

None yet.

assignee

None yet.

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