diff --git a/cmd/root.go b/cmd/root.go index 9b11cfc79d7c1beadd311add7455f39ba8d1aa48..91d4639644009a7dacc83bd4f4dfd78c22ee698d 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -147,6 +147,11 @@ var rootCmd = &cobra.Command{ authConfirmed = true } + // Delete this recipient + if viper.GetBool("delete-channel") { + deleteChannel(client, recipientID) + } + if client.HasAuthenticatedChannel(recipientID) { jww.INFO.Printf("Authenticated channel already in "+ "place for %s", recipientID) @@ -420,6 +425,13 @@ func acceptChannel(client *api.Client, recipientID *id.ID) { } } +func deleteChannel(client *api.Client, partnerId *id.ID) { + err := client.DeleteContact(partnerId) + if err != nil { + jww.FATAL.Panicf("%+v", err) + } +} + func printChanRequest(requestor contact.Contact, message string) { msg := fmt.Sprintf("Authentication channel request from: %s\n", requestor.ID) @@ -748,6 +760,10 @@ func init() { viper.BindPFlag("accept-channel", rootCmd.Flags().Lookup("accept-channel")) + rootCmd.Flags().Bool("delete-channel", false, + "Delete the channel information for the corresponding recipient ID") + viper.BindPFlag("delete-channel", rootCmd.Flags().Lookup("delete-channel")) + rootCmd.Flags().BoolP("send-auth-request", "", false, "Send an auth request to the specified destination and wait"+ "for confirmation")