# HG changeset patch # User Goffi # Date 1666975637 -7200 # Node ID da0e772881c309e7983ecfdffaa38217281adfa2 # Parent e2a5f2f5e57bb9d4cbe799d408b74f9a4e753f45 cli (pubsub): new `signature` subcommands: A first `check` command can be used to check signature using the signature JSON data. More commands should follow to check or sign items. rel 381 diff -r e2a5f2f5e57b -r da0e772881c3 sat_frontends/jp/cmd_pubsub.py --- a/sat_frontends/jp/cmd_pubsub.py Fri Oct 28 18:47:17 2022 +0200 +++ b/sat_frontends/jp/cmd_pubsub.py Fri Oct 28 18:47:17 2022 +0200 @@ -1681,6 +1681,52 @@ self.host.quit() +class SignatureCheck(base.CommandBase): + def __init__(self, host): + super().__init__( + host, + "check", + use_output=C.OUTPUT_DICT, + use_pubsub=True, + pubsub_flags={C.SERVICE, C.NODE, C.SINGLE_ITEM}, + help=_("check the validity of pubsub signature"), + ) + + def add_parser_options(self): + self.parser.add_argument( + "signature", + metavar="JSON", + help=_("signature data") + ) + + async def start(self): + try: + ret_s = await self.host.bridge.psSignatureCheck( + self.args.service, + self.args.node, + self.args.item, + self.args.signature, + self.profile, + ) + except Exception as e: + self.disp(f"can't check signature: {e}", error=True) + self.host.quit(C.EXIT_BRIDGE_ERRBACK) + else: + await self.output(data_format.deserialise((ret_s))) + self.host.quit() + + +class Signature(base.CommandBase): + subcommands = ( + SignatureCheck, + ) + + def __init__(self, host): + super().__init__( + host, "signature", use_profile=False, help=_("item signature") + ) + + class Search(base.CommandBase): """This command do a search without using MAM @@ -2898,6 +2944,7 @@ Subscriptions, Affiliations, Reference, + Signature, Search, Transform, Attachments,