Skip to content

Commit 809d9b3

Browse files
committed
Update Readme file and new Nuget packages release V1.0.0
1 parent 4cb682e commit 809d9b3

3 files changed

Lines changed: 61 additions & 30 deletions

File tree

README.md

Lines changed: 46 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222

2323
## Nuget Packages in this repository
2424

25-
## [SmartHealthCard.Token](https://www.nuget.org/packages/SmartHealthCard.Token/0.1.0-alpha.1): Encode, Decode & Verifiy SMART Health Card JWS tokens
25+
## [SmartHealthCard.Token](https://www.nuget.org/packages/SmartHealthCard.Token/0.1.0-alpha.4): Encode, Decode & Verifiy SMART Health Card JWS tokens
2626
```
27-
Install-Package SmartHealthCard.QRCode -Version 0.1.0-alpha.3
27+
Install-Package SmartHealthCard.QRCode -Version 0.1.0-alpha.4
2828
```
2929

3030

@@ -43,6 +43,7 @@ Install-Package SmartHealthCard.QRCode -Version 0.1.0-alpha.2
4343
using SmartHealthCard.QRCode;
4444
using SmartHealthCard.Token;
4545
using SmartHealthCard.Token.Certificates;
46+
using SmartHealthCard.Token.Exceptions;
4647
using SmartHealthCard.Token.Model.Shc;
4748
using System;
4849
using System.Collections.Generic;
@@ -84,13 +85,17 @@ namespace SHC.EncoderDemo
8485
string FhirBundleJson = "[A Smart Health Card FHIR Bundle in JSON format]";
8586

8687
//Set the base of the URL where any validator will retrieve the public keys from (e.g : [Issuer]/.well-known/jwks.json)
87-
Uri Issuer = new Uri("https://sonichealthcare.com/something");
88+
Uri Issuer = new Uri("https://acmecare.com/shc");
8889

8990
//Set when the Smart Health Card becomes valid, (e.g the from date).
9091
DateTimeOffset IssuanceDateTimeOffset = DateTimeOffset.Now.AddMinutes(-1);
9192

9293
//Set the appropriate VerifiableCredentialsType enum list, for more info see: see: https://smarthealth.cards/vocabulary/
93-
var VerifiableCredentialTypeList = new List<VerifiableCredentialType>() { VerifiableCredentialType.Covid19 };
94+
List<VerifiableCredentialType> VerifiableCredentialTypeList = new List<VerifiableCredentialType>()
95+
{
96+
VerifiableCredentialType.HealthCard,
97+
VerifiableCredentialType.Covid19
98+
};
9499

95100
//Instantiate and populate the Smart Health Card Model with the properties we just setup
96101
SmartHealthCardModel SmartHealthCard = new SmartHealthCardModel(Issuer, IssuanceDateTimeOffset,
@@ -100,8 +105,22 @@ namespace SHC.EncoderDemo
100105
//Instantiate the Smart Health Card Encoder
101106
SmartHealthCardEncoder SmartHealthCardEncoder = new SmartHealthCardEncoder();
102107

103-
//Get the Smart Health Card JWS Token
104-
string SmartHealthCardJwsToken = await SmartHealthCardEncoder.GetTokenAsync(Certificate, SmartHealthCard);
108+
string SmartHealthCardJwsToken = string.Empty;
109+
try
110+
{
111+
//Get the Smart Health Card JWS Token
112+
SmartHealthCardJwsToken = await SmartHealthCardEncoder.GetTokenAsync(Certificate, SmartHealthCard);
113+
}
114+
catch (SmartHealthCardEncoderException EncoderException)
115+
{
116+
Console.WriteLine("The SMART Health Card Encoder has found an error, please see message below:");
117+
Console.WriteLine(EncoderException.Message);
118+
}
119+
catch (Exception Exception)
120+
{
121+
Console.WriteLine("Oops, there is an unexpected development exception");
122+
Console.WriteLine(Exception.Message);
123+
}
105124

106125
//Instantiate the Smart Health Card QR Code Factory
107126
SmartHealthCardQRCodeEncoder SmartHealthCardQRCodeEncoder = new SmartHealthCardQRCodeEncoder();
@@ -158,24 +177,6 @@ namespace SHC.DecoderDemo
158177
//Instantiate the SmartHealthCard Decoder
159178
SmartHealthCardDecoder Decoder = new SmartHealthCardDecoder();
160179

161-
//Useful while in development!!
162-
//Optionally for development, you can provide an implementation of the IJwksProvider interface
163-
//which allows you to pass a JSON Web Key Set (JKWS) that contain the public key used to verify you
164-
//token's signatures.
165-
166-
//If you don't do this the default implementation will use the Issuer (iss) value from Smart Health Card
167-
//token payload to make a HTTP call to obtain the JWKS file, which in a production system it the behavior you want.
168-
169-
//Yet in development this means you must have a public endpoint to provide the JWKS.
170-
171-
//By providing this simple interface implementation (see MyJwksProvider class below) you can successfully
172-
//validate signatures in development with out the need for a public endpoint.
173-
//Of course you would not do this is production.
174-
175-
//Here is how you pass that interface implementation to the SmartHealthCardDecoder constructor.
176-
//SmartHealthCard.Token.Providers.IJwksProvider MyJwksProvider = new MyJwksProvider(Certificate);
177-
//SmartHealthCardDecoder Decoder = new SmartHealthCardDecoder(MyJwksProvider);
178-
179180
try
180181
{
181182
//Decode and verify, returning an object model of the Smart Health Card, throws exceptions if not valid
@@ -195,7 +196,27 @@ namespace SHC.DecoderDemo
195196
}
196197
}
197198

198-
//Example implementation of the IJwksProvider interface
199+
200+
//When in development!
201+
//For development, you can provide an implementation of the IJwksProvider interface
202+
//which will allow you to pass to the decoder a JSON Web Key Set (JKWS) that contain the public key
203+
//used to verify the token's signatures.
204+
205+
//If you don't do this the default implementation will use the Issuer (iss) value from Smart Health Card
206+
//token payload to make a HTTP call to obtain the JWKS file, which in a production system it the behavior
207+
//you want.
208+
209+
//For development this would means you must have a public endpoint to provide the JWKS.
210+
211+
//By providing this simple interface implementation (see MyJwksProvider class below) you can successfully
212+
//validate signatures in development with out the need for a public endpoint. Of course you would not do
213+
//this is production.
214+
215+
//Here is how you pass that interface implementation to the SmartHealthCardDecoder constructor.
216+
//SmartHealthCard.Token.Providers.IJwksProvider MyJwksProvider = new MyJwksProvider(Certificate);
217+
//SmartHealthCardDecoder Decoder = new SmartHealthCardDecoder(MyJwksProvider);
218+
219+
//Here is an xxample implementation of the IJwksProvider interface
199220
public class MyJwksProvider : SmartHealthCard.Token.Providers.IJwksProvider
200221
{
201222
private readonly X509Certificate2 Certificate;

SmartHealthCard.QRCode/SmartHealthCard.QRCode.csproj

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<TargetFramework>net5.0</TargetFramework>
55
<Nullable>enable</Nullable>
6-
<Version>0.1.0-alpha.2</Version>
6+
<Version>1.0.0</Version>
77
<Authors>Angus Millar</Authors>
88
<Description>FHIR SMART Health Card JWS token QR Code encoder libaray</Description>
99
<Company>PyroHealth</Company>
@@ -12,8 +12,9 @@
1212
<RepositoryUrl>https://github.com/angusmillar/SmartHealthCard</RepositoryUrl>
1313
<RepositoryType>git</RepositoryType>
1414
<PackageTags>SmartHealthCard JWS JWT FHIR covid19 immunization laboratory VerifiableCredential</PackageTags>
15-
<PackageReleaseNotes>Added support to decode the raw QR Code data to a SMART Health Card JWS token</PackageReleaseNotes>
15+
<PackageReleaseNotes>Create release V1.0.0</PackageReleaseNotes>
1616
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
17+
<PackageIcon>128-x-128-Pyro-Icon.jpg</PackageIcon>
1718
</PropertyGroup>
1819

1920
<ItemGroup>
@@ -26,6 +27,10 @@
2627
<Pack>True</Pack>
2728
<PackagePath></PackagePath>
2829
</None>
30+
<None Include="H:\My Drive\PyroHealth\Pyro FHIR Server\Images\Pyro Icon\NewPyroIcon\128-x-128-Pyro-Icon.jpg">
31+
<Pack>True</Pack>
32+
<PackagePath></PackagePath>
33+
</None>
2934
</ItemGroup>
3035

3136
</Project>

SmartHealthCard.Token/SmartHealthCard.Token.csproj

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@
1313
<PackageProjectUrl>https://github.com/angusmillar/SmartHealthCard</PackageProjectUrl>
1414
<RepositoryUrl>https://github.com/angusmillar/SmartHealthCard</RepositoryUrl>
1515
<RepositoryType>git</RepositoryType>
16-
<PackageTags>SmartHealthCard JWS JWT FHIR covid19 immunization laboratory VerifiableCredential</PackageTags>
17-
<PackageReleaseNotes>Improved repoting and handling and reporting</PackageReleaseNotes>
16+
<PackageTags>SmartHealthCard Smart Health Card JWS JWT FHIR covid19 immunization laboratory VerifiableCredential Verifiable Credential</PackageTags>
17+
<PackageReleaseNotes>Fixed issuerDate (nbf) was output as a string in the JWT JSON when it should have been a number.</PackageReleaseNotes>
1818
<NeutralLanguage>en</NeutralLanguage>
1919
<AssemblyVersion>1.0.0.0</AssemblyVersion>
2020
<FileVersion>1.0.0.0</FileVersion>
21-
<Version>0.1.0-alpha.3</Version>
21+
<Version>1.0.0</Version>
22+
<PackageIcon>128-x-128-Pyro-Icon.jpg</PackageIcon>
2223
</PropertyGroup>
2324

2425
<ItemGroup>
@@ -30,6 +31,10 @@
3031
<Pack>True</Pack>
3132
<PackagePath></PackagePath>
3233
</None>
34+
<None Include="H:\My Drive\PyroHealth\Pyro FHIR Server\Images\Pyro Icon\NewPyroIcon\128-x-128-Pyro-Icon.jpg">
35+
<Pack>True</Pack>
36+
<PackagePath></PackagePath>
37+
</None>
3338
</ItemGroup>
3439

3540
</Project>

0 commit comments

Comments
 (0)