this repo has no description
0
fork

Configure Feed

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

add basic command to verify a user (#1040)

authored by

Whyrusleeping and committed by
GitHub
67e95825 cf8f9ea6

+61
+61
cmd/gosky/main.go
··· 104 104 readRepoStreamCmd, 105 105 parseRkey, 106 106 listLabelsCmd, 107 + verifyUserCmd, 107 108 } 108 109 109 110 app.RunAndExitOnError() ··· 814 815 return nil 815 816 }, 816 817 } 818 + 819 + var verifyUserCmd = &cli.Command{ 820 + Name: "verify-user", 821 + Usage: "create a feed generator record", 822 + Flags: []cli.Flag{}, 823 + Action: func(cctx *cli.Context) error { 824 + xrpcc, err := cliutil.GetXrpcClient(cctx, true) 825 + if err != nil { 826 + return err 827 + } 828 + 829 + ctx := context.TODO() 830 + arg := cctx.Args().First() 831 + 832 + idf, err := syntax.ParseAtIdentifier(arg) 833 + if err != nil { 834 + return err 835 + } 836 + 837 + ident, err := identity.DefaultDirectory().Lookup(ctx, *idf) 838 + if err != nil { 839 + return err 840 + } 841 + 842 + profrec, err := atproto.RepoGetRecord(ctx, xrpcc, "", "app.bsky.actor.profile", ident.DID.String(), "self") 843 + if err != nil { 844 + return err 845 + } 846 + 847 + ap, ok := profrec.Value.Val.(*bsky.ActorProfile) 848 + if !ok { 849 + return fmt.Errorf("got wrong record type back") 850 + } 851 + 852 + var dn string 853 + if ap.DisplayName != nil { 854 + dn = *ap.DisplayName 855 + } 856 + 857 + rec := &lexutil.LexiconTypeDecoder{Val: &bsky.GraphVerification{ 858 + CreatedAt: time.Now().Format(util.ISO8601), 859 + DisplayName: dn, 860 + Handle: ident.Handle.String(), 861 + Subject: ident.DID.String(), 862 + }} 863 + 864 + resp, err := atproto.RepoCreateRecord(ctx, xrpcc, &atproto.RepoCreateRecord_Input{ 865 + Collection: "app.bsky.graph.verification", 866 + Repo: xrpcc.Auth.Did, 867 + Record: rec, 868 + }) 869 + if err != nil { 870 + return err 871 + } 872 + 873 + fmt.Println(resp.Uri) 874 + 875 + return nil 876 + }, 877 + }