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
This commit is contained in:
Goffi 2022-10-31 13:48:01 +01:00
commit 684401a3d8
2 changed files with 24 additions and 0 deletions

View file

@ -179,6 +179,12 @@ class BlogPublishCommon(object):
action="store_true",
help=_("end-to-end encrypt the blog post")
)
self.parser.add_argument(
"--encrypt-for",
metavar="JID",
action="append",
help=_("encrypt a single item for")
)
self.parser.add_argument(
"-X",
"--sign",
@ -214,6 +220,8 @@ class BlogPublishCommon(object):
mb_data["encrypted"] = True
if self.args.sign:
mb_data["signed"] = True
if self.args.encrypt_for:
mb_data["encrypted_for"] = {"targets": self.args.encrypt_for}
class Set(base.CommandBase, BlogPublishCommon):

View file

@ -1229,6 +1229,12 @@ class Set(base.CommandBase):
action="store_true",
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",
@ -1249,6 +1255,8 @@ class Set(base.CommandBase):
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)
@ -1403,6 +1411,12 @@ class Edit(base.CommandBase, common.BaseEdit):
action="store_true",
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",
@ -1414,6 +1428,8 @@ class Edit(base.CommandBase, common.BaseEdit):
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(