                 return counter
             case .timer(let period):
                 let timeSinceEpoch = time.timeIntervalSince1970
-                guard Generator.isValidTime(timeSinceEpoch) else {
-                    throw Error.invalidTime
-                }
-                guard Generator.isValidPeriod(period) else {
-                    throw Error.invalidPeriod
-                }
+                try Generator.validateTime(timeSinceEpoch)
+                try Generator.validatePeriod(period)
                 return UInt64(timeSinceEpoch / period)
             }
         }

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

    /// - throws: A `Generator.Error` if a valid password cannot be generated for the given time.
    /// - returns: The generated password, or throws an error if a password could not be generated.
    public func password(at time: Date) throws -> String {
        try Generator.validateDigits(digits)

        let counter = try factor.counterValue(at: time)
        // Ensure the counter value is big-endian
