Commit 20d49274 authored by Ishini Kiridena's avatar Ishini Kiridena

RSA key on NFT request

parent 02ac2865
......@@ -4,6 +4,7 @@ const NFTRequest = new mongoose.Schema({
assetcode: String,
requesterpk: String,
issuerpk: String,
requesterrsa: String,
status: String,
});
......
......@@ -11,6 +11,7 @@ router.post("/", async (req, res) => {
const practitionerPK = req.body.practitionerkey;
const practitionerSK = req.body.practitionerseed;
const patientKey = req.body.patient;
const practitionerRSA = req.body.practitionerrsa;
//take the current asset code and the issuer key for the patient from the data base
const assetAndIssuer = await GetIssuerAndAssetCode("patients", patientKey);
......@@ -29,6 +30,7 @@ router.post("/", async (req, res) => {
assetcode: assetCode,
issuerpk: issuerPK,
requesterpk: practitionerPK,
requesterrsa: practitionerRSA,
status: "Pending",
});
try {
......@@ -58,52 +60,6 @@ router.post("/", async (req, res) => {
error,
});
});
// await server
// .loadAccount(sourceAccountKeypair.publicKey())
// .then((sourceAccount) => {
// return CreateTrustline(
// assetCode,
// DecryptWithServerKey(assetAndIssuer.issuerKey),
// sourceAccount
// )
// })
// .then(async (result) => {
// if (result) {
// console.log("Trust line created successfully!");
// //add request to DB
// const nftRequestObj = new NFTRequest({
// assetcode: assetCode,
// issuerpk: issuerPK,
// requesterpk: practitionerPK,
// status: "Pending",
// });
// try {
// const saveRequest = await nftRequestObj.save();
// console.log("NFT request saved to database : " + saveRequest);
// res.status(200).json({
// message: "NFT request saved to database",
// });
// console.log("/practitioner/requestnft - requesting NFT success");
// } catch (errorWhenAddingRequestToDB) {
// console.log(
// "Error when adding NFT request to DB : ",
// errorWhenAddingRequestToDB
// );
// console.log("/practitioner/requestnft - requesting NFT failed");
// return res.status(500).json({
// message: "Error when adding NFT request to DB : ",
// errorWhenAddingRequestToDB,
// });
// }
// } else {
// console.log("/practitioner/requestnft - requesting NFT failed");
// return res.status(500).json({
// message: "Failed to request the NFT",
// });
// }
// });
});
module.exports = router;
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