grambas/dcc-verifier

There is no license information available for the latest version (dev-main) of this package.

Decode and verify digital COVID-19 certificate against germany signer trust list public key

dev-main 2021-12-18 20:53 UTC

This package is auto-updated.

Last update: 2022-11-18 22:51:39 UTC


README

Latest Version on Packagist Software License coverage Total Downloads

Alpha version of digital COVID-19 verification implementation with php.

Install

Via Composer

$ composer require grambas/dcc-verifier

Demo

This SDK is used in Demo API Project- dcc-verifier.de which is also open sourced at grambas/dcc-verifier-api

Info

This package implements Germany public trust list api repository. More about api - Open API specification

Features

  • Decode and read EU Digital COVID-19 Certificate data (DCC) of vaccination, recovery or test (PCR, Rapid) subject
  • Validate DCC date of expiry
  • Validate DCC against authoritative signer signature
  • Use Germany trust list
  • Ability to use own trust list repository

Usage

    $trustListDir = '/tmp/de-trust-list'; // local dir for saving trust list json file

    // 1. Download / Update Germany signer trust list
    $client = new GermanyTrustListClient($trustListDir);
    $client->update();
    
    // 2. Init existing trust list repository.
    $trustListRepository = new GermanyTrustListRepository($trustListDir);

    // 3. Init verfier with qr code content
    $qrCodeContent = 'HC1:...'
    $verifier = new DccVerifier($qrCodeContent, $trustListRepository);
    
    // 4. Decode & verify
    $dcc = $verifier->decode(); // get certificate info
    $verifier->verify(); // validate against signer signature
    
    // 5. Validate if Certificate (Vaccination, Recovery or Test) conforms  specific business rules for example if
    // fully vaccinated or test is negetive
    $isValid = $dcc->isValid()
    
    // 6. Check certificate validation date
    $validator = new DateValidator($dcc);
    $isValidForDate = $validator->isValidForDate(new \DateTime());

Of course validation steps 4. 5. and 6 can be checked independently and in your preferred order

Change log

Please see CHANGELOG for more information on what has changed recently.

Testing

$ make test
$ make coverage

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email milius@mindau.de instead of using the issue tracker.

Credits

License

The MIT License (MIT), see License File and NOTICE for more information.