def initialize_passphrase() -> None: if Keychain.has_master_passphrase(): print("Keyring is already protected by a passphrase") print( "\nUse 'chia passphrase set' or 'chia passphrase remove' to update or remove your passphrase" ) sys.exit(1) # We'll rely on Keyring initialization to leverage the cached passphrase for # bootstrapping the keyring encryption process print("Setting keyring passphrase") passphrase: Optional[str] = None # save_passphrase indicates whether the passphrase should be saved in the # macOS Keychain or Windows Credential Manager save_passphrase: bool = False if Keychain.has_cached_passphrase(): passphrase = Keychain.get_cached_master_passphrase() if not passphrase or passphrase == default_passphrase(): passphrase, save_passphrase = prompt_for_new_passphrase() Keychain.set_master_passphrase(current_passphrase=None, new_passphrase=passphrase, save_passphrase=save_passphrase)
def initialize_passphrase() -> None: if Keychain.has_master_passphrase(): print("Keyring is already protected by a passphrase") print( "\nUse 'chia passphrase set' or 'chia passphrase remove' to update or remove your passphrase" ) sys.exit(1) # We'll rely on Keyring initialization to leverage the cached passphrase for # bootstrapping the keyring encryption process print("Setting keyring passphrase") passphrase = None if Keychain.has_cached_passphrase(): passphrase = Keychain.get_cached_master_passphrase() if not passphrase or passphrase == default_passphrase(): passphrase = prompt_for_new_passphrase() Keychain.set_master_passphrase(current_passphrase=None, new_passphrase=passphrase)