diff sat_frontends/jp/cmd_file.py @ 3970:4c3361e2bf55

cli (file/send): add `--encrypt` argument to request encryption: rel 378
author Goffi <goffi@goffi.org>
date Mon, 31 Oct 2022 04:09:38 +0100
parents 1877c5c477ec
children 524856bd7b19
line wrap: on
line diff
--- a/sat_frontends/jp/cmd_file.py	Mon Oct 31 04:09:34 2022 +0100
+++ b/sat_frontends/jp/cmd_file.py	Mon Oct 31 04:09:38 2022 +0100
@@ -75,6 +75,12 @@
             default="",
             help=("name to use (DEFAULT: use source file name)"),
         )
+        self.parser.add_argument(
+            "-e",
+            "--encrypt",
+            action="store_true",
+            help=_("end-to-end encrypt the file transfer")
+        )
 
     async def onProgressStarted(self, metadata):
         self.disp(_("File copy started"), 2)
@@ -123,6 +129,8 @@
             extra["path"] = self.args.path
         if self.args.namespace:
             extra["namespace"] = self.args.namespace
+        if self.args.encrypt:
+            extra["encrypted"] = True
 
         if self.args.bz2:
             with tempfile.NamedTemporaryFile("wb", delete=False) as buf:
@@ -147,7 +155,7 @@
                         buf.name,
                         self.args.name or archive_name,
                         "",
-                        extra,
+                        data_format.serialise(extra),
                         self.profile,
                     )
                 except Exception as e:
@@ -164,7 +172,7 @@
                         path,
                         self.args.name,
                         "",
-                        extra,
+                        data_format.serialise(extra),
                         self.profile,
                     )
                 except Exception as e: