@Override
  public String respondToChallenge(AccountIndex account, String challenge)
      throws OtpSourceException {
    if (challenge == null) {
      return getCurrentCode(account, null);
    }
    try {
      byte[] challengeBytes = challenge.getBytes("UTF-8");
      return getCurrentCode(account, challengeBytes);
    } catch (UnsupportedEncodingException e) {
      return "";
    }
  }
Class containing implementation of HOTP/TOTP.

<p>Generates OTP codes for one or more accounts.
java/com/google/android/apps/authenticator/otp/OtpProvider.java