-
Looking especially for information about implementing |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
Hi @axunonb , thank you for your contribution to the readme, I just have accepted your pull request. Looking at the implementation, I found 3 urls containing both the public certificates and the validation rules: The interesting thing is that the german endpoint contains validation rules for multiple countries, not only Germany, allowing the development of a rules validator provider that supports multiple countries. I can make a draft implementation of both the TrustList provider and the rules validator, and I think that I should also change a little bit the interface of the methods, allowing to specify the desired country code for rules validation in order to better support these scenarios. I will also support the injection of N rule validators to the I can not guarantee about implementation timings, maybe you could take a look at my draft and contribute to its completion, I would appreciate it very much |
Beta Was this translation helpful? Give feedback.
-
Hi @axunonb , as you may have noticed, now the library supports multiple acceptance countries, starting from version 2.0.0. I have also implemented an unofficial rule validator using German endpoint rules and valuesets. |
Beta Was this translation helpful? Give feedback.
-
Ciao @DevTrevi , yes, I was already starting to play around with the new version. It took a me a while to figure out how to make it work. May I ask you 2 questions:
Really excellent job, Davide. Thanks a lot! |
Beta Was this translation helpful? Give feedback.
-
Hi @axunonb , thank you :)
In order to add Italy to the supported countries, you can simply register both the rule validators. In this way, the DgcService will use the appropriate provider, based on the required acceptance country. // Register all the required services:
services.AddDgcReader() // Add the DgcReaderService as singleton
.AddItalianTrustListProvider() // Certificates downlaoded from Italian backend
.AddGermanTrustListProvider() // Certificates downlaoded from German backend (optional, one trustlist provider should be enough)
.AddItalianDrlBlacklistProvider() // The Drl blacklist provider (~200k entries)
.AddItalianRulesValidator() // Italian rules validator + blacklist (~2k entries)
.AddGermanRulesValidator(); // (UNOFFICIAL) German rules validator for Germany + other countries (19 at the moment)
//...
// Check countries:
var germanRulesValidator = ServiceProvider.GetService<DgcGermanRulesValidator>();
var germanSupportedCountries = await germanRulesValidator.GetSupportedCountries(); // Dynamically downloaded, should return 19 countries
var italianRulesValidator = ServiceProvider.GetService<DgcItalianRulesValidator>();
var italianSupportedCountries = await italianRulesValidator.GetSupportedCountries(); // Static, will return only "IT"
var dgcReaderService = ServiceProvider.GetRequiredService<DgcReaderService>();
var supportedCountries = dgcReaderService.GetSupportedCountries(); // Sum of all supported countries from registered rules validator (20 entries including IT)
// So you can do this:
var resultForItaly = await dgcReaderService.GetValidationResult(data, "IT");
var resultForGermany = await dgcReaderService.GetValidationResult(data, "DE");
var resultForAustria = await dgcReaderService.GetValidationResult(data, "AT");
//... |
Beta Was this translation helpful? Give feedback.
Hi @axunonb , thank you :)
DgcGermanRulesValidator
is downloaded from the German api, it is not a static list.Italy is not included in the list, because Italian rules are implemented in a different way compared to other countries, and there aren't CertLogic rules available from the German backend for Italy, so this is not my design decision.
DgcItalianRulesValidator
is primarily a rules validator, but it does implement also theIBlacklistProvider
interface, becau…