edq.cli.crypto.decrypt-secret

Decrypt an edq.util.crypto.Secret into cleartext.

The standard configuration encryption key will be used.

 1# pylint: disable=invalid-name
 2
 3"""
 4Decrypt an edq.util.crypto.Secret into cleartext.
 5
 6The standard configuration encryption key will be used.
 7"""
 8
 9import argparse
10import sys
11
12import edq.config.constants
13import edq.core.argparser
14import edq.util.crypto
15
16def run_cli(args: argparse.Namespace) -> int:
17    """ Run the CLI. """
18
19    secret = edq.util.crypto.Secret.parse(args.ciphertext, args._config_info.application_config.encryption_key)
20
21    print(secret.cleartext)
22
23    return 0
24
25def main() -> int:
26    """ Get a parser, parse the args, and call run. """
27    return run_cli(_get_parser().parse_args())
28
29def _get_parser() -> argparse.ArgumentParser:
30    """ Get the parser. """
31
32    parser = edq.core.argparser.get_default_parser(__doc__.strip())
33
34    parser.add_argument('ciphertext', metavar = 'TEXT',
35        action = 'store', type = str,
36        help = 'The ciphertext to decrypt.')
37
38    return parser
39
40if (__name__ == '__main__'):
41    sys.exit(main())
def run_cli(args: argparse.Namespace) -> int:
17def run_cli(args: argparse.Namespace) -> int:
18    """ Run the CLI. """
19
20    secret = edq.util.crypto.Secret.parse(args.ciphertext, args._config_info.application_config.encryption_key)
21
22    print(secret.cleartext)
23
24    return 0

Run the CLI.

def main() -> int:
26def main() -> int:
27    """ Get a parser, parse the args, and call run. """
28    return run_cli(_get_parser().parse_args())

Get a parser, parse the args, and call run.