CovidCertificate SDK for iOS

Overview

CovidCertificateSDK for iOS

Swift Package Manager compatible License: MPL 2.0

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

  1. 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:

  1. Decode the base45 and prefixed string to retrieve a Digital Covid Certificate

  2. Verify the signature of the Certificate

  3. Check the revocation list. Currently always returns a valid ValidationResult

  4. 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

Comments
  • Problem with expired certificates

    Problem with expired certificates

    We have successfully implemented the SDK in our app, and checking certificates works, but not in the case of expired certificates. They always show valid. This problem is only in iOS. We don't have a problem with the Android SDK.

    Here is how we test:`

    let result: Result<VerifierCertificateHolder, CovidCertError> = CovidCertificateSDK.Verifier.decode(encodedData: data);
    
    switch result {
    case .success(let certHolder):
            CovidCertificateSDK.Verifier.check(holder: certHolder, forceUpdate: false) {result in
    
            ... here, we check nationalRules, signature and revocationStatus and they are all valid
    

    image

    The "Covid check" app shows following: image

    How do we check if the certificate is expired?

    opened by pmauchle 13
  • update json logic

    update json logic

    which includes https://github.com/eu-digital-green-certificates/json-logic-swift/pull/25 This fixes a potential crash if a invalid date is in the certificate

    opened by stmitt 2
  • Only use last 32 bytes for EC key

    Only use last 32 bytes for EC key

    We use P256 Uncompressed Point Format as described in 2.3.3 Elliptic-Curve-Point-to-Octet-String Conversion which uses exactly 32 bytes per coordinate.

    Since the BigInteger should be interpreted as an unsigned BigInteger, the leading 0 byte, needed if the most significant bit of the corresponding signed BigInteger would be set, can be left out, and only the last 32 bytes are needed.

    opened by stmitt 2
  • Refactor public key (DSC) matching to avoid parsing public keys repeatedly

    Refactor public key (DSC) matching to avoid parsing public keys repeatedly

    Before, all stored public keys were parsed (SecKeyCreateWithData) repeatedly into a list before searching a matching key id. Instead, searching a matching key is now done on the list of TrustCertificates and only when finding a matching public key, this key is then lazily parsed into a SecKey.

    opened by UBaggeler 2
  • Pre-packaged revocation list

    Pre-packaged revocation list

    • store next since along with revocation list (this fixes a potential deviation between next since and the actual revocation list)
    • pre-package the current revocation list
    • adds unit tests for the revocation list update logic
    opened by stmitt 2
  • Bugfix: improves offline mode for verification app

    Bugfix: improves offline mode for verification app

    related to: https://github.com/admin-ch/CovidCertificate-SDK-iOS/pull/116 This PR changes the check behavior to use cached data if there is no internet connection and timeshift detection is disabled.

    opened by stmitt 2
  • 2G+

    2G+

    I have two questions/inputs regarding 2G+ from an integrator's point of view:

    • Currently, no 2G+ test mode is provided by the backend api. Will this change in the future?

    • If 2G+ certificate checks have to be implemented as they are currently presented in the official app (check of 1 or 2 certificates, with specific rules within the app), it will become much more complicated for existing integrations. Is this the final state of how it is going to work or will a simpler solution follow? I was hoping that vaccinated/recovered people who get tested would receive a specific 2G+ certficate so there will always be just one certificate to check.

    opened by sprain 2
  • Network Error

    Network Error

    Hello , Can i know how to produce "No internet connection error" ? as , when i scanned every-time without internet. it verifies the certificate Valid or not. So, may i know when we get No internet connection error ?

    opened by badalpub1991 0
  • Network parse error if fail to initialize SDK on launch

    Network parse error if fail to initialize SDK on launch

    If on first app launch the SDK fails to initialize due to either no network or bad network the checking process then also fails even if the network is back. (Network parse error code 8) Relaunching the app with correct network conditions works most of the time. However under some cricumstances, even when relaunching the app the check doesn't work and fails with a network parse error.

    Steps to reproduce (sadly I couldn't reproduce the issue every time):

    • turn on airplane mode
    • didFinishLaunchingWithOptions -> init SDK
    • try checking qr -> network error (as expected)
    • force quit app
    • turn off airplane mode
    • didFinishLaunchingWithOptions -> init SDK
    • try checking qr -> network error (not expected)

    Maybe there is something that can be improved regarding the init of the SDK with bad / no network.

    opened by PhilippeWeidmann 1
  • Cocopod support or framework file

    Cocopod support or framework file

    Hi, We just need to write some plugin in react native and cordova but use swift package manager is very hard to us. Can you support Framework file to import? Very thank if you can support it soon

    enhancement 
    opened by pxanzer3553 11
Releases(v3.6.0)
  • v3.6.0(Jul 21, 2022)

    What's Changed

    • makes standardizedFamilyName optional by @stmitt in https://github.com/admin-ch/CovidCertificate-SDK-iOS/pull/145

    Full Changelog: https://github.com/admin-ch/CovidCertificate-SDK-iOS/compare/v3.5.0...v3.6.0

    Source code(tar.gz)
    Source code(zip)
  • v3.5.0(Jun 28, 2022)

    What's Changed

    • Use Xcode 13.3.1 by @UBaggeler in https://github.com/admin-ch/CovidCertificate-SDK-iOS/pull/140
    • Add certificate issuer and kid to certlogic payload header by @stmitt in https://github.com/admin-ch/CovidCertificate-SDK-iOS/pull/141
    • Only use last 32 bytes for EC key by @stmitt in https://github.com/admin-ch/CovidCertificate-SDK-iOS/pull/142
    • Feature: renew banner by @stmitt in https://github.com/admin-ch/CovidCertificate-SDK-iOS/pull/143
    • update json logic by @stmitt in https://github.com/admin-ch/CovidCertificate-SDK-iOS/pull/144

    Full Changelog: https://github.com/admin-ch/CovidCertificate-SDK-iOS/compare/v3.4.0...v3.5.0

    Source code(tar.gz)
    Source code(zip)
  • v3.4.0(Apr 13, 2022)

    What's Changed

    • Add possibility to check validity of certificates against rules of other countries (as long as they publish their business rules on the EU gateway)

    Full Changelog: https://github.com/admin-ch/CovidCertificate-SDK-iOS/compare/v3.3.0...v3.4.0

    Source code(tar.gz)
    Source code(zip)
  • v3.3.0(Jan 21, 2022)

    What's Changed

    • Adds new rules to handle positive antigen test
    • Adds banner identifier to display rules by @stmitt in https://github.com/admin-ch/CovidCertificate-SDK-iOS/pull/132

    Full Changelog: https://github.com/admin-ch/CovidCertificate-SDK-iOS/compare/v3.2.0...v3.3.0

    Source code(tar.gz)
    Source code(zip)
  • v3.2.0(Jan 7, 2022)

    This release of the SDK includes the following changes:

    • Adds check functions for Swiss medical exemption certificates by @zimmermannubique in https://github.com/admin-ch/CovidCertificate-SDK-iOS/pull/127
    • Adds walletActiveModes by @zimmermannubique in https://github.com/admin-ch/CovidCertificate-SDK-iOS/pull/128
    • Pre-packaged revocation list by @stmitt in https://github.com/admin-ch/CovidCertificate-SDK-iOS/pull/129
    • Adds handling for TR-CH-0010 by @stmitt in https://github.com/admin-ch/CovidCertificate-SDK-iOS/pull/130
    • update xcode to 13.2.1 by @stmitt in https://github.com/admin-ch/CovidCertificate-SDK-iOS/pull/131

    Full Changelog: https://github.com/admin-ch/CovidCertificate-SDK-iOS/compare/v3.1.0...v3.2.0

    Source code(tar.gz)
    Source code(zip)
  • v3.1.0(Dec 17, 2021)

    This release of the SDK includes the following changes:

    • 2G+ and «Test certificate» have been added as new verification modes. See the README for how to use it.

    Full Changelog: https://github.com/admin-ch/CovidCertificate-SDK-iOS/compare/v3.0.0...v3.1.0

    Source code(tar.gz)
    Source code(zip)
  • v3.0.0(Dec 13, 2021)

  • v2.0.0(Nov 26, 2021)

    This release of the SDK includes the following changes:

    • The isSwitzerlandOnly flag that states whether a certain type of certificate is only valid in Switzerland is now computed in the display rules. In the previous version, this flag was hardcoded for certain certificate types (e.g., light certificates). The flag is now returned in the VerificationResult.
    • The SDK has been updated to correctly handle the new certificates for tourists. To process the display rules for this type of certificate, the iat and exp flags from the CWT are now passed to the CertLogic as well.
    • The NationalRulesError enum case UNKNOWN_TEST_FAILURE has been renamed to the more descriptive name UNKNOWN_CERTLOGIC_FAILURE, because the word "TEST" was rather confusing, given the context.
    • DateFormatter uses have been refactored to be more efficient (i.e., less DateFormatter instances are created at runtime).

    What's Changed

    • Remove unused variable by @ubfelix in https://github.com/admin-ch/CovidCertificate-SDK-iOS/pull/111
    • Update workflows to use Xcode 13.1 by @ubfelix in https://github.com/admin-ch/CovidCertificate-SDK-iOS/pull/114
    • Get isSwitzerlandOnly from displayRules by @ubfelix in https://github.com/admin-ch/CovidCertificate-SDK-iOS/pull/113
    • Add logic and tests for tourist certificate by @ubfelix in https://github.com/admin-ch/CovidCertificate-SDK-iOS/pull/112
    • Update rulesets and config by @ubfelix in https://github.com/admin-ch/CovidCertificate-SDK-iOS/pull/115

    Full Changelog: https://github.com/admin-ch/CovidCertificate-SDK-iOS/compare/v1.2.0...v2.0.0

    Source code(tar.gz)
    Source code(zip)
  • v1.2.0(Nov 12, 2021)

    This release introduces the following changes:

    • The SDK returns an error if it detects a time difference between the server and device time. The allowed difference can be configured via SDKOptions.
    Source code(tar.gz)
    Source code(zip)
  • v1.1.0(Oct 4, 2021)

  • v1.0.1(Aug 6, 2021)

  • v1.0.0(Jul 14, 2021)

Owner
Swiss Admin
Federal Office of Information Technology, Systems and Telecommunication FOITT
Swiss Admin
Desk360 Mobile Chat SDK for iOS

Desk360 Chat iOS SDK Desk360 Chat SDK provides simplicity and usability in one place. With this feature, you can provide live support to your customer

null 5 Sep 21, 2022
WANNA SDK enhances your iOS app with virtual try-on capabilities for shoes and watches

WANNA SDK enhances your iOS app with virtual try-on capabilities for shoes and watches. With this feature, your users will be able to see in real time how the selected product looks on them, just by pointing their smartphone camera at their feet or wrist.

Wannaby Inc. 18 Dec 2, 2022
👤 Framework to Generate Random Users - An Unofficial Swift SDK for randomuser.me

RandomUserSwift is an easy to use Swift framework that provides the ability to generate random users and their accompanying data for your Swift applic

Wilson Ding 95 Sep 9, 2022
SDK for creating Telegram Bots in Swift.

Chat • Changelog • Prerequisites • Getting started • Creating a new bot • Generating Xcode project • API overview • Debugging notes • Examples • Docum

Rapier 349 Dec 20, 2022
Google Directions API helper for iOS, written in Swift

PXGoogleDirections Google Directions API SDK for iOS, entirely written in Swift. ?? Features Supports all features from the Google Directions API as o

Romain L 268 Aug 18, 2022
Swifter - A Twitter framework for iOS & OS X written in Swift

Getting Started Installation If you're using Xcode 6 and above, Swifter can be installed by simply dragging the Swifter Xcode project into your own pr

Matt Donnelly 2.4k Dec 26, 2022
The swiftest way to build iOS apps that connect to Salesforce

Build iOS apps fast on the Salesforce Platform with Swiftly Salesforce: Written entirely in Swift. Uses Swift's Combine framework to simplify complex,

Michael Epstein 131 Nov 23, 2022
Backport of iOS 15 formatting api

This is a back-port of the .formatted API in Foundation that was introduced at WWDC '21 for iOS 15, macOS 12.0, tvOS 15.0, and watchOS 8.0.

Simon Salomons 9 Jul 22, 2022
App iOS correspondiente al proyecto twitimer.com de la comunidad MoureDev

⏳ Twitimer iOS Twitimer es una App gratuita para iOS y Android que se ha desarrollado para ayudar a usuarios de Twitch, pero sobre todo pensando en ge

Brais Moure 220 Jan 1, 2023
CovidCertificate Apps for iOS

COVID Certificate Apps - iOS This project is released by the the Federal Office of Information Technology, Systems and Telecommunication FOITT on beha

Swiss Admin 111 Dec 19, 2022
Px-mobile-sdk-demo-app - PerimeterX Mobile SDK - Demo App

About PerimeterX PerimeterX is the leading provider of application security solu

PerimeterX 1 Nov 20, 2022
Alter SDK is a cross-platform SDK consisting of a real-time 3D avatar system, facial motion capture, and an Avatar Designer component built from scratch for web3 interoperability and the open metaverse.

Alter SDK is a cross-platform SDK consisting of a real-time 3D avatar system, facial motion capture, and an Avatar Designer component built from scratch for web3 interoperability and the open metaverse.

Alter 45 Nov 29, 2022
Proxitee iOS SDK to enable iOS apps to use the Proxitee platform with iBeacon and GeoFencing

Proxitee iOS SDK Introduction The Proxitee iOS SDK allows you to enable your iOS devices to use the Proxitee platform with iBeacons and GeoFences, for

Proxitee 16 Jun 4, 2022
Native iOS implementation of RadarCOVID tracing client using DP3T iOS SDK

RadarCOVID iOS App Introduction Native iOS implementation of RadarCOVID tracing client using DP3T iOS SDK Prerequisites These are the tools used to bu

Radar COVID 146 Nov 24, 2022
Apphud SDK is a lightweight open-source Swift library to manage auto-renewable subscriptions and other in-app purchases in your iOS app.

Apphud SDK Apphud SDK is a lightweight open-source Swift library to manage auto-renewable subscriptions and other in-app purchases in your iOS app. No

Apphud 143 Dec 16, 2022
Crowdin iOS SDK delivers all new translations from Crowdin project to the application immediately

Crowdin iOS SDK Crowdin iOS SDK delivers all new translations from Crowdin project to the application immediately. So there is no need to update this

Crowdin 98 Dec 14, 2022
Bugfender SDK for iOS, a remote logger tailor-made for mobile

Bugfender SDK for iOS Bugfender is a cloud service to collect mobile application logs. Developers can control log sending programmatically and manuall

Bugfender 69 Dec 4, 2022
TelegramStickersImport — Telegram stickers importing SDK for iOS

TelegramStickersImport — Telegram stickers importing SDK for iOS TelegramStickersImport helps your users import third-party programaticaly created sti

null 35 Oct 26, 2022
Unofficial iOS/macOS SDK for the Notion API.

NotionClient: a Notion SDK for iOS & macOS Unofficial Notion API SDK for iOS & macOS. This is an alpha version and still work in progress. TODO Featur

David De Bels 15 Aug 4, 2022
SDK для интеграции плеера IVI в сторонние ios-приложения

IVIExternPlayerSDK SDK позволяет интегрировать плеер IVI в сторонние приложения. Требования iOS 12.0 и выше В Info.plist приложения должен быть выстав

ivi 6 Jun 9, 2022