Exports the repository key for backup.
(self, args, repository)
| 84 | |
| 85 | @with_repository(lock=False, manifest=False, cache=False) |
| 86 | def do_key_export(self, args, repository): |
| 87 | """Exports the repository key for backup.""" |
| 88 | manager = KeyManager(repository) |
| 89 | manager.load_keyblob() |
| 90 | try: |
| 91 | if args.path is not None and os.path.isdir(args.path): |
| 92 | # on Windows, Python raises PermissionError instead of IsADirectoryError |
| 93 | # (like on Unix) if the file to open is actually a directory. |
| 94 | raise IsADirectoryError |
| 95 | if args.paper: |
| 96 | manager.export_paperkey(args.path) |
| 97 | elif args.qr: |
| 98 | manager.export_qr(args.path) |
| 99 | else: |
| 100 | manager.export(args.path) |
| 101 | except IsADirectoryError: |
| 102 | raise CommandError(f"'{args.path}' must be a file, not a directory") |
| 103 | |
| 104 | @with_repository(lock=False, manifest=False, cache=False) |
| 105 | def do_key_import(self, args, repository): |
nothing calls this directly
no test coverage detected