beemdevelopment/Aegis · error

Unsupported digits

Error message

Unsupported digits: %d

What it means

When decoding a Google Authenticator migration payload, each OtpParameters entry carries a DigitCount enum. Aegis only supports 6 and 8 digit codes (DIGIT_COUNT_SIX, DIGIT_COUNT_EIGHT; unspecified falls back to 6). Any other enum value causes this exception.

Solutions

  1. Re-export using only 6- or 8-digit tokens, or change the token's digit count in the source app
  2. Regenerate the export payload with a compatible Google Authenticator version
  3. If you control the payload producer, restrict digit counts to 6 or 8

Example fix

// before
parameters.setDigits(DIGIT_COUNT_SEVEN); // unsupported
// after
parameters.setDigits(GoogleAuthProtos.MigrationPayload.DigitCount.DIGIT_COUNT_SIX);
Defensive patterns

Strategy: try-catch

Try / catch

try {
    GoogleAuthInfo.parseExportUri(uri);
} catch (GoogleAuthInfoException e) {
    // skip or surface this token; unsupported digits in payload
    Log.w(TAG, "Token skipped: " + e.getMessage());
}

Prevention

When it happens

Trigger: Parsing a migration payload where params.getDigits() is an enum value other than UNSPECIFIED, SIX, or EIGHT (e.g. a future/unknown DIGIT_COUNT value from a newer exporter), hitting the default branch of the digits switch.

Common situations: Payloads exported by a newer Google Authenticator version introducing a new digit count, or hand-forged protobuf payloads with out-of-range enum ordinals.

Related errors


AI-assisted analysis of beemdevelopment/Aegis@d6f4e5925a (2026-09-08). Data as JSON: /api/errors/13d2d4c675be3279. Report an issue: GitHub.

Appendix: source

Thrown at app/src/main/java/com/beemdevelopment/aegis/otp/GoogleAuthInfo.java:218

            throw new GoogleAuthInfoException(uri, e);
        }

        List<GoogleAuthInfo> infos = new ArrayList<>();
        for (GoogleAuthProtos.MigrationPayload.OtpParameters params : payload.getOtpParametersList()) {
            OtpInfo otp;
            try {
                int digits;
                switch (params.getDigits()) {
                    case DIGIT_COUNT_UNSPECIFIED:
                        // intentional fallthrough
                    case DIGIT_COUNT_SIX:
                        digits = TotpInfo.DEFAULT_DIGITS;
                        break;
                    case DIGIT_COUNT_EIGHT:
                        digits = 8;
                        break;
                    default:
                        throw new GoogleAuthInfoException(uri, String.format("Unsupported digits: %d", params.getDigits().ordinal()));
                }

                String algo;
                switch (params.getAlgorithm()) {
                    case ALGORITHM_UNSPECIFIED:
                        // intentional fallthrough
                    case ALGORITHM_SHA1:
                        algo = "SHA1";
                        break;
                    case ALGORITHM_SHA256:
                        algo = "SHA256";
                        break;
                    case ALGORITHM_SHA512:
                        algo = "SHA512";
                        break;
                    default:
                        throw new GoogleAuthInfoException(uri, String.format("Unsupported hash algorithm: %d", params.getAlgorithm().ordinal()));
                }

View on GitHub (pinned to d6f4e5925a)