@getcirrus/pds 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,9 +8,9 @@ Cirrus is a single-user [AT Protocol](https://atproto.com) Personal Data Server
8
8
 
9
9
  Host your own Bluesky identity with minimal infrastructure.
10
10
 
11
- > **⚠️ Experimental Software**
11
+ > **⚠️ Beta Software**
12
12
  >
13
- > This is an early-stage project under active development. **Do not migrate your main Bluesky account to this PDS yet.** Use a test account or create a new identity for experimentation. Data loss, breaking changes, and missing features are expected.
13
+ > This is under active development. Account migration has been tested and works, but breaking changes may still occur. Consider backing up important data before migrating a primary account.
14
14
 
15
15
  ## What is a PDS?
16
16
 
@@ -89,8 +89,7 @@ The package includes a CLI for setup, migration, and secret management.
89
89
  Interactive setup wizard for configuring the PDS.
90
90
 
91
91
  ```bash
92
- pds init # Configure for local development
93
- pds init --production # Deploy secrets to Cloudflare
92
+ pds init # Configure the PDS (prompts for Cloudflare deploy)
94
93
  ```
95
94
 
96
95
  **What it does:**
@@ -129,6 +128,26 @@ The migration is resumable. If interrupted, run `pds migrate` again to continue.
129
128
  - `--dev` – Target the local development server instead of production
130
129
  - `--clean` – Delete any existing imported data and start fresh (only works on deactivated accounts)
131
130
 
131
+ ### `pds identity`
132
+
133
+ Updates your DID document to point to your new PDS. This is the critical step that tells the network where to find you.
134
+
135
+ ```bash
136
+ pds identity # Update identity for production
137
+ pds identity --dev # Update identity for local dev
138
+ pds identity --token XXX # Skip email step if you have a token
139
+ ```
140
+
141
+ The command:
142
+
143
+ 1. Resolves your current DID to find the source PDS
144
+ 2. Authenticates with your source PDS (requires your password)
145
+ 3. Requests an email confirmation token
146
+ 4. Gets the source PDS to sign a PLC operation with the new endpoint
147
+ 5. Submits the signed operation to the PLC directory
148
+
149
+ **Note:** Only `did:plc` identities are supported. `did:web` identities don't use PLC operations.
150
+
132
151
  ### `pds activate`
133
152
 
134
153
  Enables writes on the account after migration.
@@ -158,6 +177,24 @@ pds migrate --clean # Reset and re-import
158
177
  pds activate # Go live again
159
178
  ```
160
179
 
180
+ ### `pds migrate-token`
181
+
182
+ Generates a migration token for migrating away from this PDS to another one.
183
+
184
+ ```bash
185
+ pds migrate-token # Generate token for production PDS
186
+ pds migrate-token --dev # Generate token for local development PDS
187
+ ```
188
+
189
+ When migrating to a new PDS, the destination will ask for a confirmation token. This command generates a stateless HMAC-based token that:
190
+
191
+ - Is valid for 15 minutes
192
+ - Contains your DID and expiry time
193
+ - Is cryptographically signed with your JWT secret
194
+ - Requires no database storage
195
+
196
+ The token is copied to your clipboard and displayed in the terminal. After migration completes, run `pds deactivate` on this PDS.
197
+
161
198
  ### `pds passkey`
162
199
 
163
200
  Manage passkeys for passwordless authentication.
@@ -401,10 +438,10 @@ See the [@getcirrus/oauth-provider](../oauth-provider/) package for implementati
401
438
 
402
439
  1. **Enable R2** in your [Cloudflare dashboard](https://dash.cloudflare.com/?to=/:account/r2/overview). The bucket will be created automatically on first deploy.
403
440
 
404
- 2. **Run the production setup** to deploy secrets:
441
+ 2. **Run the setup wizard** and answer "Yes" when asked if you want to deploy to Cloudflare:
405
442
 
406
443
  ```bash
407
- npx pds init --production
444
+ npx pds init
408
445
  ```
409
446
 
410
447
  3. **Deploy your worker:**
@@ -419,30 +456,84 @@ wrangler deploy
419
456
 
420
457
  Moving an existing Bluesky account to your own PDS:
421
458
 
422
- ### 1. Configure for migration
459
+ ### Step 1: Configure for migration
423
460
 
424
461
  ```bash
425
462
  npx pds init
426
463
  # Answer "Yes" when asked about migrating an existing account
427
464
  ```
428
465
 
429
- ### 2. Deploy and migrate data
466
+ This detects your existing account, generates new signing keys, and configures the PDS in deactivated mode (ready for data import).
467
+
468
+ ### Step 2: Deploy and transfer data
430
469
 
431
470
  ```bash
432
471
  wrangler deploy
433
472
  npx pds migrate
434
473
  ```
435
474
 
436
- ### 3. Update your identity
475
+ The migrate command:
476
+ - Resolves your DID to find the current PDS
477
+ - Authenticates with your source PDS
478
+ - Downloads the repository (posts, follows, likes, etc.)
479
+ - Transfers all blobs (images, videos)
480
+ - Copies user preferences
481
+
482
+ If interrupted, run `pds migrate` again to resume.
483
+
484
+ ### Step 3: Update your identity
485
+
486
+ ```bash
487
+ npx pds identity
488
+ ```
489
+
490
+ This updates your DID document to point to your new PDS. The command:
491
+ 1. Authenticates with your source PDS (requires password)
492
+ 2. Requests an email confirmation token
493
+ 3. Gets the source PDS to sign a PLC operation with your new endpoint
494
+ 4. Submits the signed operation to the PLC directory
437
495
 
438
- Follow the [AT Protocol account migration guide](https://atproto.com/guides/account-migration) to update your DID document. This typically requires email verification from your current PDS.
496
+ You'll receive an email with a confirmation token enter it when prompted.
439
497
 
440
- ### 4. Go live
498
+ ### Step 4: Activate the account
441
499
 
442
500
  ```bash
443
501
  npx pds activate
444
502
  ```
445
503
 
504
+ This enables writes on your new PDS. Your account is now live.
505
+
506
+ ### Step 5: Verify the migration
507
+
508
+ ```bash
509
+ npx pds status
510
+ ```
511
+
512
+ Check that:
513
+ - The account is active
514
+ - The repository has the expected number of records
515
+ - Your handle resolves correctly
516
+
517
+ ### Full command sequence
518
+
519
+ ```bash
520
+ # 1. Configure (answer "Yes" to deploy secrets to Cloudflare)
521
+ npx pds init # Configure for migration + deploy secrets
522
+
523
+ # 2. Deploy and migrate
524
+ wrangler deploy # Deploy the worker
525
+ npx pds migrate # Transfer data from source PDS
526
+
527
+ # 3. Update identity
528
+ npx pds identity # Update DID document (requires email)
529
+
530
+ # 4. Go live
531
+ npx pds activate # Enable writes
532
+
533
+ # 5. Verify
534
+ npx pds status # Check everything is working
535
+ ```
536
+
446
537
  ## Validation
447
538
 
448
539
  Records are validated against AT Protocol lexicon schemas before being stored. The PDS uses optimistic validation: