changePassword method

Future<void> changePassword(
  1. String oldPassword,
  2. String newPassword
)

Changes the account password on the Haveno daemon.

Takes the oldPassword and the newPassword as parameters.

Throws a DaemonNotConnectedException if the havenoChannel is not connected.

Throws specific exceptions depending on the gRPC error encountered.

Implementation

Future<void> changePassword(String oldPassword, String newPassword) async {
  if (!havenoChannel.isConnected) {
    throw DaemonNotConnectedException();
  }
  try {
    await havenoChannel.accountClient!.changePassword(ChangePasswordRequest(oldPassword: oldPassword, newPassword: newPassword));
  } on GrpcError catch (e) {
    // Will need to catch whatever exception is thrown for invalid password
    handleGrpcError(e);
  }
}