diff sat_frontends/jp/cmd_pubsub.py @ 3973:570254d5a798

cli (blog, pubsub): encryption argument for Pubsub Targeted Encryption: add a new `--encrypt-for` argument to `blog/set` `blog/edit` `pubsub/set` and `pubsub/edit` rel 382
author Goffi <goffi@goffi.org>
date Mon, 31 Oct 2022 13:48:01 +0100
parents 2695dafc5c4d
children 524856bd7b19
line wrap: on
line diff
--- a/sat_frontends/jp/cmd_pubsub.py	Mon Oct 31 13:46:51 2022 +0100
+++ b/sat_frontends/jp/cmd_pubsub.py	Mon Oct 31 13:48:01 2022 +0100
@@ -1230,6 +1230,12 @@
             help=_("end-to-end encrypt the blog item")
         )
         self.parser.add_argument(
+            "--encrypt-for",
+            metavar="JID",
+            action="append",
+            help=_("encrypt a single item for")
+        )
+        self.parser.add_argument(
             "-X",
             "--sign",
             action="store_true",
@@ -1249,6 +1255,8 @@
         extra = {}
         if self.args.encrypt:
             extra["encrypted"] = True
+        if self.args.encrypt_for:
+            extra["encrypted_for"] = {"targets": self.args.encrypt_for}
         if self.args.sign:
             extra["signed"] = True
         publish_options = NodeCreate.get_config_options(self.args)
@@ -1404,6 +1412,12 @@
             help=_("end-to-end encrypt the blog item")
         )
         self.parser.add_argument(
+            "--encrypt-for",
+            metavar="JID",
+            action="append",
+            help=_("encrypt a single item for")
+        )
+        self.parser.add_argument(
             "-X",
             "--sign",
             action="store_true",
@@ -1414,6 +1428,8 @@
         extra = {}
         if self.args.encrypt:
             extra["encrypted"] = True
+        if self.args.encrypt_for:
+            extra["encrypted_for"] = {"targets": self.args.encrypt_for}
         if self.args.sign:
             extra["signed"] = True
         published_id = await self.host.bridge.psItemSend(