         guard Generator.isValidFactor(factor) else {
             throw Generator.Error.invalidPeriod
         }
-        guard Generator.isValidDigits(digits) else {
-            throw Generator.Error.invalidDigits
-        }
+        try Generator.validateDigits(digits)
+
         self.factor = factor
         self.secret = secret
         self.algorithm = algorithm

private extension Generator {
    // MARK: Validation

    static func isValidDigits(_ digits: Int) -> Bool {
        // https://tools.ietf.org/html/rfc4226#section-5.3 states "Implementations MUST extract a
        // 6-digit code at a minimum and possibly 7 and 8-digit codes."

        }
    }

    static func validatePeriod(_ period: TimeInterval) throws {
        guard isValidPeriod(period) else {
            throw Error.invalidPeriod
        }
    }

    static func isValidPeriod(_ period: TimeInterval) -> Bool {
        // The period must be positive and non-zero to produce a valid counter value.
        return (period > 0)
    }

    static func validateTime(_ timeSinceEpoch: TimeInterval) throws {
        guard isValidTime(timeSinceEpoch) else {
            throw Error.invalidTime
        }
    }

    static func isValidTime(_ timeSinceEpoch: TimeInterval) -> Bool {
