@getcirrus/pds 0.19.0 → 0.20.1

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
@@ -135,19 +135,39 @@ Updates your DID document to point to your new PDS. This is the critical step th
135
135
  ```bash
136
136
  pds identity # Update identity for production
137
137
  pds identity --dev # Update identity for local dev
138
- pds identity --token XXX # Skip email step if you have a token
138
+ pds identity --token XXX # Skip the email step if you already have a code
139
139
  ```
140
140
 
141
141
  The command:
142
142
 
143
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
144
+ 2. If your handle is changing, checks that the new one already resolves to your DID. If it doesn't, it shows how to fix that and asks before continuing
145
+ 3. Authenticates with your source PDS (requires your password)
146
+ 4. Chooses your [rotation keys](#rotation-and-recovery-keys): any keys you already hold, then your new PDS's key. The source PDS's key is removed. If you don't hold any keys, it offers to create a recovery key and helps you back it up
147
+ 5. Shows a summary and asks you to confirm
148
+ 6. Requests an email confirmation code from the source PDS
149
+ 7. Gets the source PDS to sign a PLC operation with the new endpoint, signing key, rotation keys and handle (`alsoKnownAs`), so a handle chosen in `pds init` replaces a `*.bsky.social` one
150
+ 8. Submits the signed operation to the PLC directory and checks the result
148
151
 
149
152
  **Note:** Only `did:plc` identities are supported. `did:web` identities don't use PLC operations.
150
153
 
154
+ ### `pds rotation-keys`
155
+
156
+ Shows your DID's [rotation keys](#rotation-and-recovery-keys) and makes sure your PDS is one of them.
157
+
158
+ ```bash
159
+ pds rotation-keys # Check and update rotation keys for production
160
+ pds rotation-keys --dev # Same, for local dev
161
+ ```
162
+
163
+ Accounts migrated with an earlier version of `pds identity` still list the previous PDS's key and not your PDS's, so your PDS can't change your handle or move your identity. This command fixes that, and can also add a recovery key. It sets the rotation keys to the keys you hold, then your PDS's key. The change has to be signed by a key that is already listed, so it uses:
164
+
165
+ - **Your PDS**, if it is already a rotation key
166
+ - **Your previous PDS**, which needs your password there and an email code. This only works while your old account still exists
167
+ - **A rotation key you hold**, such as a recovery key. Paste the private key when asked; it is used locally and never sent anywhere
168
+
169
+ `pds status` reports whether your PDS can update your identity.
170
+
151
171
  ### `pds activate`
152
172
 
153
173
  Enables writes on the account after migration.
@@ -195,6 +215,8 @@ When migrating to a new PDS, the destination will ask for a confirmation token.
195
215
 
196
216
  The token is copied to your clipboard and displayed in the terminal. After migration completes, run `pds deactivate` on this PDS.
197
217
 
218
+ The PDS signs the migration with its signing key, so that key must be one of your DID's [rotation keys](#rotation-and-recovery-keys). If `pds status` says your PDS can't update your identity, run `pds rotation-keys` first.
219
+
198
220
  ### `pds passkey`
199
221
 
200
222
  Manage passkeys for passwordless authentication.
@@ -358,6 +380,14 @@ _atproto.alice.example.com TXT "did=did:web:pds.example.com"
358
380
  dig TXT _atproto.alice.example.com
359
381
  ```
360
382
 
383
+ ### Changing Handle
384
+
385
+ Change your handle from the handle settings in Bluesky or any other app that uses `com.atproto.identity.updateHandle`. Set up verification for the new handle first (a DNS TXT record, or the PDS hostname itself); the PDS rejects a handle that does not resolve to your DID.
386
+
387
+ For did:plc accounts the handle is also listed in the PLC directory (`alsoKnownAs`). The PDS updates it for you if its signing key is one of the DID's [rotation keys](#rotation-and-recovery-keys). Accounts migrated with an earlier version of `pds identity` may not have it: run `pds rotation-keys` once to fix that. Alternatively, update `alsoKnownAs` with a rotation key you control (such as a recovery key), then change the handle in the app. The PDS sees the PLC directory already has the new handle and skips that step.
388
+
389
+ The new handle is stored by the PDS. If you later change the `HANDLE` variable and redeploy, the variable takes precedence again.
390
+
361
391
  ## Configuration
362
392
 
363
393
  The PDS uses environment variables for configuration. Public values go in `wrangler.jsonc`, secrets are stored via Wrangler or in `.dev.vars` for local development.
@@ -520,7 +550,7 @@ npx pds init
520
550
  # Answer "Yes" when asked about migrating an existing account
521
551
  ```
522
552
 
523
- This detects your existing account, generates new signing keys, and configures the PDS in deactivated mode (ready for data import).
553
+ This detects your existing account, generates new signing keys, and configures the PDS in deactivated mode (ready for data import). If your handle is on a hosted domain such as `*.bsky.social`, choose a domain you control as your new handle. `pds identity` moves your handle to it, so set up verification first: using your PDS hostname as the handle needs nothing extra, and any other domain needs the DNS TXT record `init` shows.
524
554
 
525
555
  ### Step 2: Deploy and transfer data
526
556
 
@@ -545,14 +575,15 @@ If interrupted, run `pds migrate` again to resume.
545
575
  npx pds identity
546
576
  ```
547
577
 
548
- This updates your DID document to point to your new PDS. The command:
578
+ This updates your DID document to point to your new PDS and gives your new PDS control of your identity. The command:
549
579
 
550
580
  1. Authenticates with your source PDS (requires password)
551
- 2. Requests an email confirmation token
552
- 3. Gets the source PDS to sign a PLC operation with your new endpoint
553
- 4. Submits the signed operation to the PLC directory
581
+ 2. Sets your rotation keys: keys you hold first, then your new PDS's key. If you hold none, it offers to create a [recovery key](#rotation-and-recovery-keys). Back it up when asked
582
+ 3. Requests an email confirmation code
583
+ 4. Gets the source PDS to sign a PLC operation with your new endpoint, signing key, rotation keys and handle
584
+ 5. Submits the signed operation to the PLC directory
554
585
 
555
- You'll receive an email with a confirmation token – enter it when prompted.
586
+ You'll receive an email with a confirmation code – enter it when prompted.
556
587
 
557
588
  ### Step 4: Activate the account
558
589
 
@@ -594,6 +625,31 @@ npx pds activate # Enable writes
594
625
  npx pds status # Check everything is working
595
626
  ```
596
627
 
628
+ ## Rotation and Recovery Keys
629
+
630
+ A `did:plc` identity lists up to five **rotation keys**. Any change to the DID document (your PDS, your signing key, your handle) has to be signed by one of them, so whoever holds a rotation key controls the identity.
631
+
632
+ After migration your rotation keys are:
633
+
634
+ 1. Your **recovery key**, if you have one
635
+ 2. Your PDS's signing key
636
+
637
+ Your PDS can then change your handle, rotate its signing key, or migrate you to another PDS, without involving your previous PDS.
638
+
639
+ The order matters. For 72 hours after any change, a higher-priority key can override it by signing a competing operation. Your recovery key ranks above your PDS's key, so if your PDS is compromised and someone changes your identity, you have 72 hours to undo it. After that the change is permanent. Your recovery key can also update your DID at any time if your PDS is gone.
640
+
641
+ Keep the recovery key offline, such as in a password manager. It is a multibase private key in the format used by [goat](https://github.com/bluesky-social/goat). To use it in an emergency, for example to point your DID at a new PDS:
642
+
643
+ ```bash
644
+ goat plc update --pds https://new-pds.example.com did:plc:... > op.json
645
+ goat plc sign --plc-signing-key z... op.json > signed.json
646
+ goat plc submit --did did:plc:... signed.json
647
+ ```
648
+
649
+ To override a change made in the last 72 hours, build the operation on top of the last one you trust by adding `--prev <cid>` to `goat plc update`. The audit log at `https://plc.directory/did:plc:.../log/audit` lists each operation's CID. See the [PLC specification](https://github.com/did-method-plc/did-method-plc) for details.
650
+
651
+ Run `pds rotation-keys` to check your keys or add a recovery key, and `pds status` to see whether your PDS can update your identity.
652
+
597
653
  ## Validation
598
654
 
599
655
  Records are validated against AT Protocol lexicon schemas before being stored. The PDS uses optimistic validation: