DgcReader.RuleValidators.Germany 2.5.4

.NET 5.0 .NET Standard 2.0 .NET Framework 4.5.2
Install-Package DgcReader.RuleValidators.Germany -Version 2.5.4
dotnet add package DgcReader.RuleValidators.Germany --version 2.5.4
<PackageReference Include="DgcReader.RuleValidators.Germany" Version="2.5.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DgcReader.RuleValidators.Germany --version 2.5.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DgcReader.RuleValidators.Germany, 2.5.4"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install DgcReader.RuleValidators.Germany as a Cake Addin
#addin nuget:?package=DgcReader.RuleValidators.Germany&version=2.5.4

// Install DgcReader.RuleValidators.Germany as a Cake Tool
#tool nuget:?package=DgcReader.RuleValidators.Germany&version=2.5.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

German Rules Validator

DgcReader.RuleValidators.Germany

NuGet version (DgcReader.RuleValidators.Germany)

Implementation of IRulesValidator for validating Digital Green Certificates using rules provided by the German backend.

This is an unofficial porting of the covpass-sdk included in the Digitaler-Impfnachweis / covpass-android repository.

In addition to German rules, it supports validation for several other European Union countries. You can get a list of supported countries by calling the GetSupportedCountries method.

Usage

In order to use the validator, you can register it as a service or you can instantiate it directly, depending on how your application is designed:

a) Registering as a service:
public void ConfigureServices(IServiceCollection services)
{
   ...
   services.AddDgcReader()
       .AddGermanTrustListProvider()
       .AddGermanRulesValidator(o =>
               {
                   // Optionally, configure the validator with custom options
                   o.RefreshInterval = TimeSpan.FromSeconds(5);
                   o.MinRefreshInterval = TimeSpan.Zero;
                   ...
               });
}
b) Instantiate it directly
...
// You can use the constructor
var rulesValidator = new DgcItalianRulesValidator(httpClient);
...

// Or you can use the DgcItalianRulesValidator.Create facory method
// This will help you to unwrap the IOptions interface when you specify 
// custom options for the provider:
var rulesValidator = DgcGermanRulesValidator.Create(httpClient, 
   new DgcGermanRulesValidatorOptions {
       RefreshInterval = TimeSpan.FromHours(24),
       MinRefreshInterval = TimeSpan.FromHours(1),
   });


// Then you should pass it as a parameter to the DgcReaderService constructor:
var dgcReader = DgcReaderService.Create(
   trustListProvider, 
   null,
   rulesValidator      // <-- The rules validator service
);

Available options

  • RefreshInterval: interval for checking for rules updates from the server. Default value is 24 hours.
  • MinRefreshInterval: if specified, prevents that every validation request causes a refresh attempt when the current rules are expired.
    For example, if the parameter is set to 5 minutes and the remote server is unavailable when the RefreshInterval is expired, subsequent validation requests won't try to download the updated rules for 5 minutes before making a new attempt. Default value is 5 minutes.
  • UseAvailableValuesWhileRefreshing: if true, allows the validator to use the expired rules already loaded in memory, while downloading the updated rules on a background Task.
    This prevents the application to wait that the new rules are downloaded, extending by the time needed for the download the effective validitiy of the rules already loaded.
    As result, the response time of the application will be nearly instantanious, except for the first download or if the rules have reached the MaxFileAge value.
    Otherwise, if the rules are expired, every validation request will wait untill the refresh task completes.
  • TryReloadFromCacheWhenExpired: If true, try to reload values from cache before downloading from the remote server. This can be useful if values are refreshed by a separate process, i.e. when the same valueset cached file is shared by multiple instances for reading. Default value is false.
  • BasePath: base folder where the rules list will be saved. The default value is Directory.GetCurrentDirectory()
  • MaxFileAge: maximum duration of the configuration file before is discarded.
    If a refresh is not possible when the refresh interval expires, the current file can be used until it passes the specified period.
    This allows the application to continue to operate even if the backend is temporary unavailable for any reason. Default value is 15 days.

Forcing the update of the rules

If the application needs to update the rules at a specific time (i.e. by a scheduled task, or when a user press a "Refresh" button), you can simply call the RefreshRulesList function of the validator. This will casue the immediate refresh of the rules from the remote server, regardless of the options specified.

Disclaimer

This library is not an official implementation, therefore its use may be subject to restrictions by some countries regulations.
The author assumes no responsibility for any unauthorized use of the library and no warranties about the correctness of the implementation, as better stated in the License.


Copyright © 2021 Davide Trevisan
Licensed under the Apache License, Version 2.0

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net452 net46 net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.5.4 55 5/4/2022
2.5.4-rc2 41 5/4/2022
2.5.4-rc1 33 5/4/2022
2.5.3 108 3/5/2022
2.5.3-rc1 35 3/5/2022
2.5.1 56 2/16/2022
2.5.1-rc1 36 2/15/2022
2.5.0 53 2/14/2022
2.5.0-rc3 34 2/14/2022
2.5.0-rc2 37 2/11/2022
2.5.0-rc1 37 2/11/2022
2.4.0 59 2/6/2022
2.3.0 73 1/28/2022
2.2.1 67 1/21/2022
2.2.0 65 1/16/2022
2.1.0 82 1/6/2022
2.0.0 82 12/27/2021

Aligned rules from official SDK version 1.0.2, check for Sputnik vaccine not from San Marino and UVCI blacklist provider. Implemented standard interfaces IBlacklistProvider and IRulesValidator