certificate-fhir-convertor

1.3.5 • Public • Published

Certificate FHIR Converter

This module is used to convert certificates issued by DIVOC to signed FHIR compliant json

Quickstart

###To convert a DIVOC issued W3C certificate to FHIR R4 Json.

1. Install

npm install certificate-fhir-convertor

2. Calling certificateToFhirJson with W3C certificate payload

const {certificateToFhirJson} = require("certificate-fhir-convertor");
const privateKeyPem = '-----BEGIN RSA PRIVATE KEY-----\nPRIVATE_KEY\n-----END RSA PRIVATE KEY-----\n';

try {
    const fhirJson = certificateToFhirJson(certificate, privateKeyPem);
    console.log(fhirJson);
} catch (err) {
    console.error(err);
    // handle the error case
}

3. Verify certificateToFhirJson

const {validateSignedFhirJson} = require("certificate-fhir-convertor");
const publicKeyPem = '-----BEGIN PUBLIC KEY-----\nPUBLIC_KEY\n-----END PUBLIC KEY-----';

const valid = validateSignedFhirJson(certificate, publicKeyPem);
console.log(valid);

###To convert a DIVOC issued W3C certificate to Smart Health Card Json.

const {certificateToSmartHealthJson} = require("certificate-fhir-convertor");

try {
    const shcJson = certificateToSmartHealthJson(certificate);
    console.log(shcJson);
} catch (err) {
    console.error(err);
    // handle the error case
}

Package Sidebar

Install

npm i certificate-fhir-convertor

Weekly Downloads

3

Version

1.3.5

License

GPL-3.0-or-later

Unpacked Size

35.5 kB

Total Files

8

Last publish

Collaborators

  • samarthgr