You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(pds): implement account migration endpoints for PDS (#16)
* feat(pds): implement account migration endpoints
Add support for migrating accounts between PDS instances using CAR file
import/export.
Changes:
- Add com.atproto.repo.importRepo endpoint for importing repository from
CAR file (authenticated, 100MB limit)
- Add com.atproto.server.getAccountStatus endpoint for migration planning
- Add rpcImportRepo method to AccountDurableObject with DID validation
- Add @ipld/car to dependencies for CAR file parsing
- Add comprehensive migration tests (9 tests covering auth, validation,
and import/export workflow)
- Update EDGE_PDS_PLAN.md to document Phase 9 (Account Migration)
The implementation validates that:
- CAR files have valid structure (single root, non-empty blocks)
- DID in imported repo matches the target PDS DID
- Import is prevented if repository already exists
- Proper error handling for oversized files and malformed CAR data
This enables users to migrate their accounts from other PDS instances
while maintaining data integrity and preventing migration errors.
* refactor(pds): use official @atproto/repo CAR utilities
Replace direct @ipld/car usage with official @atproto/repo utilities
for better alignment with AT Protocol standards.
Changes:
- Use readCarWithRoot() instead of CarReader.fromBytes()
- Automatically validates single root requirement
- Returns BlockMap directly for efficient storage
- Use putMany() instead of individual putBlock() calls
- More efficient bulk import operation
- Leverages existing BlockMap support
- Move @ipld/car from dependencies to devDependencies
- Only needed for test validation
- Reduces runtime dependencies
Benefits:
- Cleaner, more maintainable code (removed ~30 lines)
- Better alignment with AT Protocol standards
- More efficient block import (single putMany vs loop)
- Consistent with export (blocksToCarFile)
- Automatic validation built into readCarWithRoot
All 93 tests passing, including 9 migration tests.
---------
Co-authored-by: Claude <noreply@anthropic.com>
0 commit comments