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/devices (MM-87) #25

Summary

  • Implements POST /v1/devices — device registration via claim code (MM-87)
  • V006 migration rebuilds devices to reference pending_accounts.id (registration precedes DID assignment), adding platform, public_key, device_token_hash; cascades to rebuild sessions, oauth_tokens, refresh_tokens
  • Device token is 32 random bytes, returned as base64url (no padding), stored as SHA-256 hex — plaintext never persisted
  • Claim-code redemption uses UPDATE-and-check-rows-affected in a single transaction (atomic, no race window)

Acceptance Criteria

  • Valid claim code registers device and returns { deviceId, deviceToken, accountId } (201 Created)
  • Invalid/expired/redeemed code returns 400 INVALID_CLAIM
  • Device appears in devices table with correct columns
  • Claim code marked redeemed (redeemed_at set) — single-use enforced
  • Platform validation: ios, android, macos, linux, windows (case-sensitive)

Test plan

  • cargo test --package relay — 143 tests pass
  • cargo clippy --workspace -- -D warnings — clean
  • Bruno: create account → copy claimCode → POST /v1/devices → verify 201
  • POST same claim code again → verify 400 INVALID_CLAIM
Labels

None yet.

assignee

None yet.

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