diff --git a/Sources/CertLogic/CertLogic.swift b/Sources/CertLogic/CertLogic.swift index 892101b..f228b5b 100644 --- a/Sources/CertLogic/CertLogic.swift +++ b/Sources/CertLogic/CertLogic.swift @@ -144,8 +144,7 @@ final public class CertLogicEngine { return rule.countryCode.lowercased() == issuerCountryCode.lowercased() && rule.ruleType == .invalidation && rule.certificateFullType == .general && filter.validationClock >= rule.validFromDate && filter.validationClock <= rule.validToDate } - //deactivated for Invalidation Rules, because Regions are not in the QR Code. Verifier is not able to to find out which region issues the code (mostly centrally issued). Verifier can just quess. - /* if let region = external.region { + if let region = filter.region { generalRulesWithInvalidation = generalRulesWithInvalidation.filter { rule in rule.region?.lowercased() == region.lowercased() } @@ -153,7 +152,7 @@ final public class CertLogicEngine { generalRulesWithInvalidation = generalRulesWithInvalidation.filter { rule in rule.region == nil } - }*/ + } let groupedGeneralRulesWithInvalidation = generalRulesWithInvalidation.group(by: \.identifier) let groupedGeneralRulesWithAcceptence = generalRulesWithAcceptence.group(by: \.identifier) diff --git a/Sources/CertLogic/Rule.swift b/Sources/CertLogic/Rule.swift index 63c5fca..9518929 100644 --- a/Sources/CertLogic/Rule.swift +++ b/Sources/CertLogic/Rule.swift @@ -57,24 +57,24 @@ public class Rule: Codable { public var validFromDate: Date { get { + if let date = Date.iso8601Formatter.date(from: validFrom) { return date } if let date = Date.backendFormatter.date(from: validFrom) { return date } if let date = Date.isoFormatter.date(from: validFrom) { return date } if let date = Date.iso8601Full.date(from: validFrom) { return date } if let date = Date.isoFormatterNotFull.date(from: validFrom) { return date } if let date = Date.formatterWithPlus.date(from: validFrom) { return date } - if let date = Date.iso8601Formatter.date(from: validFrom) { return date } return Date() } } public var validToDate: Date { get { + if let date = Date.iso8601Formatter.date(from: validTo) { return date } if let date = Date.backendFormatter.date(from: validTo) { return date } if let date = Date.isoFormatter.date(from: validTo) { return date } if let date = Date.iso8601Full.date(from: validTo) { return date } if let date = Date.isoFormatterNotFull.date(from: validTo) { return date } if let date = Date.formatterWithPlus.date(from: validTo) { return date } - if let date = Date.iso8601Formatter.date(from: validTo) { return date } return Date() } }