github.com/supabase/cli@v1.168.1/cmd/encryption.go (about) 1 package cmd 2 3 import ( 4 "os" 5 6 "github.com/spf13/cobra" 7 "github.com/supabase/cli/internal/encryption/get" 8 "github.com/supabase/cli/internal/encryption/update" 9 "github.com/supabase/cli/internal/utils/flags" 10 ) 11 12 var ( 13 encryptionCmd = &cobra.Command{ 14 GroupID: groupManagementAPI, 15 Use: "encryption", 16 Short: "Manage encryption keys of Supabase projects", 17 } 18 19 rootKeyGetCmd = &cobra.Command{ 20 Use: "get-root-key", 21 Short: "Get the root encryption key of a Supabase project", 22 RunE: func(cmd *cobra.Command, args []string) error { 23 return get.Run(cmd.Context(), flags.ProjectRef) 24 }, 25 } 26 27 rootKeyUpdateCmd = &cobra.Command{ 28 Use: "update-root-key", 29 Short: "Update root encryption key of a Supabase project", 30 RunE: func(cmd *cobra.Command, args []string) error { 31 return update.Run(cmd.Context(), flags.ProjectRef, os.Stdin) 32 }, 33 } 34 ) 35 36 func init() { 37 encryptionCmd.PersistentFlags().StringVar(&flags.ProjectRef, "project-ref", "", "Project ref of the Supabase project.") 38 encryptionCmd.AddCommand(rootKeyUpdateCmd) 39 encryptionCmd.AddCommand(rootKeyGetCmd) 40 rootCmd.AddCommand(encryptionCmd) 41 }