Commit bb8b426d authored by Kiridena I.T.K_IT19981840's avatar Kiridena I.T.K_IT19981840

Merge branch 'Stellar-seed-decryption-service' into 'master'

Stellar seed decryption completed for patient EHR

See merge request !15
parents 6771b6f6 1957565a
const express = require("express");
const router = express.Router();
const DecryptWithServerKey = require("./../../services/decryptionservice");
const DecryptWithStellarSeed = require("./../../services/seedDecryptionService");
const Patient = require("./../../model/patient/patient");
const axios = require("axios");
const StellarSDK = require("stellar-sdk");
......@@ -116,14 +117,13 @@ router.post("/", async (req, res) => {
genesisJsonOb[i]._attributes.body._value._attributes.dataValue
.data
);
//append genesis details to the HTML string
htmlString =
htmlString +
`<p>` +
name.toString() +
` : ` +
value.toString() +
DecryptWithStellarSeed(value.toString(), decryptedPatientSeed) +
`</p>`;
}
}
......@@ -221,7 +221,10 @@ router.post("/", async (req, res) => {
`<p>` +
name.toString() +
` : ` +
value.toString() +
DecryptWithStellarSeed(
value.toString(),
decryptedPatientSeed
) +
`</p>`;
}
}
......
const cryptojs = require("crypto-js");
function DecryptWithStellarSeed(encryptedText, seed) {
var key = cryptojs.enc.Utf8.parse(seed);
var options = {
mode: cryptojs.mode.CBC,
padding: cryptojs.pad.Pkcs7,
iv: cryptojs.enc.Utf8.parse(seed),
};
var decrypted = cryptojs.AES.decrypt(encryptedText, key, options).toString(
cryptojs.enc.Utf8
);
return decrypted;
}
module.exports = DecryptWithStellarSeed;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment