npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@notarise-gov-sg/eu-dcc-generator

v2.2.0

Published

A helper library for generate EU Digital Covid Certificates

Downloads

152

Readme

Known Vulnerabilities GitHub issues License

Generate EU Digital Covid Certificates

A helper library for for generate EU Digital Covid Certificates.

Getting Started

npm i @notarise-gov-sg/eu-dcc-generator

1. Import

import EuDccGenerator from "@notarise-gov-sg/eu-dcc-generator";
const euDccGenerator = EuDccGenerator(privateKey, publicKey, issuerName);

2. Prepare records

// Patient Details
const patientDetails: PatientDetails = {
  name: "Tan Chen Chen",
  familyName: "Tan",
  firstName: "Chen Chen",
  dateOfBirth: "1990-01-15",
  meta: {
    reference: "abc-cde-cde",
    notarisedOn: "2022-02-26T00:00:00.000Z",
    passportNumber: "E7831177G",
    url: "storedUrl",
  }
};

// Basic Details
const basicDetails: BasicDetails = {
  patientDetails,
  reference: "abc-cde-cde",
  issuerName: "MOH",
  expiryDaysOrDate: 365
};

// Notarise PDT (PCR Testing Record)
const singlePCRTestingRecord: TestingRecord[] = [
  {
    testTypeCode: "94309-2",
    naatTestName: "SARS-CoV-2 (COVID-19) RNA [Presence] in Specimen by NAA with probe detection",
    collectionDateTime: "2020-09-27T06:15:00Z",
    testResultCode: "260385009",
    testCenter: "MacRitchie Medical Clinic",
    testCountry: "SG"
  }
];

// Notarise PDT (ART Testing Record)
const singleARTTestingRecord: TestingRecord[] = [
  {
    testTypeCode: "97097-0",
    ratTestDeviceCode: "1833",
    collectionDateTime: "2020-09-27T06:15:00Z",
    testResultCode: "260385009",
    testCenter: "MacRitchie Medical Clinic",
    testCountry: "SG"
  }
];

// Notarise Vaccination (Vaccination Record)
const vaccinationRecord: VaccinationRecord = {
  vaccinations: [
    {
      vaccineCode: "3339641000133109",
      vaccineName: "PFIZER-BIONTECH COVID-19 Vaccine [Tozinameran] Injection",
      vaccineLot: "Lot12345",
      vaccinationDateTime: "2021-02-14",
      vaccinationLocationCode: "HIC001",
      vaccinationCountry: "SG"
    },
    {
      vaccineCode: "3339641000133109",
      vaccineName: "PFIZER-BIONTECH COVID-19 Vaccine [Tozinameran] Injection",
      vaccineLot: "Lot97531",
      vaccinationDateTime: "2021-03-03",
      vaccinationLocationCode: "HIC002",
      vaccinationCountry: "SG"
    }
  ],
  effectiveDate: "2021-03-17"
};

// Notarise Recovery (Recovery Record)
const validRecoveryRecord: RecoveryRecord[] = [
  {
    firstPositiveTestDate: "2022-01-01T00:00:00.000Z",
    testValidFrom: "2022-01-08T00:00:00.000Z",
    testValidUntil: "2022-06-30T00:00:00.000Z",
    testCountry: "SG"
  }
];

3. Generate Json and sign the payload

  • Generate for Vaccination Record
const payloadJson = euDccGenerator.genEuDcc(basicDetails, vaccinationRecord);
const signedPayload = euDccGenerator.signPayload(payloadJsonpayload);

// signedPayload response data
[
  {
    certificate: {...}
    vaccineCode: '3339641000133109',
    doseNumber: 1,
    expiryDateTime: '2023-02-23T01:00:01.098Z',
    qr: 'HC1:.....',
    appleCovidCardUrl: 'https://redirect.health.apple.com/EU-DCC/#...'
  },
  {
    certificate: {...}
    vaccineCode: '3339641000133109',
    doseNumber: 2,
    expiryDateTime: '2023-02-23T01:00:01.098Z',
    qr: 'HC1:.....',
    appleCovidCardUrl: 'https://redirect.health.apple.com/EU-DCC/#...'
  }
]
  • Generate for Test Record
const payloadJson = euDccGenerator.genEuDcc(basicDetails, [testingRecord]);
const signedPayload = euDccGenerator.signPayload(payloadJsonpayload);

// signedPayload response data
[
  {
    certificate: {...}
    type: 'PCR',
    expiryDateTime: '2023-02-23T01:00:01.098Z',
    qr: 'HC1:.....',
    appleCovidCardUrl: 'https://redirect.health.apple.com/EU-DCC/#...'
  }
]