passphrase method

Future<String> passphrase()

Implementation

Future<String> passphrase() async {
  if (stdin.hasTerminal) {
    stdout.writeln('Enter passphrase: ');
    stdin.echoMode = false;
    return stdin.readLineSync()!;
  } else {
    try {
      final tty = File('/dev/tty');
      await tty.writeAsString('Enter passphrase: ');
      return _readUntilNewLine(tty);
    } catch (e, stacktrace) {
      _logger.warning('Could not get tty', e, stacktrace);
      throw Exception(
          'Standard input is not a terminal, and /dev/tty is not available');
    }
  }
}