Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fixed rule filtering

Co-authored-by: Alexandr Chernyy <[email protected]>
  • Loading branch information
alexchornyi and pingus-nikalex authored Jul 23, 2021
1 parent 257fa20 commit 80c9ff3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions Sources/CertLogic/CertLogic.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,15 @@ 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()
}
} else {
generalRulesWithInvalidation = generalRulesWithInvalidation.filter { rule in
rule.region == nil
}
}*/
}

let groupedGeneralRulesWithInvalidation = generalRulesWithInvalidation.group(by: \.identifier)
let groupedGeneralRulesWithAcceptence = generalRulesWithAcceptence.group(by: \.identifier)
Expand Down
4 changes: 2 additions & 2 deletions Sources/CertLogic/Rule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
Expand Down

0 comments on commit 80c9ff3

Please sign in to comment.