From 5243c7eb4c58a4419da2103af8c1e4004f01053b Mon Sep 17 00:00:00 2001 From: Ruben Pollan Date: Tue, 24 Oct 2017 11:53:10 +0200 Subject: [feat] add fetch key by fingerprint to keymanager - Resolves: #9023 --- src/leap/bitmask/cli/keys.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/leap/bitmask/cli') diff --git a/src/leap/bitmask/cli/keys.py b/src/leap/bitmask/cli/keys.py index 82de3868..ab73bfff 100644 --- a/src/leap/bitmask/cli/keys.py +++ b/src/leap/bitmask/cli/keys.py @@ -41,6 +41,7 @@ SUBCOMMANDS: list List all known keys export Export a given key + fetch Fetch key by fingerprint insert Insert a key to the key storage delete Delete a key from the key storage '''.format(name=command.appname) @@ -97,6 +98,26 @@ SUBCOMMANDS: return self._send(self._print_key) + def fetch(self, raw_args): + parser = argparse.ArgumentParser( + description='Bitmask fetch key by fingerprint', + prog='%s %s %s' % tuple(sys.argv[:3])) + parser.add_argument('-u', '--userid', default='', + help='Select the userid of the keyring') + parser.add_argument('address', nargs=1, + help='email address to pin to the key') + parser.add_argument('fingerprint', nargs=1, + help='fingerprint to fetch of the key') + subargs = parser.parse_args(raw_args) + + userid = subargs.userid + if not userid: + userid = self.cfg.get('bonafide', 'active', default='') + self.data += ['fetch', userid, subargs.address[0], + subargs.fingerprint[0]] + + return self._send(self._print_key) + def insert(self, raw_args): parser = argparse.ArgumentParser( description='Bitmask import key', -- cgit v1.2.3