 
 private func parseCounterValue(_ rawValue: String) throws -> UInt64 {
     guard let counterValue = UInt64(rawValue, radix: 10) else {
-        throw DeserializationError.counterValue
+        throw DeserializationError.invalidCounterValue(rawValue)
     }
     return counterValue
 }
 
 private func parseTimerPeriod(_ rawValue: String) throws -> TimeInterval {
     guard let int = Int(rawValue) else {
-        throw DeserializationError.timerPeriod
+        throw DeserializationError.invalidTimerPeriod(rawValue)
     }
     return TimeInterval(int)
 }
 
 private func parseSecret(_ rawValue: String) throws -> Data {
     guard let data = MF_Base32Codec.data(fromBase32String: rawValue) else {
-        throw DeserializationError.secret
+        throw DeserializationError.invalidSecret(rawValue)
     }
     return data
 }
 
 private func parseDigits(_ rawValue: String) throws -> Int {
     guard let intValue = Int(rawValue) else {
-        throw DeserializationError.digits
+        throw DeserializationError.invalidDigits(rawValue)
     }
     return intValue
 }

}

internal enum DeserializationError: Swift.Error {
    case factor
    case counterValue
    case timerPeriod
    case secret
    case algorithm
    case digits
}

private let defaultAlgorithm: Generator.Algorithm = .sha1

    case kAlgorithmSHA512:
        return .sha512
    default:
        throw DeserializationError.invalidAlgorithm(string)
    }
}

