CovidCertificateSDK for iOS
Introduction
This is the Swiss implementation of the Electronic Health Certificates (EHN) Specification [1] used to verify the validity of Digital Covid Certificates. It is partly based on the reference implementation of EHN's ValidationCore
[2].
Work in Progress
The CovidCertificateSDK for iOS is work in progress and is not yet complete. We are continuing the development of this library, and the API is likely to change. Please contact the BIT before using / integrating this SDK in your app.
Installation
Swift Package Manager
CrowdNotifierSDK is available through Swift Package Manager
- Add the following to your
Package.swift
file:
dependencies: [
.package(url: "https://github.com/admin-ch/CovidCertificate-SDK-iOS.git", .branch("main"))
]
This version points to the HEAD of the main
branch and will always fetch the latest development status. Future releases will be made available using semantic versioning to ensure stability for depending projects.
Architecture
The SDK needs to be initialized with an environment. This allows for different verification rules per environment or other environment specific settings.
After initialization the following pipeline should be used:
-
Decode the base45 and prefixed string to retrieve a Digital Covid Certificate
-
Verify the signature of the Certificate
-
Check the revocation list. Currently always returns a valid
ValidationResult
-
Check for rules specific to countries such as validity of vaccines or tests
All these checks check against verification properties that are loaded from a server. These returned properties use a property to specify how long they are valid (like max-age
in general networking). With the parameter forceUpdate
, these properties can be forced to update.
Decoding
public func decode(encodedData: String) -> Result
Verify Signature
public static func checkSignature(cose: DGCHolder, forceUpdate: Bool, _ completionHandler: @escaping (Result) -> Void)
Check Revocation List
Currently only stubs
public static func checkRevocationStatus(dgc: EuHealthCert, forceUpdate: Bool, _ completionHandler: @escaping (Result) -> Void)
Check National Specific Rules
public static func checkNationalRules(dgc: EuHealthCert, forceUpdate: Bool, _ completionHandler: @escaping (Result) -> Void)
References
[1] Health Certificate Specification
[2] Validation Core