diff --git a/sat_frontends/jp/cmd_pubsub.py b/sat_frontends/jp/cmd_pubsub.py index 2341d365..07e60a8e 100644 --- a/sat_frontends/jp/cmd_pubsub.py +++ b/sat_frontends/jp/cmd_pubsub.py @@ -1681,6 +1681,52 @@ class Reference(base.CommandBase): 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 @@ class Pubsub(base.CommandBase): Subscriptions, Affiliations, Reference, + Signature, Search, Transform, Attachments,