request method

Future<String?> request(
  1. LicenseDocument license,
  2. LcpAuthenticating? authentication,
  3. bool allowUserInteraction,
  4. dynamic sender
)

Implementation

Future<String?> request(
    LicenseDocument license,
    LcpAuthenticating? authentication,
    bool allowUserInteraction,
    dynamic sender) async {
  List<String> candidates = await _possiblePassphrasesFromRepository(license);
  if (candidates.isNotEmpty) {
    String? passphrase;
    try {
      passphrase =
          lcpClient.findOneValidPassphrase(license.rawJson, candidates);
    } on Exception catch (ex, stacktrace) {
      Fimber.d("findOneValidPassphrase ERROR",
          ex: ex, stacktrace: stacktrace);
    }
    if (passphrase != null) {
      return passphrase;
    }
  }
  if (authentication != null) {
    return _authenticate(license, AuthenticationReason.passphraseNotFound,
        authentication, allowUserInteraction, sender);
  }
  return null;
}