Mercurial > libervia-backend
changeset 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 | 5fbdf986670c |
children | 5e3b983ab2c6 |
files | sat_frontends/jp/cmd_blog.py sat_frontends/jp/cmd_pubsub.py |
diffstat | 2 files changed, 24 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/sat_frontends/jp/cmd_blog.py Mon Oct 31 13:46:51 2022 +0100 +++ b/sat_frontends/jp/cmd_blog.py Mon Oct 31 13:48:01 2022 +0100 @@ -180,6 +180,12 @@ 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", action="store_true", @@ -214,6 +220,8 @@ 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):
--- 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(