MCPcopy Index your code
hub / github.com/archlinux/archinstall / _process_creds_data

Method _process_creds_data

archinstall/lib/args.py:709–750  ·  view source on GitHub ↗
(self, creds_data: str)

Source from the content-addressed store, hash-verified

707 return config
708
709 def _process_creds_data(self, creds_data: str) -> dict[str, Any] | None:
710 if creds_data.startswith('$'): # encrypted data
711 if self._args.creds_decryption_key is not None:
712 try:
713 creds_data = decrypt(creds_data, self._args.creds_decryption_key)
714 return json.loads(creds_data)
715 except ValueError as err:
716 if 'Invalid password' in str(err):
717 error(tr('Incorrect credentials file decryption password'))
718 sys.exit(1)
719 else:
720 debug(f'Error decrypting credentials file: {err}')
721 raise err from err
722 else:
723 header = tr('Enter credentials file decryption password')
724 wrong_pwd_text = tr('Incorrect password')
725 prompt = header
726
727 while True:
728 decryption_pwd: Password | None = tui.run(
729 lambda p=prompt: get_password( # type: ignore[misc]
730 header=p,
731 allow_skip=False,
732 no_confirmation=True,
733 )
734 )
735
736 if not decryption_pwd:
737 return None
738
739 try:
740 creds_data = decrypt(creds_data, decryption_pwd.plaintext)
741 break
742 except ValueError as err:
743 if 'Invalid password' in str(err):
744 debug('Incorrect credentials file decryption password')
745 prompt = f'{header}' + f'\n\n{wrong_pwd_text}'
746 else:
747 debug(f'Error decrypting credentials file: {err}')
748 raise err from err
749
750 return json.loads(creds_data)
751
752 def _fetch_from_url(self, url: str) -> str:
753 if urllib.parse.urlparse(url).scheme:

Callers 1

_parse_configMethod · 0.95

Calls 7

decryptFunction · 0.90
errorFunction · 0.90
trFunction · 0.90
debugFunction · 0.90
get_passwordFunction · 0.90
exitMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected