From 30877d1a894aba6876153c4055bad7c9d02c9c5e Mon Sep 17 00:00:00 2001 From: Ryan Slobojan Date: Mon, 25 Oct 2021 17:40:31 -0400 Subject: [PATCH 1/3] Trim the decoded QR code contents before we try to parse them as JSON * Nunavut QR code has a zero-width space in front of the JSON which was blowing up parsing - this fixes it --- src/shc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shc.js b/src/shc.js index b87c0e8..f183024 100644 --- a/src/shc.js +++ b/src/shc.js @@ -60,7 +60,7 @@ function decodeJWSPayload(decodedPayload) { try { //console.log(decompressedResult); scannedResult = decompressedResult.toString("utf8"); - resolve(JSON.parse(scannedResult)); + resolve(JSON.parse(scannedResult.trim())); } catch (e) { reject(e); } From a1df511754b9bbba94f9072b8592377685288807 Mon Sep 17 00:00:00 2001 From: Ryan Slobojan Date: Mon, 25 Oct 2021 17:41:29 -0400 Subject: [PATCH 2/3] Bump rev to 2.2.5 --- components/Page.tsx | 2 +- package.json | 2 +- src/sentry.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/Page.tsx b/components/Page.tsx index 84ea805..38d783b 100644 --- a/components/Page.tsx +++ b/components/Page.tsx @@ -32,7 +32,7 @@ function Page(props: PageProps): JSX.Element { {t('common:gitHub')} {t('common:returnToMainSite')} -
Last updated: 2021-10-25 (v2.2.4)
+
Last updated: 2021-10-25 (v2.2.5)
diff --git a/package.json b/package.json index 8c98982..179a958 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "grassroots_covidpass", - "version": "2.2.4", + "version": "2.2.5", "author": "Billy Lo ", "license": "MIT", "private": false, diff --git a/src/sentry.ts b/src/sentry.ts index 9d0c0fa..8097d85 100644 --- a/src/sentry.ts +++ b/src/sentry.ts @@ -3,7 +3,7 @@ import { Integrations } from '@sentry/tracing'; export const initSentry = () => { SentryModule.init({ - release: 'grassroots_covidpass@2.2.4', // App version. Needs to be manually updated as we go unless we make the build smarter + release: 'grassroots_covidpass@2.2.5', // App version. Needs to be manually updated as we go unless we make the build smarter dsn: 'https://7120dcf8548c4c5cb148cdde2ed6a778@o1015766.ingest.sentry.io/5981424', integrations: [ new Integrations.BrowserTracing(), From 20fc47a6348c0fee84335fe502c0d4eb01eb4345 Mon Sep 17 00:00:00 2001 From: Ryan Slobojan Date: Mon, 25 Oct 2021 18:13:27 -0400 Subject: [PATCH 3/3] Added Nunavut example payload, including control character as first character * The production-pushed Nunavut QR codes appear to have a zero-width space as the first character before the { - this was blowing up JSON.parse in our SHC decoder until we trim()med the decoded payload, be sure to account for this case when handling these codes! --- examples/shc-ca-nu.decoded.json | 158 ++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 examples/shc-ca-nu.decoded.json diff --git a/examples/shc-ca-nu.decoded.json b/examples/shc-ca-nu.decoded.json new file mode 100644 index 0000000..6d3cbef --- /dev/null +++ b/examples/shc-ca-nu.decoded.json @@ -0,0 +1,158 @@ +{ + "iss": "https://pvc.gov.nu.ca/pvc", + "vc": { + "credentialSubject": { + "fhirBundle": { + "resourceType": "Bundle", + "entry": [ + { + "resource": { + "resourceType": "Patient", + "name": [ + { + "given": [ + "FIRSTNAME" + ], + "family": "LASTNAME" + } + ], + "birthDate": "YYYY-MM-DD" + }, + "fullUrl": "resource:0" + }, + { + "resource": { + "status": "completed", + "performer": [ + { + "actor": { + "display": "NU, Canada" + } + } + ], + "patient": { + "reference": "resource:0" + }, + "resourceType": "Immunization", + "lotNumber": "SOME_STRING", + "vaccineCode": { + "coding": [ + { + "code": "207", + "system": "http://hl7.org/fhir/sid/cvx" + } + ] + }, + "meta": { + "security": [ + { + "code": "IAL1.4", + "system": "https://smarthealth.cards/ial" + } + ] + }, + "occurrenceDateTime": "YYYY-MM-DD", + "manufacturer": { + "identifier": { + "system": "http://hl7.org/fhir/sid/mvx", + "value": "MOD" + } + } + }, + "fullUrl": "resource:1" + }, + { + "resource": { + "status": "completed", + "performer": [ + { + "actor": { + "display": "NU, Canada" + } + } + ], + "patient": { + "reference": "resource:0" + }, + "resourceType": "Immunization", + "lotNumber": "SOME_STRING", + "vaccineCode": { + "coding": [ + { + "code": "207", + "system": "http://hl7.org/fhir/sid/cvx" + } + ] + }, + "meta": { + "security": [ + { + "code": "IAL1.4", + "system": "https://smarthealth.cards/ial" + } + ] + }, + "occurrenceDateTime": "YYYY-MM-DD", + "manufacturer": { + "identifier": { + "system": "http://hl7.org/fhir/sid/mvx", + "value": "MOD" + } + } + }, + "fullUrl": "resource:2" + }, + { + "resource": { + "status": "completed", + "performer": [ + { + "actor": { + "display": "NU, Canada" + } + } + ], + "patient": { + "reference": "resource:0" + }, + "resourceType": "Immunization", + "lotNumber": "SOME_STRING", + "vaccineCode": { + "coding": [ + { + "code": "208", + "system": "http://hl7.org/fhir/sid/cvx" + } + ] + }, + "meta": { + "security": [ + { + "code": "IAL1.4", + "system": "https://smarthealth.cards/ial" + } + ] + }, + "occurrenceDateTime": "YYYY-MM-DD", + "manufacturer": { + "identifier": { + "system": "http://hl7.org/fhir/sid/mvx", + "value": "PFR" + } + } + }, + "fullUrl": "resource:3" + } + ], + "type": "collection" + }, + "fhirVersion": "4.0.1" + }, + "type": [ + "https://smarthealth.cards#health-card", + "https://smarthealth.cards#covid19", + "https://smarthealth.cards#immunization" + ] + }, + "nbf": 1635194428.0 +} \ No newline at end of file