This repository has been archived by the owner on May 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
11,242 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module.exports = { | ||
env: { | ||
browser: true, | ||
es2021: true, | ||
node: true, | ||
}, | ||
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"], | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { | ||
ecmaVersion: 12, | ||
sourceType: "module", | ||
}, | ||
plugins: ["@typescript-eslint"], | ||
rules: { "@typescript-eslint/explicit-module-boundary-types": "off" }, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "npm" # See documentation for possible values | ||
directory: "/" # Location of package manifests | ||
schedule: | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: CI - Master | ||
|
||
# Controls when the action will run. Triggers the workflow on push or pull request | ||
# events but only for the master branch | ||
on: | ||
push: | ||
branches: [master] | ||
|
||
jobs: | ||
test: | ||
name: Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: "14.17" | ||
- run: npm ci | ||
- run: npm run lint | ||
- run: npm run type-check | ||
- run: npm run test | ||
release: | ||
name: Build and Release | ||
needs: test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: "14.17" | ||
- run: npm ci | ||
- run: npm run build | ||
- run: npx semantic-release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: CI - Pull Request Open | ||
|
||
# Controls when the action will run. Triggers the workflow on push or pull request | ||
# events but only for the master branch | ||
on: | ||
push: | ||
branches: ["!master"] | ||
pull_request: | ||
branches: [master] | ||
types: | ||
- labeled | ||
- unlabeled | ||
- synchronize | ||
- opened | ||
- edited | ||
- ready_for_review | ||
- reopened | ||
- unlocked | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
name: Tests | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: "14.17" | ||
- run: npm install | ||
- run: npm run lint | ||
- run: npm run type-check | ||
- run: npm run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.DS_Store | ||
dist | ||
secrets | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
14.17 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ "printWidth": 120 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,78 @@ | ||
# Google Pay COVID Cards | ||
|
||
A helper library for Google Pay COVID Cards. | ||
|
||
## Getting Started | ||
|
||
```bash | ||
npm i @notarise-gov-sg/gpay-covid-cards | ||
``` | ||
|
||
### 1. Import | ||
|
||
```javascript | ||
import GPay from "@notarise-gov-sg/gpay-covid-cards"; | ||
const gpay = GPay(private_key); | ||
``` | ||
|
||
### 2. Prepare records | ||
|
||
```javascript | ||
// Patient Details | ||
const patientDetails: PatientDetails = { | ||
dateOfBirth: "1990-01-15", | ||
identityAssuranceLevel: "IAL1.4", | ||
patientId: "E7831177G", | ||
patientIdLabel: "Passport Number", | ||
patientName: "Tan Chen Chen", | ||
}; | ||
|
||
// Basic Details | ||
const basicDetails: BasicDetails = { | ||
iss: "[email protected]", | ||
uuid: "some_uuid", | ||
issuerId: "issuer_id", | ||
title: "COVID-19 Test Result Card", | ||
qr: "https://www.verify.gov.sg/", | ||
expiration: "2021-10-01", | ||
patientDetails: gpay.genPatientDetails(patientDetails), | ||
}; | ||
|
||
// Notarise PDT (Testing Record) | ||
const testingRecord = gpay.genTestingRecord({ | ||
administrationDateTime: "27 September 2020, 2:15 pm SGT", | ||
contactInfo: "MacRitchie Hospital, Thomson Road, Singapore 123000", | ||
provider: "MacRitchie Medical Clinic", | ||
reportDateTime: "28 September 2020, 2:15 pm SGT", | ||
testCode: "94531-1", | ||
testDescription: "SARS-CoV-2 (COVID-19) RNA panel - Respiratory specimen by NAA with probe detection", | ||
testResultCode: "260385009", | ||
testResultDescription: "Negative", | ||
specimen: "Nasopharyngeal swab", | ||
}); | ||
|
||
// Notarise Vaccination (Vaccination Record) | ||
const vaccinationRecord = gpay.genVaccinationRecord({ | ||
code: "1234", | ||
contactInfo: "123 Forever Rd. 12345 Infinity, CA", | ||
description: "Q4NTL6", | ||
doseDateTime: "2014-01-12", | ||
doseLabel: "1st Dose", | ||
lotNumber: "92681", | ||
manufacturer: "Moderna", | ||
provider: "Healthgenics", | ||
}); | ||
``` | ||
|
||
### 3. Generate and sign the JWT payload | ||
|
||
```javascript | ||
const payload = gpay.genGPayCovidCard(basicDetails, [testingRecord]); | ||
const signedPayload = gpay.signPayload(payload); | ||
``` | ||
|
||
### 4. Get the full URL | ||
|
||
```javascript | ||
const fullUrl = gpay.generateFullUrl(signedPayload); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
presets: [["@babel/preset-env", { targets: { node: "current" } }], "@babel/preset-typescript"], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const TEST_IAT = 1633413015; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{ | ||
"iss": "[email protected]", | ||
"aud": "google", | ||
"iat": 1620349587, | ||
"typ": "savetogooglepay", | ||
"origins": [], | ||
"payload": { | ||
"covidCardObjects": [ | ||
{ | ||
"id": "your_issuer_id.unique_object_id", | ||
"issuerId": "your_issuer_id", | ||
"barcode": { | ||
"alternateText": "some_barcode_value", | ||
"type": "qrCode", | ||
"value": "some_barcode_value" | ||
}, | ||
"cardColorHex": "#223CFF", | ||
"expiration": "2021-09-09", | ||
"logo": { | ||
"sourceUri": { | ||
"description": "Google Inc", | ||
"uri": "https://www.gstatic.com/images/icons/material/system_gm/2x/healing_black_48dp.png" | ||
} | ||
}, | ||
"patientDetails": { | ||
"dateOfBirth": "1881-05-19", | ||
"identityAssuranceLevel": "IAL1.4", | ||
"patientId": "123-456-ABC", | ||
"patientIdLabel": "National ID", | ||
"patientName": "John Doe" | ||
}, | ||
"testingDetails": { | ||
"testingRecord": [ | ||
{ | ||
"administrationDateTime": "2014-03-14 - (1)", | ||
"contactInfo": "123 Forever Rd. 12345 Infinity, CA - (1)", | ||
"provider": "Tests-R-Us - (1)", | ||
"reportDateTime": "2014-01-15 - (1)", | ||
"testCode": "LOINC 28496 - (1)", | ||
"testDescription": "NcAid - (1)", | ||
"testResultCode": "4321 - (1)", | ||
"testResultDescription": "Negative - (1)", | ||
"specimen": "CNT (Combined Nasal and Throat Swabs)" | ||
}, | ||
{ | ||
"administrationDateTime": "2014-03-14 - (2)", | ||
"contactInfo": "123 Forever Rd. 12345 Infinity, CA - (2)", | ||
"provider": "Tests-R-Us - (2)", | ||
"reportDateTime": "2014-01-15 - (2)", | ||
"testCode": "LOINC 28496 - (2)", | ||
"testDescription": "NcAid - (2)", | ||
"testResultCode": "4321 - (2)", | ||
"testResultDescription": "Negative - (2)", | ||
"specimen": "CNT (Combined Nasal and Throat Swabs)" | ||
} | ||
] | ||
}, | ||
"title": "COVID-19 Test Result Card" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{ | ||
"aud": "google", | ||
"iat": 1620349066, | ||
"iss": "[email protected]", | ||
"typ": "savetogooglepay", | ||
"origins": [], | ||
"payload": { | ||
"covidCardObjects": [ | ||
{ | ||
"id": "your_issuer_id.unique_object_id", | ||
"issuerId": "your_issuer_id", | ||
"cardColorHex": "#223CFF", | ||
"title": "COVID-19 Test Result Card", | ||
"barcode": { | ||
"alternateText": "some_barcode_value", | ||
"type": "qrCode", | ||
"value": "some_barcode_value" | ||
}, | ||
"expiration": "2021-09-09", | ||
"logo": { | ||
"sourceUri": { | ||
"description": "Google Inc", | ||
"uri": "https://www.gstatic.com/images/icons/material/system_gm/2x/healing_black_48dp.png" | ||
} | ||
}, | ||
"patientDetails": { | ||
"dateOfBirth": "1881-05-19", | ||
"identityAssuranceLevel": "IAL1.4", | ||
"patientId": "123-456-ABC", | ||
"patientIdLabel": "National ID", | ||
"patientName": "John Doe" | ||
}, | ||
"testingDetails": { | ||
"testingRecord": [ | ||
{ | ||
"administrationDateTime": "2014-03-14", | ||
"contactInfo": "123 Forever Rd., Infinity, CA 12345", | ||
"provider": "Tests-R-Us", | ||
"reportDateTime": "2014-01-15", | ||
"testCode": "LOINC 28496", | ||
"testDescription": "NcAid", | ||
"testResultCode": "4321", | ||
"testResultDescription": "Negative", | ||
"specimen": "CNT (Combined Nasal and Throat Swabs)" | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
{ | ||
"iss": "[email protected]", | ||
"aud": "google", | ||
"iat": 1620349587, | ||
"typ": "savetogooglepay", | ||
"origins": [], | ||
"payload": { | ||
"covidCardObjects": [ | ||
{ | ||
"id": "your_issuer_id.unique_object_id", | ||
"issuerId": "your_issuer_id", | ||
"barcode": { | ||
"alternateText": "some_barcode_value", | ||
"type": "qrCode", | ||
"value": "some_barcode_value" | ||
}, | ||
"cardColorHex": "#223CFF", | ||
"expiration": "2021-09-09", | ||
"logo": { | ||
"sourceUri": { | ||
"description": "Google Inc", | ||
"uri": "https://www.gstatic.com/images/icons/material/system_gm/2x/healing_black_48dp.png" | ||
} | ||
}, | ||
"patientDetails": { | ||
"dateOfBirth": "1881-05-19", | ||
"identityAssuranceLevel": "IAL1.4", | ||
"patientId": "123-456-ABC", | ||
"patientIdLabel": "National ID", | ||
"patientName": "John Doe" | ||
}, | ||
"title": "COVID-19 Test Vaccination Card", | ||
"vaccinationDetails": { | ||
"vaccinationRecord": [ | ||
{ | ||
"code": "1234", | ||
"contactInfo": "123 Forever Rd. 12345 Infinity, CA", | ||
"description": "Q4NTL6", | ||
"doseDateTime": "2014-01-12", | ||
"doseLabel": "1st Dose", | ||
"lotNumber": "92681", | ||
"manufacturer": "Moderna", | ||
"provider": "Healthgenics" | ||
}, | ||
{ | ||
"code": "1234", | ||
"contactInfo": "123 Forever Rd. 12345 Infinity, CA", | ||
"description": "Q4NTL6", | ||
"doseDateTime": "2014-01-12", | ||
"doseLabel": "1st Dose", | ||
"lotNumber": "92681", | ||
"manufacturer": "Moderna", | ||
"provider": "Healthgenics" | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} |
Oops, something went wrong.