https://github.com/bluesky-social/goat but with tangled's CI
10
fork

Configure Feed

Select the types of activity you want to include in your feed.

goat: improve PLC-related error messages

+22 -5
+20 -3
account_plc.go
··· 11 11 comatproto "github.com/bluesky-social/indigo/api/atproto" 12 12 "github.com/bluesky-social/indigo/atproto/crypto" 13 13 "github.com/bluesky-social/indigo/atproto/syntax" 14 + "github.com/did-method-plc/go-didplc" 14 15 15 16 "github.com/urfave/cli/v2" 16 17 ) ··· 186 187 return err 187 188 } 188 189 189 - var op json.RawMessage 190 - if err = json.Unmarshal(fileBytes, &op); err != nil { 190 + var opEnum didplc.OpEnum 191 + if err = json.Unmarshal(fileBytes, &opEnum); err != nil { 191 192 return fmt.Errorf("failed decoding PLC op JSON: %w", err) 192 193 } 194 + op := opEnum.AsOperation() 193 195 196 + if op.IsGenesis() { 197 + return fmt.Errorf("can't submit a genesis operation via PDS (HINT: Make sure the prev field is set, or try `goat plc submit --genesis`)") 198 + } 199 + 200 + if !op.IsSigned() { 201 + return fmt.Errorf("operation must be signed (HINT: try `goat account plc sign`)") 202 + } 203 + 204 + // convert it back to JSON for submission 205 + opEncoded, err := json.Marshal(op) 206 + if err != nil { 207 + return err 208 + } 209 + rawMsg := json.RawMessage(opEncoded) 194 210 err = agnostic.IdentitySubmitPlcOperation(ctx, xrpcc, &agnostic.IdentitySubmitPlcOperation_Input{ 195 - Operation: &op, 211 + Operation: &rawMsg, 196 212 }) 213 + 197 214 if err != nil { 198 215 return fmt.Errorf("failed submitting PLC op via PDS: %w", err) 199 216 }
+2 -2
plc.go
··· 517 517 518 518 privStr := cctx.String("plc-signing-key") 519 519 if privStr == "" { 520 - return fmt.Errorf("private key must be provided") 520 + return fmt.Errorf("private key must be provided (HINT: use `goat account plc` if your PDS holds the keys)") 521 521 } 522 522 523 523 inputReader, err := getFileOrStdin(s) ··· 587 587 588 588 var enum didplc.OpEnum 589 589 if err := json.Unmarshal(inBytes, &enum); err != nil { 590 - return err 590 + return fmt.Errorf("failed decoding PLC op JSON: %w", err) 591 591 } 592 592 op := enum.AsOperation() 593 593